/* CSS Variables */
:root {
    --primary-color: #0f3460;
    --secondary-color: #16213e;
    --accent-color: #e94560;
    --background-color: #1a1a2e;
    --surface-color: #16213e;
    --text-color: #ffffff;
    --text-secondary: #a0a0a0;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --border-radius: 12px;
    --transition: all 0.3s ease;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
}

/* Light Theme */
[data-theme="light"] {
    --primary-color: #2196f3;
    --secondary-color: #1976d2;
    --accent-color: #e91e63;
    --background-color: #f5f5f5;
    --surface-color: #ffffff;
    --text-color: #212121;
    --text-secondary: #757575;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

p {
    margin-bottom: 1em;
    color: var(--text-secondary);
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    opacity: 0.8;
}

/* Header */
.header {
    background-color: var(--surface-color);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
    margin: 0;
}

/* Menu Toggle */
.menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 101;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    border-radius: 2px;
    transition: var(--transition);
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Navigation */
.nav {
    background-color: var(--surface-color);
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    transform: translateY(-100%);
    opacity: 0;
    transition: var(--transition);
    z-index: 99;
    box-shadow: var(--shadow);
}

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

.nav-list {
    list-style: none;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-link {
    display: block;
    padding: 1rem;
    color: var(--text-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--primary-color);
    color: var(--text-color);
}

/* Main Content */
.main {
    flex: 1;
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.container {
    width: 100%;
}

/* Pages */
.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 2rem 0;
}

.hero-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem;
    color: var(--accent-color);
}

.hero-icon svg {
    width: 100%;
    height: 100%;
}

.hero h2 {
    margin-bottom: 0.5rem;
}

.hero-text {
    font-size: 1.1rem;
    max-width: 400px;
    margin: 0 auto;
}

/* Status Card */
.status-card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: var(--shadow);
}

.status-card h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.status-item:last-child {
    border-bottom: none;
}

.status-label {
    color: var(--text-secondary);
}

.status-value {
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
}

.status-value.online {
    background-color: rgba(76, 175, 80, 0.2);
    color: var(--success-color);
}

