/* Custom styles for Airversary */

:root {
    --primary: #e11d48;
    --primary-light: #fecdd3;
    --primary-dark: #be123c;
    --bg-gradient-start: #fdf2f8;
    --bg-gradient-end: #fff1f2;
}

body {
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 4px 20px rgba(225, 29, 72, 0.3);
}

.header h1 {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* Card */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Select styling */
.custom-select {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.custom-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

.custom-select:hover {
    border-color: #d1d5db;
}

/* Search button */
.search-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(225, 29, 72, 0.4);
}

.search-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(225, 29, 72, 0.5);
}

.search-btn:active:not(:disabled) {
    transform: translateY(0);
}

.search-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Table */
.flight-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.flight-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.flight-table thead th {
    color: white;
    font-weight: 600;
    padding: 16px 12px;
    text-align: left;
    font-size: 0.9rem;
    letter-spacing: 0.025em;
}

.flight-table tbody tr {
    background: white;
    transition: background-color 0.2s ease;
}

.flight-table tbody tr:nth-child(even) {
    background: #fdf2f8;
}

.flight-table tbody tr:hover {
    background: var(--primary-light);
}

.flight-table tbody td {
    padding: 14px 12px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.95rem;
}

.flight-table tbody tr:last-child td {
    border-bottom: none;
}

/* Result message */
.result-message {
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
}

.result-message.success {
    background: #ecfdf5;
    color: #065f46;
}

.result-message.error {
    background: #fef2f2;
    color: #991b1b;
}

.result-message.empty {
    background: #fffbeb;
    color: #92400e;
}

/* Description list */
.description-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
    color: #4b5563;
    line-height: 1.6;
}

.description-item::before {
    content: "✈";
    color: var(--primary);
    flex-shrink: 0;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: #9ca3af;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .search-btn {
        width: 100%;
        padding: 14px 20px;
    }

    .flight-table thead th,
    .flight-table tbody td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

/* Make table rows clickable */
.flight-table tbody tr {
    cursor: pointer;
}

.flight-table tbody tr:active {
    transform: scale(0.99);
}

/* ================================
   Modal Styles
   ================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 16px;
}

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

.modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s ease;
}

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

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
}

.modal-close i {
    color: #666;
    font-size: 24px;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 24px 60px 24px 24px;
    border-radius: 20px 20px 0 0;
}

.modal-flight-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.modal-airline-name {
    margin: 4px 0 0;
    opacity: 0.9;
    font-size: 1rem;
}

/* Flight Map */
.flight-map {
    height: 300px;
    background: #e5e7eb;
    position: relative;
}

.flight-map.no-data {
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-no-data,
.map-loading {
    text-align: center;
    color: #6b7280;
}

.map-no-data i,
.map-loading i {
    font-size: 48px;
    margin-bottom: 8px;
}

.map-no-data p,
.map-loading p {
    margin: 0;
    font-size: 0.9rem;
}

.map-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.map-loading .loading-spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
    margin-bottom: 12px;
    border-color: rgba(225, 29, 72, 0.2);
    border-top-color: var(--primary);
}

/* Custom Map Markers */
.custom-marker {
    background: transparent;
    border: none;
}

.marker-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.marker-icon.departure {
    background: #059669;
}

.marker-icon.arrival {
    background: #dc2626;
}

.marker-icon i {
    color: white;
    font-size: 20px;
}

/* City Info Grid */
.city-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 20px;
}

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

.city-card {
    background: #f9fafb;
    border-radius: 12px;
    padding: 16px;
    border-left: 4px solid transparent;
}

.city-card.departure {
    border-left-color: #059669;
}

.city-card.arrival {
    border-left-color: #dc2626;
}

.city-title {
    margin: 0 0 12px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.city-label {
    background: #e5e7eb;
    color: #4b5563;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.city-card.departure .city-label {
    background: #d1fae5;
    color: #065f46;
}

.city-card.arrival .city-label {
    background: #fee2e2;
    color: #991b1b;
}

.city-name {
    font-weight: 700;
    color: #1f2937;
}

.city-code {
    color: #6b7280;
    font-weight: 400;
}

.city-summary {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #4b5563;
}

.loading-text {
    color: #9ca3af;
    font-style: italic;
}

.no-summary {
    color: #9ca3af;
    font-style: italic;
}

/* Leaflet popup customization */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.leaflet-popup-content {
    margin: 10px 14px;
    font-family: 'Noto Sans JP', sans-serif;
}
