:root {
    --bg-deep: #0a0e1a;
    --bg-card: #0f1621;
    --bg-elevated: #141b2b;
    --bg-input: #0c1118;
    --border-subtle: rgba(59, 130, 246, 0.08);
    --border-focus: rgba(59, 130, 246, 0.5);
    --text-primary: #f4f4f6;
    --text-secondary: #8b9bae;
    --text-muted: #5a6a7e;
    --accent-primary: #3b82f6;
    --accent-primary-hover: #60a5fa;
    --accent-success: #10b981;
    --accent-success-hover: #34d399;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-danger-hover: #f87171;
    --gradient-accent: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Subtle background texture */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(37, 99, 235, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.app-container {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 48px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-subtle);
}

.logo {
    width: 52px;
    height: 52px;
    background: var(--gradient-accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.5px;
    box-shadow: var(--shadow-glow);
}

.header-text h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 2px;
}

.header-text p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Form Sections */
.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.section-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
}

.section-icon svg {
    width: 18px;
    height: 18px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* Form Controls */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-label .required {
    color: var(--accent-primary);
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:hover,
.form-select:hover {
    border-color: rgba(59, 130, 246, 0.15);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b9bae' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.form-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Date Accordions */
.dates-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.dates-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.add-date-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-date-btn:hover {
    background: var(--bg-elevated);
    border-color: rgba(59, 130, 246, 0.15);
}

.add-date-btn svg {
    width: 16px;
    height: 16px;
}

/* Date Card */
.date-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.date-card:hover {
    border-color: rgba(59, 130, 246, 0.12);
}

.date-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.date-card-header:hover {
    background: rgba(59, 130, 246, 0.03);
}

.date-card-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.date-badge {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.12);
    padding: 4px 10px;
    border-radius: 4px;
}

.date-card-title {
    font-size: 15px;
    font-weight: 500;
}

.date-card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-left: 4px;
}

.date-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-secondary);
}

.icon-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-danger);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

.chevron {
    transition: transform 0.3s ease;
}

.date-card.collapsed .chevron {
    transform: rotate(-90deg);
}

.date-card-body {
    padding: 0 20px 20px;
    display: block;
}

.date-card.collapsed .date-card-body {
    display: none;
}

.date-picker-row {
    display: flex;
    gap: 16px;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.date-picker-row .form-group {
    flex: 0 0 200px;
}

@media (max-width: 640px) {
    .date-picker-row .form-group {
        flex: 1;
    }
}

/* Crew Members */
.crew-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.crew-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.crew-count {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 4px 10px;
    border-radius: 20px;
}

.crew-member-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    padding-right: 56px;
    margin-bottom: 12px;
    position: relative;
    transition: all 0.2s ease;
}

.crew-member-card:hover {
    border-color: rgba(59, 130, 246, 0.12);
}

.crew-member-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gradient-accent);
    border-radius: 3px 0 0 3px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.crew-member-card:hover::before {
    opacity: 1;
}

.crew-grid {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1fr 1fr 1fr;
    gap: 14px;
    align-items: end;
}

@media (max-width: 900px) {
    .crew-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    .crew-grid {
        grid-template-columns: 1fr 1fr;
    }

    .crew-grid .form-group:first-child {
        grid-column: span 2;
    }
}

.crew-notes-row {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--border-subtle);
}

.remove-crew-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.remove-crew-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--accent-danger);
}

.remove-crew-btn svg {
    width: 18px;
    height: 18px;
}

.add-crew-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: transparent;
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.add-crew-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.05);
}

.add-crew-btn svg {
    width: 16px;
    height: 16px;
}

/* Footer Actions */
.form-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid var(--border-subtle);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-secondary {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--gradient-accent);
    color: white;
    box-shadow: var(--shadow-sm), 0 0 20px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), 0 0 30px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 140px);
}

.modal-body pre {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 20px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
}

/* Flatpickr Custom Theme */
.flatpickr-calendar {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    font-family: var(--font-sans) !important;
}

.flatpickr-months {
    background: var(--bg-elevated) !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
}

.flatpickr-month {
    color: var(--text-primary) !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    background: transparent !important;
    color: var(--text-primary) !important;
}

.flatpickr-current-month input.cur-year {
    color: var(--text-primary) !important;
}

.flatpickr-prev-month, .flatpickr-next-month {
    fill: var(--text-secondary) !important;
}

.flatpickr-prev-month:hover, .flatpickr-next-month:hover {
    fill: var(--text-primary) !important;
}

.flatpickr-weekdays {
    background: var(--bg-elevated) !important;
}

span.flatpickr-weekday {
    color: var(--text-muted) !important;
    font-weight: 500 !important;
}

.flatpickr-day {
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
}

.flatpickr-day:hover {
    background: var(--bg-elevated) !important;
    border-color: transparent !important;
}

.flatpickr-day.selected {
    background: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
}

.flatpickr-day.today {
    border-color: var(--accent-primary) !important;
}

.flatpickr-time {
    border-top: 1px solid var(--border-subtle) !important;
}

.flatpickr-time input {
    color: var(--text-primary) !important;
}

.flatpickr-time .flatpickr-am-pm {
    color: var(--text-primary) !important;
}

.numInputWrapper:hover {
    background: var(--bg-elevated) !important;
}

.numInputWrapper span {
    border: none !important;
}

.numInputWrapper span:hover {
    background: var(--accent-primary) !important;
}

.flatpickr-time input:hover,
.flatpickr-time input:focus {
    background: var(--bg-elevated) !important;
}

.flatpickr-time .flatpickr-am-pm:hover {
    background: var(--bg-elevated) !important;
}

/* Time picker dropdown - fix contrast issue */
.flatpickr-time .numInput:hover,
.flatpickr-time .numInput:focus {
    background: var(--accent-primary) !important;
    color: white !important;
}

/* Success Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--accent-success);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg), 0 0 20px rgba(16, 185, 129, 0.2);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
}

.toast.active {
    transform: translateY(0);
    opacity: 1;
}

.toast-icon {
    width: 24px;
    height: 24px;
    color: var(--accent-success);
}

.toast-message {
    font-size: 14px;
    font-weight: 500;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-section {
    animation: fadeInUp 0.5s ease forwards;
}

.form-section:nth-child(2) {
    animation-delay: 0.1s;
}

.date-card {
    animation: fadeInUp 0.4s ease forwards;
}

.crew-member-card {
    animation: fadeInUp 0.3s ease forwards;
}