.status-value.offline {
    background-color: rgba(244, 67, 54, 0.2);
    color: var(--error-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: #d63050;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--primary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-color);
}

.hidden {
    display: none !important;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.feature-card {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.feature-icon svg {
    width: 100%;
    height: 100%;
}

.feature-card h3 {
    margin-bottom: 0.5rem;
}

.feature-card p {
    margin: 0;
    font-size: 0.9rem;
}

/* About Content */
.about-content {
    margin-top: 1.5rem;
}

.info-card {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.info-card h3 {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.info-card ul {
    list-style: none;
    padding: 0;
}

.info-card li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.info-card li:last-child {
    border-bottom: none;
}

/* Settings */
.settings-list {
    margin-top: 1.5rem;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--surface-color);
    padding: 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.setting-info h3 {
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.setting-info p {
    margin: 0;
    font-size: 0.85rem;
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #555;
    border-radius: 28px;
    transition: var(--transition);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
    background-color: var(--accent-color);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* Footer */
.footer {
    background-color: var(--surface-color);
    padding: 1.5rem;
    text-align: center;
    margin-top: auto;
}

.footer p {
    margin: 0;
    font-size: 0.875rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--surface-color);
    color: var(--text-color);
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transition: var(--transition);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--error-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

/* Update Banner */
.update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--accent-color);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    z-index: 1001;
    font-weight: 500;
    box-shadow: var(--shadow);
}

.update-banner.hidden {
    display: none;
}

.update-banner .btn {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    background-color: white;
    color: var(--accent-color);
}

.update-banner .btn:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

/* Desktop Styles */
@media (min-width: 768px) {
    .menu-toggle {
        display: none;
    }

    .nav {
        position: static;
        transform: none;
        opacity: 1;
        background-color: transparent;
        box-shadow: none;
    }

    .nav-list {
        display: flex;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
    }

    .nav-link {
        padding: 0.5rem 1rem;
    }

    .header-content {
        flex-wrap: wrap;
    }

    .hero-icon {
        width: 150px;
        height: 150px;
    }

    .main {
        padding: 2rem;
    }
}

/* Safe Area for Mobile Devices */
@supports (padding: max(0px)) {
    .header {
        padding-top: max(1rem, env(safe-area-inset-top));
    }

    .footer {
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==================== */
/* Schedule Page Styles */
/* ==================== */

.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.schedule-header h2 {
    margin: 0;
}

.schedule-actions {
    display: flex;
    gap: 0.5rem;
}

.hidden-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    width: auto;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

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

.btn-danger {
    background-color: var(--error-color);
    color: white;
}

.btn-danger:hover {
    background-color: #d32f2f;
}

/* Calendar Navigation */
.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    background-color: var(--surface-color);
    padding: 1rem;
    border-radius: var(--border-radius);
}

.calendar-nav h3 {
    margin: 0;
    font-size: 1.1rem;
}

/* Calendar Grid */
.calendar {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.calendar-weekdays div {
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.5rem;
    text-transform: uppercase;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    position: relative;
    min-height: 40px;
}

.calendar-day:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.calendar-day.other-month {
    color: var(--text-secondary);
    opacity: 0.5;
}

.calendar-day.today {
    background-color: var(--primary-color);
    font-weight: 600;
}

.calendar-day.selected {
    background-color: var(--accent-color);
    color: white;
}

.calendar-day.has-flight {
    font-weight: 600;
}

.calendar-day.has-flight::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 6px;
    height: 6px;
    background-color: var(--accent-color);
    border-radius: 50%;
}

.calendar-day.today.has-flight::after,
.calendar-day.selected.has-flight::after {
    background-color: white;
}

/* Duty type indicators */
.calendar-day.duty-standby::after {
    background-color: var(--warning-color);
}

.calendar-day.duty-dayoff::after {
    background-color: var(--success-color);
}

.calendar-day.duty-training::after {
    background-color: #9c27b0;
}

/* Day Details */
.day-details {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.day-details h3 {
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.day-flights {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Flight Cards */
.flight-card {
    background-color: var(--background-color);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border-left: 4px solid var(--accent-color);
}

.flight-card:hover {
    transform: translateX(5px);
}

.flight-card.standby {
    border-left-color: var(--warning-color);
}

.flight-card.dayoff {
    border-left-color: var(--success-color);
}

.flight-card.training {
    border-left-color: #9c27b0;
}

.flight-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.flight-number {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-color);
}

.flight-aircraft {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.flight-route {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.flight-airport {
    font-weight: 600;
    font-size: 1rem;
}

.flight-arrow {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.flight-times {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Upcoming Flights */
.upcoming-flights {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.upcoming-flights h3 {
    margin-bottom: 1rem;
}

.flight-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    margin: 0;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-footer .btn {
    flex: 1;
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-secondary);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

/* Flight Details Modal */
.details-modal-content {
    max-width: 450px;
}

.details-body {
    padding: 1.5rem;
}

.details-section {
    margin-bottom: 1.5rem;
}

.details-section:last-of-type {
    margin-bottom: 0;
}

.details-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.details-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.details-row:last-child {
    border-bottom: none;
}

.details-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.details-value {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
}

.details-route {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: 8px;
    margin: 0.5rem 0;
}

.details-airport {
    text-align: center;
}

.details-airport-code {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

.details-airport-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.details-arrow {
    color: var(--accent-color);
    font-size: 1.5rem;
}

.details-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.details-badge.flight {
    background-color: rgba(233, 69, 96, 0.2);
    color: var(--accent-color);
}

.details-badge.standby {
    background-color: rgba(255, 152, 0, 0.2);
    color: var(--warning-color);
}

.details-badge.dayoff,
.details-badge.vacation {
    background-color: rgba(76, 175, 80, 0.2);
    color: var(--success-color);
}

.details-badge.training {
    background-color: rgba(156, 39, 176, 0.2);
    color: #ce93d8;
}

.details-badge.ground {
    background-color: rgba(33, 150, 243, 0.2);
    color: #64b5f6;
}

.details-notes {
    background-color: var(--background-color);
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 150px;
    overflow-y: auto;
}

/* Crew List */
.crew-list {
    background-color: var(--background-color);
    border-radius: 8px;
    padding: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.crew-member {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.crew-member:last-child {
    border-bottom: none;
}

.crew-role {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    min-width: 36px;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.crew-name {
    font-size: 0.9rem;
    color: var(--text-color);
}

/* Responsive adjustments for schedule */
@media (max-width: 480px) {
    .schedule-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .calendar-day {
        font-size: 0.8rem;
        min-height: 35px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .flight-route {
        flex-wrap: wrap;
    }

    .details-route {
        flex-direction: column;
        gap: 0.5rem;
    }

    .details-arrow {
        transform: rotate(90deg);
    }
}
