/* ========================================
   ARRIVTRACK MODERN DESIGN SYSTEM
   Tailwind-inspired utilities with custom theme
   ======================================== */

/* Modern Navbar Styles */
.glass-navbar-modern {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

body.dark .glass-navbar-modern {
    background: rgba(15, 15, 15, 0.85);
    border-bottom: 1px solid rgba(255, 172, 28, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Logo Text */
.logo-text {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

body.dark .logo-text {
    background: linear-gradient(135deg, #ffffff 0%, #FFAC1C 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navigation Links */
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #4b5563;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    text-decoration: none;
}

body.dark .nav-link {
    color: #d1d5db;
}

.nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 172, 28, 0.1);
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.nav-link:hover::before {
    opacity: 1;
}

.nav-link:hover {
    color: #FFAC1C;
    transform: translateY(-1px);
}

body.dark .nav-link:hover {
    color: #FFAC1C;
}

/* Primary Nav Link (CTA) */
.nav-link-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    background: linear-gradient(135deg, #FFAC1C 0%, #ff8c00 100%);
    color: #0f0f0f;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(255, 172, 28, 0.3);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.nav-link-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.nav-link-primary:hover::before {
    left: 100%;
}

.nav-link-primary:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(255, 172, 28, 0.4);
}

.nav-link-primary:active {
    transform: translateY(0) scale(1.02);
}

/* Icon Button */
.nav-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    color: #4b5563;
}

body.dark .nav-icon-btn {
    color: #d1d5db;
}

.nav-icon-btn:hover {
    background: rgba(255, 172, 28, 0.1);
    color: #FFAC1C;
    transform: scale(1.1);
}

/* Profile Avatar */
.profile-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    border: 2px solid rgba(255, 172, 28, 0.3);
    cursor: pointer;
    transition: all 0.2s;
    object-fit: cover;
}

.profile-avatar:hover {
    transform: scale(1.1);
    border-color: #FFAC1C;
    box-shadow: 0 0 0 4px rgba(255, 172, 28, 0.1);
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    min-width: 12rem;
    max-width: 28rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    /* single-column scroll (avoids 2-col spacing holes) */
    max-height: 70vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* (Deprecated) multi-row/two-column dropdown removed: keep single-column scroll */

body.dark .dropdown-menu {
    background: rgba(15, 15, 15, 0.95);
    border: 1px solid rgba(255, 172, 28, 0.2);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.group:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    white-space: nowrap;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #4b5563;
    text-decoration: none;
    transition: all 0.2s;
}

body.dark .dropdown-item {
    color: #d1d5db;
}

.dropdown-item:hover {
    background: rgba(255, 172, 28, 0.1);
    color: #FFAC1C;
    transform: translateX(4px);
}

/* Modern Hamburger */
.hamburger-modern {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    width: 2.5rem;
    height: 2.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.hamburger-modern:hover {
    background: rgba(255, 172, 28, 0.1);
}

.hamburger-modern span {
    width: 1.5rem;
    height: 2px;
    background: #4b5563;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}

body.dark .hamburger-modern span {
    background: #d1d5db;
}

/* Hamburger animation when menu is open */
.hamburger-modern.menu-open span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger-modern.menu-open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger-modern.menu-open span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 4rem;
    left: 0;
    right: 0;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 10000000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: none; /* Hidden by default, JavaScript will control visibility */
    /* Height is now based on content, not fixed to bottom */
}

/* When Alpine.js shows the menu, it will override display: none */
.mobile-menu[x-cloak] {
    display: none !important;
}

body.dark .mobile-menu {
    background: rgba(15, 15, 15, 0.95);
}

body.dark .mobile-menu.active {
    border-top: 1px solid rgba(255, 172, 28, 0.15);
}

.mobile-menu-content {
    padding: 1.5rem;
    padding-bottom: 2rem;
    background: transparent;
    /* Height is now based on content, not fixed */
    margin: 0;
}

/* Two-column layout for mobile menu links */
.mobile-menu-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 1rem;
}

@media (max-width: 480px) {
    .mobile-menu-links {
        grid-template-columns: 1fr;
    }
}

/* Full-width mobile nav link (for single items like About when not logged in) */
.mobile-nav-link-full {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
}

body.dark .mobile-menu-content {
    background: rgba(15, 15, 15, 0.95);
}

.mobile-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 172, 28, 0.05);
    border-radius: 12px;
    margin-bottom: 0.5rem;
}

