/**
 * Quadra Ferry Website - Premium Styles
 * Optimized for Modern UI/UX
 * @version 3.0.0
 */

/* ===== PREMIUM VARIABLES & THEME ===== */
:root {
    /* Primary Gradient Brand Colors */
    --primary-blue: #0066cc;
    /* Fallback */
    --primary-gradient: linear-gradient(135deg, #0066cc 0%, #0099ff 100%);
    --secondary-gradient: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);

    /* System Colors */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;

    /* Light Mode Palette */
    --background-color: #f3f4f6;
    --surface-color: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.95);

    /* Typography */
    --font-heading: 'Outfit', -apple-system, system-ui, sans-serif;
    --font-body: 'Inter', -apple-system, system-ui, sans-serif;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-tertiary: #9ca3af;

    /* Borders & Shadows */
    --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), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: 1px solid rgba(255, 255, 255, 0.5);
    --glass-blur: blur(12px);

    /* LEGACY / COMPATIBILITY VARIABLES */
    --light-blue: #e7f0fe;
    --light-yellow: #fff3bf;
    --info-bg: #e8f4f8;
    --info-border: #b3dce6;
}

[data-theme="dark"] {
    --primary-blue: #3b82f6;
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);

    --background-color: #0f172a;
    --surface-color: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.8);

    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-tertiary: #9ca3af;

    --border-color: #334155;

    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);

    /* LEGACY / COMPATIBILITY VARIABLES (Dark) */
    --light-blue: #1a2a3a;
    --light-yellow: #3a3200;
    --info-bg: #1e3a4a;
    --info-border: #2d5266;
}

/* ===== GLOBAL RESET & TYPOGRAPHY ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

/* ===== LAYOUT & CONTAINERS ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ===== CARDS & SURFACES (Glass & Shadow) ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(59, 130, 246, 0.3);
}

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

/* ===== HEADER & NAV ===== */
.header {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.75rem 0;
    transition: all 0.3s ease;
}

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

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.25rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--background-color);
    color: var(--primary-blue);
    transform: scale(1.05);
}

/* ===== BUTTONS ===== */
.btn-primary,
.cta-button,
.btn-calculate {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-family: var(--font-heading);
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary:hover,
.cta-button:hover,
.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -1px rgba(37, 99, 235, 0.4);
    filter: brightness(1.1);
}

/* ===== SCHEDULE TABLE ===== */
.schedule-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.schedule-table th {
    text-align: left;
    padding: 1rem;
    font-family: var(--font-heading);
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    background: transparent;
}

.schedule-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    /* Nice for time */
    font-size: 1.1rem;
}

.schedule-table tr:hover td {
    background: rgba(59, 130, 246, 0.05);
}

.next-ferry {
    background: rgba(16, 185, 129, 0.1) !important;
}

.next-ferry td:first-child {
    position: relative;
}

.next-ferry td:first-child::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--success-color);
}

/* ===== ALERTS & INFO BOXES ===== */
.info-box {
    border-radius: var(--radius-md);
    border: 1px solid;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

/* Specific Alert Types */
.info-box[style*="e8f4f8"] {
    /* Cortes / Blue */
    background: rgba(59, 130, 246, 0.1) !important;
    border-color: rgba(59, 130, 246, 0.2) !important;
    color: var(--primary-blue);
}

.info-box[style*="fff3cd"] {
    /* Warning / Yellow */
    background: rgba(245, 158, 11, 0.1) !important;
    border-color: rgba(245, 158, 11, 0.2) !important;
    color: var(--warning-color);
}

/* ===== FOOTER ===== */
.footer {
    background: #0f172a;
    /* Always dark footer */
    color: #e2e8f0;
    padding: 4rem 1rem 2rem;
    margin-top: 4rem;
    position: relative;
}

.footer h3 {
    color: white;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: white;
}

.form-control {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    width: 100%;
}

/* ===== MOBILE MODAL ===== */
.modal-overlay {
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
}

/* ===== UTILITIES ===== */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
    }

    /* Mobile Header Optimization */
    .header-wrapper {
        flex-direction: column;
        align-items: stretch;
        padding: 0;
    }

    .header-top {
        width: 100%;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        justify-content: space-between;
    }

    .route-section {
        width: 100%;
        border-radius: 0;
        background: rgba(0, 0, 0, 0.1);
        padding: 0.75rem 1rem;
        flex-direction: row;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .site-name {
        font-size: 1.1rem;
    }

    .route-display {
        font-size: 0.95rem;
    }

    .route-switch-btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
}

/* ===== CITATION MODAL ===== */
.citation-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.citation-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.citation-modal {
    background: var(--surface-color);
    width: 90%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-premium);
    padding: 2rem;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

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

.citation-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 50%;
    line-height: 1;
}

.citation-close:hover {
    background: var(--background-color);
    color: var(--danger-color);
}

.citation-option {
    margin-bottom: 1.5rem;
    background: var(--background-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    position: relative;
}

.citation-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
    display: block;
    font-weight: 700;
}

.citation-text {
    font-family: 'Georgia', serif;
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.5;
    user-select: all;
    /* Makes it easy to copy */
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--primary-blue);
    transition: all 0.2s;
}

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

.citation-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.citation-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}