/* style.css - Flight Booking System Stylesheet */

/* CSS Variables for Theme */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
    --gray-color: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

[data-theme="dark"] {
    --primary-color: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary-color: #10b981;
    --dark-color: #f9fafb;
    --light-color: #1f2937;
    --gray-color: #9ca3af;
    --border-color: #374151;
    background: #111827;
}

/* Dark Theme Specific Styles */
[data-theme="dark"] .header {
    background: #1f2937;
}

[data-theme="dark"] .search-form,
[data-theme="dark"] .sidebar,
[data-theme="dark"] .results-container,
[data-theme="dark"] .modal-content {
    background: #1f2937;
    color: #f9fafb;
}

[data-theme="dark"] .form-control {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

[data-theme="dark"] .flight-card {
    background: #1f2937;
    border-color: #374151;
}

[data-theme="dark"] .flight-duration {
    background: #374151;
}

[data-theme="dark"] .flight-details {
    background: #374151;
}

[data-theme="dark"] .badge {
    color: #f9fafb;
}

[data-theme="dark"] .alert {
    color: #f9fafb;
}

[data-theme="dark"] .alert-success {
    background: #064e3b;
    color: #d1fae5;
}

[data-theme="dark"] .alert-error {
    background: #7f1d1d;
    color: #fee2e2;
}

[data-theme="dark"] .alert-warning {
    background: #78350f;
    color: #fef3c7;
}

[data-theme="dark"] .empty-state i {
    color: #6b7280;
}

[data-theme="dark"] .api-info-item {
    background: #374151;
}

[data-theme="dark"] .page-link {
    background: #374151;
    color: #f9fafb;
    border-color: #4b5563;
}

[data-theme="dark"] .page-link:hover {
    background: #4b5563;
}

[data-theme="dark"] .page-link.active {
    background: var(--primary-color);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: white;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo i {
    font-size: 2rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.theme-toggle, .session-status {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    background: var(--light-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--border-color);
}

.session-status.active {
    background: #d1fae5;
    color: #065f46;
    border-color: #10b981;
}

.session-status:not(.active) {
    background: #fee2e2;
    color: #991b1b;
    border-color: #ef4444;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
}

.dashboard {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
}

/* Sidebar */
.sidebar {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    height: fit-content;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark-color);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Search Form */
.search-form {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: background 0.3s;
}

.checkbox-label:hover {
    background: var(--light-color);
}

.checkbox-label input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: var(--primary-color);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--gray-color);
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--secondary-color);
    color: white;
}

.btn-success:hover {
    background: #0da271;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.btn-block {
    width: 100%;
}

/* Flight Results */
.results-container {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.results-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-color);
}

.results-count {
    background: var(--light-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.flight-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.flight-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.flight-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.flight-card:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.flight-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(37, 99, 235, 0.1) 100%);
}

.flight-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.flight-airline {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.flight-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: right;
}

.flight-details {
    display: grid;
    grid-template-columns: 2fr 1fr 2fr;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--light-color);
    border-radius: var(--radius-md);
}

@media (max-width: 768px) {
    .flight-details {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .flight-details > div {
        text-align: center !important;
    }
}

.flight-time {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.flight-airport {
    font-size: 0.9rem;
    color: var(--gray-color);
    margin-top: 0.25rem;
}

.flight-duration {
    text-align: center;
    padding: 1rem;
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.flight-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.flight-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.badge-refundable {
    background: #d1fae5;
    color: #065f46;
}

.badge-nonrefundable {
    background: #fee2e2;
    color: #991b1b;
}

.badge-hold {
    background: #fef3c7;
    color: #92400e;
}

.badge-direct {
    background: #dbeafe;
    color: #1e40af;
}

/* Notices */
.notices-container {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 1rem;
    margin-bottom: 2rem;
    border-radius: var(--radius-md);
}

.notice-title {
    font-weight: 600;
    color: #92400e;
    margin-bottom: 0.5rem;
}

.notice-item {
    margin-bottom: 0.5rem;
    color: #92400e;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.notice-item i {
    margin-top: 0.125rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert i {
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-color);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--border-color);
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.empty-state p {
    font-size: 1rem;
    color: var(--gray-color);
}

/* Loading State */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    box-shadow: var(--shadow-lg);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-color);
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--light-color);
    color: var(--danger-color);
}

.modal-body {
    line-height: 1.6;
}

.modal-body p {
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: var(--light-color);
    border-radius: var(--radius-md);
}

.api-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 640px) {
    .api-info-grid {
        grid-template-columns: 1fr;
    }
}

.api-info-item {
    padding: 0.75rem;
    background: var(--light-color);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary-color);
}

.api-info-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-color);
    margin-bottom: 0.25rem;
}

.api-info-value {
    word-break: break-all;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--dark-color);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.page-link {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--dark-color);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
}

.page-link:hover {
    background: var(--light-color);
    transform: translateY(-1px);
}

.page-link.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-link.disabled:hover {
    background: transparent;
    transform: none;
}

/* Flight Status Indicators */
.seats-low {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Responsive Design Improvements */
@media (max-width: 640px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
    }
    
    .search-form {
        padding: 1.5rem;
    }
    
    .results-container {
        padding: 1.5rem;
    }
    
    .flight-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .flight-footer form {
        width: 100%;
    }
    
    .flight-footer .btn {
        width: 100%;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
}

/* Form Improvements */
input[type="date"] {
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

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='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

/* Text Utilities */
.text-center {
    text-align: center;
}

.text-success {
    color: var(--secondary-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-muted {
    color: var(--gray-color);
    font-size: 0.85rem;
}

/* Spacing Utilities */
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }

/* Visibility Utilities */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Animation for form validation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.form-control.error {
    border-color: var(--danger-color);
    animation: shake 0.5s ease;
}

/* Print Styles */
@media print {
    .header-actions,
    .search-form,
    .theme-toggle,
    .btn-secondary {
        display: none;
    }
    
    .flight-card {
        break-inside: avoid;
        border: 1px solid #000;
    }
}

/* Selected Flight Details */
.selected-flight-details {
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
    border-radius: var(--radius-md);
}

.flight-summary {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .flight-summary {
        grid-template-columns: 1fr;
    }
}

.route-info {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.route {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.route i {
    color: var(--primary-color);
}

.price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: right;
}