.mobile-text {
    color: #1f2937;
}

body.dark .mobile-text {
    color: #ffffff;
}

.mobile-text-secondary {
    color: #6b7280;
}

body.dark .mobile-text-secondary {
    color: #9ca3af;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #4b5563;
    text-decoration: none;
    transition: all 0.2s;
    margin: 0;
    text-align: left;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

body.dark .mobile-nav-link {
    background: rgba(31, 41, 55, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark .mobile-nav-link {
    color: #d1d5db;
}

.mobile-nav-link:hover {
    background: rgba(255, 172, 28, 0.1);
    color: #FFAC1C;
    transform: translateX(4px);
}

.mobile-nav-link-primary {
    display: block;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    background: linear-gradient(135deg, #FFAC1C 0%, #ff8c00 100%);
    color: #0f0f0f;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(255, 172, 28, 0.3);
}

.mobile-nav-link-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 172, 28, 0.4);
}

/* Dark Mode Icons */
body.dark .dark-icon {
    display: none;
}

body.dark .light-icon {
    display: block;
}

body:not(.dark) .light-icon {
    display: none;
}

body:not(.dark) .dark-icon {
    display: block;
}

/* Page Content Padding (for fixed navbar) */
.page-content {
    padding-top: 5rem;
    min-height: calc(100vh - 5rem);
}

/* Modern Button Styles */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #FFAC1C 0%, #ff8c00 100%);
    color: #0f0f0f;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(255, 172, 28, 0.3);
    text-decoration: none;
    font-family: "Lexend", sans-serif;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 172, 28, 0.4);
}

.btn-primary:active {
    transform: translateY(0) scale(1);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    background: rgba(255, 172, 28, 0.1);
    color: #FFAC1C;
    border: 2px solid rgba(255, 172, 28, 0.3);
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    font-family: "Lexend", sans-serif;
}

.btn-secondary:hover {
    background: rgba(255, 172, 28, 0.2);
    border-color: #FFAC1C;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 172, 28, 0.2);
}

/* Card Styles */
.glass-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

