:root {
    --bg-color: #e0e5ec; /* רקע ראשי ל-Neumorphism (ימשיך לשמש לאלמנטים) */
    --primary-color: #3d5af1; /* כחול אינדיגו למבטאים */
    --secondary-color: #00bfa5; /* טורקיז למבטאים משניים */
    --danger-color: #ff4081; /* ורוד פוקסיה לאזהרות */
    --success-color: #00c853; /* ירוק חי להצלחה */
    --text-color-dark: #37474f; /* כחול-אפור כהה לטקסט */
    --text-color-light: #78909c; /* כחול-אפור בהיר לטקסט משני */
    --shadow-light: #ffffff; /* צל בהיר */
    --shadow-dark: #a3b1c6; /* צל כהה */
    --border-radius: 12px; /* עיגול פינות אחיד */
    --font-main: 'Poppins', 'Noto Sans Hebrew', sans-serif;
    --font-alt: 'Noto Sans Hebrew', sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    /* background-color: var(--bg-color); -- הוסר/הוער לטובת תמונת רקע */
    color: var(--text-color-dark);
    line-height: 1.7;
    direction: rtl;
    padding: 20px 0; /* ריווח עליון ותחתון לגוף */

    /* --- שימוש בקישור התמונה החדש כרקע --- */
    background-image: url('https://lh3.googleusercontent.com/pw/AP1GczO9Pee8zXv-oiQw0Tvv8rCHAwEqBWXlZPjNurWu6msWK4kY_EFsuLgJZRwcUknXOwcGEXLzCRWlFdMGFi2jPWYc9CfH4umX8_fT3K6DB8YG_RwCEgyIyHFjWL_l0QDN0UED_ZzZpjw8ENos0M1-Y_gk=w1349-h954-s-no-gm?authuser=0');
    /* --- סוף הגדרת תמונת הרקע --- */

    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    /* position: relative; -- לא קריטי כאן אם אין iframe מאחור */
}

.container {
    background-color: var(--bg-color); /* שמירה על רקע הקונטיינר אטום */
    /* או עם שקיפות אם תרצה שתמונת הרקע תיראה דרכו במעומעם: */
    /* background-color: rgba(224, 229, 236, 0.9); */
    padding: 35px 45px;
    border-radius: var(--border-radius);
    text-align: center;
    width: 95%;
    max-width: 950px;
    margin: 20px auto;
    position: relative; /* כדי שיוצג מעל body אם ל-body יהיה משהו מיוחד ויאפשר z-index פנימי */
    z-index: 1; /* מבטיח שהוא מעל רקע ה-body אם יש חפיפה כלשהי בתרחישים מורכבים */
}
.neumorphic-card {
    box-shadow: 9px 9px 16px var(--shadow-dark),
                -9px -9px 16px var(--shadow-light);
}

header {
    margin-bottom: 40px;
    padding-bottom: 25px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.logo-title {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.header-icon {
    font-size: 3em;
    margin-left: 18px;
    color: var(--primary-color);
    filter: drop-shadow(3px 3px 5px rgba(0,0,0,0.1));
    animation: gentle-rotate 8s ease-in-out infinite;
}
@keyframes gentle-rotate {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(5deg); }
    100% { transform: rotate(0deg); }
}
h1 {
    font-size: 2.6em;
    font-weight: 700;
    color: var(--text-color-dark);
    text-shadow: 1px 1px 2px var(--shadow-light);
}
.subtitle {
    font-size: 1.1em;
    color: var(--text-color-light);
    font-family: var(--font-alt);
    font-weight: 400;
}

.preview-areas {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 35px;
    margin-bottom: 40px;
}

.preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px;
    border-radius: var(--border-radius);
    background-color: var(--bg-color); /* שמירה על רקע חלק זה */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.neumorphic-inset {
    box-shadow: inset 5px 5px 10px var(--shadow-dark),
                inset -5px -5px 10px var(--shadow-light);
}

.preview-header {
    display: flex;
    align-items: center;
    font-size: 1.25em;
    font-weight: 600;
    color: var(--text-color-dark);
    margin-bottom: 18px;
}
.preview-header i {
    margin-left: 12px;
    color: var(--primary-color);
    font-size: 1.35em;
}

.video-wrapper {
    width: 100%;
    border-radius: calc(var(--border-radius) - 4px);
    overflow: hidden;
    position: relative;
    margin-bottom: 18px;
    box-shadow: 3px 3px 6px var(--shadow-dark),
                -3px -3px 6px var(--shadow-light);
}
.video-wrapper.recording {
    animation: pulse-neumorphic 1.5s infinite;
}
@keyframes pulse-neumorphic {
    0% {
        box-shadow: 3px 3px 6px var(--shadow-dark),
                    -3px -3px 6px var(--shadow-light),
                    0 0 0 0px rgba(255, 64, 129, 0.5);
    }
    70% {
        box-shadow: 3px 3px 6px var(--shadow-dark),
                    -3px -3px 6px var(--shadow-light),
                    0 0 0 12px rgba(255, 64, 129, 0);
    }
    100% {
        box-shadow: 3px 3px 6px var(--shadow-dark),
                    -3px -3px 6px var(--shadow-light),
                    0 0 0 0px rgba(255, 64, 129, 0);
    }
}

.preview-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #424242;
    display: block;
}

