/* Skybridge Flight Planner Styles */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --warning-color: #eab308;
    --error-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-modal {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.login-modal h1 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.login-modal .subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#login-form input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

#login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background-color: transparent;
    color: var(--secondary-color);
    border: 1px solid var(--border-color);
}

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

/* App Layout */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.location-settings {
    display: flex;
    gap: 0.5rem;
}

.location-settings select {
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.8rem;
    background: var(--card-bg);
    cursor: pointer;
}

#user-status {
    color: var(--text-muted);
    font-size: 0.875rem;
}

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

/* Sections */
section {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.section-desc {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Natural Language Search */
.nl-search {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.nl-search textarea {
    flex: 1;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.nl-search textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    padding: 0 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Forms */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

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

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

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

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

/* Must-Have Section */
.must-have-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.must-have-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

#must-have-list {
    margin-bottom: 1rem;
}

.must-have-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.must-have-item button {
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    font-size: 1.25rem;
}

/* Results Section */
.results-section {
    border: 2px solid var(--primary-color);
}

#results-container {
    min-height: 100px;
}

.flight-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 1rem;
}

.flight-info {
    flex: 1;
}

.flight-price {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--success-color);
}

.flight-source {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--bg-color);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Trips List */
.trips-list {
    min-height: 100px;
}

.trip-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.trip-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.trip-status.planned {
    background: #dbeafe;
    color: #1d4ed8;
}

.trip-status.searched {
    background: #fef3c7;
    color: #b45309;
}

.trip-status.booked {
    background: #dcfce7;
    color: #16a34a;
}

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

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

/* Footer */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Parsed Itinerary Display */
.parsed-summary {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-color);
}

.constraints {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.constraint-tag {
    background: #f1f5f9;
    color: var(--secondary-color);
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

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

.parsed-flight {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.parsed-flight.skipped {
    opacity: 0.6;
    background: #f8fafc;
}

.flight-route {
    font-size: 1.1rem;
    min-width: 140px;
}

.flight-date {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.skip-badge {
    background: #dcfce7;
    color: #16a34a;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.flight-notes {
    width: 100%;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.btn-search {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    margin-left: auto;
    transition: background 0.2s;
}

.btn-search:hover {
    background: var(--primary-hover);
}

/* Cycle Trips */
.cycle-trips {
    margin-top: 1rem;
}

.cycle-year {
    margin-bottom: 1rem;
}

.cycle-year h4 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.cycle-trip {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #fafafa;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.cycle-date {
    font-weight: 500;
    min-width: 160px;
}

.cycle-route {
    color: var(--text-muted);
    flex: 1;
}

.btn-search-small {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-search-small:hover {
    background: var(--primary-color);
    color: white;
}

/* Search All Section */
.search-all-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Search Results */
.search-result-group {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.search-result-group:last-child {
    border-bottom: none;
}

.search-result-group h4 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

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

.flight-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: #fafafa;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.flight-option .price {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--success-color);
    min-width: 80px;
}

.flight-option .details {
    flex: 1;
    color: var(--text-muted);
}

.flight-option .source {
    background: #e2e8f0;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--secondary-color);
}

.btn-book {
    background: var(--success-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.btn-book:hover {
    background: #16a34a;
}

.more-results {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Loading State */
.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.loading::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Enhanced Flight Card */
.flight-card-detailed {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.flight-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: #fafafa;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.flight-card-header:hover {
    background: #f5f5f5;
}

.flight-pricing {
    text-align: right;
}

.price-primary {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--success-color);
}

.price-secondary {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.flight-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.flight-times {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.flight-time {
    font-size: 1.1rem;
    font-weight: 500;
}

.flight-arrow {
    color: var(--text-muted);
}

.flight-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.flight-card-body {
    display: none;
    padding: 1.25rem;
}

.flight-card-detailed.expanded .flight-card-body {
    display: block;
}

/* Fare and baggage info */
.fare-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.fare-type {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.baggage-detail {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.baggage-info {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    background: #e8f4fd;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #1565c0;
}

.segment-list {
    margin-bottom: 1.5rem;
}

.segment-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem;
    background: #fafafa;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.segment-number {
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.segment-details {
    flex: 1;
}

.segment-flight {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.segment-route {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.segment-aircraft {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.booking-options {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.booking-options h4 {
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.booking-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.booking-link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.booking-link:hover {
    background: var(--primary-hover);
}

.booking-link.despegar {
    background: #ff6600;
}

.booking-link.despegar:hover {
    background: #e55b00;
}

.booking-link.airline {
    background: #1a365d;
}

.booking-link.airline:hover {
    background: #132a4f;
}

.booking-tips {
    background: #fffbeb;
    border: 1px solid #fbbf24;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
}

.booking-tips strong {
    color: #b45309;
}

.expand-icon {
    transition: transform 0.2s;
    color: var(--text-muted);
}

.flight-card-detailed.expanded .expand-icon {
    transform: rotate(180deg);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    .nl-search {
        flex-direction: column;
    }

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

    .parsed-flight {
        flex-direction: column;
        align-items: flex-start;
    }

    .btn-search {
        margin-left: 0;
        width: 100%;
    }

    .cycle-trip {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

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