body.dark .glass-card {
    background: rgba(15, 15, 15, 0.8);
    border: 1px solid rgba(255, 172, 28, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}

body.dark .glass-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Form Readability Enhancements (Light Mode) */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    background-color: #fefefe;
    border: 1px solid #d1d5db;
    /* gray-300 */
    color: #111827;
    /* gray-900 */
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

/* Select dropdown options (light mode) */
select option {
    background-color: #ffffff;
    color: #111827;
    padding: 8px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #FFAC1C;
    box-shadow: 0 0 0 3px rgba(255, 172, 28, 0.25);
    background-color: #ffffff;
}

/* Dark Mode Form Inputs */
body.dark input[type="text"],
body.dark input[type="email"],
body.dark input[type="password"],
body.dark input[type="number"],
body.dark select,
body.dark textarea {
    background-color: #1f2937 !important;
    /* gray-800 */
    border: 1px solid #374151 !important;
    /* gray-700 */
    color: #f3f4f6 !important;
    /* gray-100 */
    color-scheme: dark;
}

/* Dark mode select dropdown options - high contrast for visibility */
body.dark select option {
    background-color: #1f2937 !important;
    /* gray-800 */
    color: #f9fafb !important;
    /* gray-50 - very light for maximum readability */
    padding: 8px;
}

/* Additional specificity for dropdown in dark mode */
body.dark select,
body.dark select:not(:focus) {
    background-color: #1f2937 !important;
    color: #f3f4f6 !important;
    color-scheme: dark;
}

/* Dark mode focus states */
body.dark input:focus,
body.dark select:focus,
body.dark textarea:focus {
    background-color: #111827 !important;
    /* gray-900 */
    border-color: #FFAC1C !important;
    box-shadow: 0 0 0 3px rgba(255, 172, 28, 0.35) !important;
    color-scheme: dark;
}

::placeholder {
    color: #94a3b8;
    /* gray-400/500 blend for clarity */
    opacity: 1;
}

body.dark ::placeholder {
    color: #9ca3af;
    /* gray-400 - lighter for better visibility */
}

body.dark .text-gradient {
    background: linear-gradient(135deg, #ffffff 0%, #FFAC1C 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-primary {
    color: #1f2937;
}

body.dark .text-primary {
    color: #ffffff;
}

.text-secondary {
    color: #6b7280;
}

body.dark .text-secondary {
    color: #9ca3af;
}

.bg-gradient {
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
}

body.dark .bg-gradient {
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection Color */
::selection {
    background: rgba(255, 172, 28, 0.3);
    color: #0f0f0f;
}

/* Form Section Styles */
.form-section {
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(0, 0, 0, 0.05);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

body.dark .form-section {
    background: rgba(31, 41, 55, 0.4);
    border: 2px solid rgba(255, 172, 28, 0.15);
}

.form-section:hover {
    border-color: rgba(255, 172, 28, 0.3);
}

body.dark .form-section:hover {
    border-color: rgba(255, 172, 28, 0.4);
}

/* Waypoint Item Styles */
.waypoint-item {
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid rgba(249, 115, 22, 0.2);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

body.dark .waypoint-item {
    background: rgba(31, 41, 55, 0.6);
    border: 2px solid rgba(249, 115, 22, 0.3);
}

.waypoint-item:hover {
    border-color: rgba(249, 115, 22, 0.4);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.15);
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    margin-top: 0.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 50;
}

body.dark .search-results {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.search-result-item {
    padding: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #e5e7eb;
}

body.dark .search-result-item {
    border-bottom-color: #374151;
}

.search-result-item:hover {
    background: rgba(249, 115, 22, 0.1);
}

body.dark .search-result-item:hover {
    background: rgba(249, 115, 22, 0.2);
}

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

/* Button Utilities */
.btn-remove {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-remove:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-add {
    /* Use primary orange instead of green to reduce overall color variety */
    background: linear-gradient(135deg, #FFAC1C 0%, #ff8c00 100%);
    color: #0f0f0f;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-add:hover {
    background: linear-gradient(135deg, #ff8c00 0%, #FFAC1C 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 172, 28, 0.3);
}

/* Custom Scrollbar for waypoint lists and dropdowns */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #ffac1c, #ff8c00);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #ff8c00, #ffac1c);
}

body.dark .custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

/* Responsive utilities */
@media (max-width: 768px) {
    .page-content {
        padding-top: 4rem;
    }
}

/* Maintenance Banner Styles */
.maintenance-banner {
    position: fixed;
    top: 4rem; /* Position below navbar (navbar is h-16 = 4rem) */
    left: 0;
    right: 0;
    z-index: 40; /* Below navbar (z-50) but above content */
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.maintenance-banner-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 1200px;
    width: 100%;
    font-weight: 600;
    font-size: 0.95rem;
}

.maintenance-banner i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Banner Type Colors */
.maintenance-banner-warning {
    /* Warnings use a clear red palette for accessibility */
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #ffffff;
    border-bottom: 2px solid #7f1d1d;
}

.maintenance-banner-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    border-bottom: 2px solid #b91c1c;
}

.maintenance-banner-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border-bottom: 2px solid #1d4ed8;
}

.maintenance-banner-maintenance {
    background: linear-gradient(135deg, #FFAC1C 0%, #ff8c00 100%);
    color: #0f0f0f;
    border-bottom: 2px solid #e69b10;
}

/* Adjust spacing when banner is visible */
/* The h-16 div after navbar provides 4rem spacing. When banner is present, increase it to account for banner */
body:has(.maintenance-banner) header + div.h-16 {
    height: 7rem;
}

/* Remove the margin-top from main-content since the spacer div handles it */
body:has(.maintenance-banner) .main-content {
    margin-top: 0;
}