.action-button {
    padding: 12px 22px;
    font-size: 1.05em;
    font-weight: 500;
    width: 100%;
}
.neumorphic-button {
    background-color: var(--bg-color);
    color: var(--text-color-dark);
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 5px 5px 10px var(--shadow-dark),
                -5px -5px 10px var(--shadow-light);
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.neumorphic-button:hover:not(:disabled) {
    box-shadow: 3px 3px 6px var(--shadow-dark),
                -3px -3px 6px var(--shadow-light);
    color: var(--primary-color);
}
.neumorphic-button:active:not(:disabled) {
    box-shadow: inset 3px 3px 6px var(--shadow-dark),
                inset -3px -3px 6px var(--shadow-light);
    color: var(--primary-color);
}
.action-button.active {
    color: var(--success-color);
    box-shadow: inset 3px 3px 6px var(--shadow-dark),
                inset -3px -3px 6px var(--shadow-light);
}
.action-button i { margin-left: 10px; font-size: 1.1em; }

.main-controls {
    margin-bottom: 40px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.control-button {
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: 600;
    min-width: 200px;
}
.control-button i { margin-left: 12px; font-size: 1.25em; }

.control-button.primary-action { color: var(--primary-color); }
.control-button.primary-action:hover:not(:disabled) { color: var(--primary-color); }
.control-button.danger-action { color: var(--danger-color); }
.control-button.danger-action:hover:not(:disabled) { color: var(--danger-color); }
.control-button.success-action { color: var(--success-color); }
.control-button.success-action:hover:not(:disabled) { color: var(--success-color); }


.control-button:disabled {
    color: var(--text-color-light) !important;
    opacity: 0.7;
    box-shadow: 3px 3px 6px var(--shadow-dark),
                -3px -3px 6px var(--shadow-light);
    cursor: not-allowed;
}
.control-button:disabled i { color: var(--text-color-light) !important; }


.output-controls {
    margin-top: 40px;
    padding: 30px 35px;
    border-radius: var(--border-radius);
}
.neumorphic-inset-darker {
     background-color: var(--bg-color);
     box-shadow: inset 7px 7px 14px var(--shadow-dark),
                 inset -7px -7px 14px var(--shadow-light);
}
.output-controls h2 {
    font-size: 1.7em;
    color: var(--text-color-dark);
    margin-bottom: 12px;
}
.output-controls h2 i { color: var(--success-color); margin-left: 12px; }
.form-instructions {
    font-size: 1em;
    color: var(--text-color-light);
    margin-bottom: 25px;
    font-family: var(--font-alt);
}

.output-controls form { margin-top: 15px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 22px;
    margin-bottom: 28px;
}
.form-group {
    display: flex;
    flex-direction: column;
    text-align: right;
}
.form-group label {
    margin-bottom: 10px;
    font-weight: 500;
    font-size: 0.95em;
    color: var(--text-color-dark);
}
.neumorphic-input {
    padding: 12px 15px;
    border-radius: var(--border-radius);
    border: none;
    font-size: 1em;
    font-family: var(--font-main);
    width: 100%;
    background-color: var(--bg-color);
    color: var(--text-color-dark);
    box-shadow: inset 3px 3px 6px var(--shadow-dark),
                inset -3px -3px 6px var(--shadow-light);
    transition: box-shadow 0.2s ease;
}
.neumorphic-input:focus {
    outline: none;
    box-shadow: inset 1px 1px 2px var(--shadow-dark),
                inset -1px -1px 2px var(--shadow-light),
                0 0 0 2px var(--primary-color);
}

.form-group.checkbox-group { margin-bottom: 28px; }
.neumorphic-checkbox-wrapper {
    display: flex;
    align-items: center;
}
.neumorphic-checkbox-wrapper input[type="checkbox"] {
    display: none;
}
.neumorphic-checkbox-wrapper label {
    position: relative;
    padding-right: 35px;
    cursor: pointer;
    user-select: none;
    font-size: 0.95em;
    color: var(--text-color-dark);
}
.neumorphic-checkbox-wrapper label::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background-color: var(--bg-color);
    border-radius: 6px;
    box-shadow: 3px 3px 6px var(--shadow-dark),
                -3px -3px 6px var(--shadow-light);
    transition: all 0.2s ease;
}
.neumorphic-checkbox-wrapper input[type="checkbox"]:checked + label::before {
    box-shadow: inset 2px 2px 4px var(--shadow-dark),
                inset -2px -2px 4px var(--shadow-light);
}
.neumorphic-checkbox-wrapper label::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    font-size: 14px;
    color: var(--primary-color);
    transition: transform 0.2s ease;
}
.neumorphic-checkbox-wrapper input[type="checkbox"]:checked + label::after {
    transform: translateY(-50%) scale(1);
}


.form-error-message {
    padding: 10px 15px;
    border-radius: var(--border-radius);
    border: none;
    background-color: rgba(255, 64, 129, 0.1);
    color: var(--danger-color);
    box-shadow: inset 2px 2px 4px rgba(255, 64, 129, 0.3),
                inset -2px -2px 4px rgba(255, 255, 255, 0.7);
    margin-top: 15px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0; top: 0;
    width: 100%; height: 100%;
    overflow-y: auto;
    background-color: rgba(224, 229, 236, 0.8); /* bg-color עם שקיפות, יטשטש את תמונת הרקע של ה-body */
    padding: 30px;
    direction: ltr;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.modal-content {
    background-color: var(--bg-color); /* שמירה על רקע תוכן המודל אטום */
    margin: 0 auto;
    padding: 30px 40px;
    width: 100%;
    max-width: 850px;
    border-radius: var(--border-radius);
    box-shadow: 12px 12px 20px var(--shadow-dark),
                -12px -12px 20px var(--shadow-light);
    text-align: center;
    position: relative; /* כדי שיוכל לעלות מעל רקע המודל הכללי אם יש צורך */
    animation: scaleUp 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 1051; /* מעל רקע המודל הכללי (backdrop) */
}
@keyframes scaleUp {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal-content h2 {
    margin-bottom: 25px;
    font-size: 1.8em;
    font-weight: 600;
    color: var(--text-color-dark);
}
.modal-content h2 i { margin-left: 10px; color: var(--primary-color); }

.close-modal-button {
    position: absolute;
    left: 25px; top: 20px;
    font-size: 22px;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 50%;
    background-color: var(--bg-color);
    color: var(--text-color-light);
    box-shadow: 3px 3px 6px var(--shadow-dark),
                -3px -3px 6px var(--shadow-light);
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}
.close-modal-button:hover {
    box-shadow: inset 2px 2px 4px var(--shadow-dark),
                inset -2px -2px 4px var(--shadow-light);
    color: var(--danger-color);
}

.video-container {
    margin-bottom: 30px;
    border-radius: calc(var(--border-radius) - 2px);
    box-shadow: inset 4px 4px 8px var(--shadow-dark),
                inset -4px -4px 8px var(--shadow-light);
    padding: 8px;
    background-color: var(--bg-color);
}
.video-container iframe {
    border-radius: calc(var(--border-radius) - 6px);
    width: 100%;
    aspect-ratio: 16 / 9;
}

#confirmPreRecordVideo { margin-top: 5px; }


footer {
    margin-top: auto;
    padding: 25px;
    text-align: center;
    color: var(--text-color-light);
    font-size: 0.9em;
    font-family: var(--font-alt);
    width: 100%;
    background-color: var(--bg-color); /* שמירה על רקע הפוטר אטום */
    /* או עם שקיפות: */
    /* background-color: rgba(224, 229, 236, 0.9); */
    box-shadow: 0 -5px 10px var(--shadow-dark),
                0 -3px  6px var(--shadow-light);
    position: relative;
    z-index: 1; /* מבטיח שהוא מעל רקע ה-body */
    border-top: 1px solid transparent;
}


@media (max-width: 768px) {
    body { padding: 10px 0; }
    .container { padding: 25px; margin: 15px auto; }
    h1 { font-size: 2.1em; }
    .modal-content { max-width: 90%; padding: 25px; }
    .form-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 480px) {
    .container { padding: 20px 15px; }
    h1 { font-size: 1.8em; }
    .subtitle { font-size: 0.95em; }
    .preview-areas {
        grid-template-columns: 1fr;
    }
    .preview-header { font-size: 1.1em; }
    .action-button { padding: 10px 15px; font-size: 0.95em;}
    .control-button, .process-button { padding: 12px 20px; font-size: 1em; min-width: 160px;}
    .modal-content { padding: 20px 15px; }
    .modal-content h2 { font-size: 1.3em; }
    .close-modal-button { left: 15px; top: 10px; width: 35px; height: 35px; line-height: 35px; font-size: 20px;}
}