/**
 * Trail Vertex - Custom Styles
 * 
 * Custom CSS overrides and enhancements for Bootstrap 5
 */

/* Enhanced Font System - Professional Trekking Style */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:wght@400;500;600;700;800&family=Source+Sans+Pro:wght@300;400;600;700&display=swap');

:root {
    /* Primary Colors */
    --color-primary: #0F3C5B;        /* Mountain Blue */
    --color-secondary: #F8F9FA;      /* Earthy Gray */
    --color-accent: #D97925;         /* CTA Orange */
    
    /* Additional Colors */
    --color-success: #28a745;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
    --color-info: #17a2b8;
    
    /* Text Colors */
    --color-text-dark: #212529;
    --color-text-muted: #6c757d;
    --color-text-light: #f8f9fa;
    --color-light-gray: #adb5bd;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Typography - Professional Trekking Style */
    --font-family-base: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-family-display: 'Playfair Display', Georgia, serif;
    --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Font Sizes - Professional Scale */
    --text-xs: 0.75rem;     /* 12px */
    --text-sm: 0.875rem;    /* 14px */
    --text-base: 1rem;      /* 16px */
    --text-lg: 1.125rem;    /* 18px */
    --text-xl: 1.25rem;     /* 20px */
    --text-2xl: 1.5rem;     /* 24px */
    --text-3xl: 1.875rem;   /* 30px */
    --text-4xl: 2.25rem;    /* 36px */
    --text-5xl: 3rem;       /* 48px */
    
    /* Line Heights - Optimized for readability */
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.6;
    --leading-loose: 1.8;
}

/* ============================================
   2. Global Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    margin: 0 !important;
    padding: 0 !important;
}

body {
    font-family: var(--font-family-base);
    color: var(--color-text-dark);
    line-height: var(--leading-relaxed);
    margin: 0 !important;
    padding: 0 !important;
    font-size: var(--text-base);
    font-weight: 400;
}

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

/* Text Utilities */
.text-light-gray {
    color: var(--color-light-gray) !important;
}

.text-accent {
    color: var(--color-accent) !important;
}

/* ============================================
   3. Bootstrap Overrides
   ============================================ */

/* Primary Color Override */
.bg-primary {
    background-color: var(--color-primary) !important;
}

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

.btn-primary:hover,
.btn-primary:focus {
    background-color: #0a2d45;
    border-color: #0a2d45;
}

.text-primary {
    color: var(--color-primary) !important;
}

.border-primary {
    border-color: var(--color-primary) !important;
}

/* Accent Color (CTA Buttons) */
.bg-accent {
    background-color: var(--color-accent) !important;
}

.btn-accent {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: white;
    font-weight: 600;
}

.btn-accent:hover,
.btn-accent:focus {
    background-color: #c26a1f;
    border-color: #c26a1f;
    color: white;
}

.border-accent {
    border-color: var(--color-accent) !important;
}

/* Navbar Styling */
.navbar-dark .navbar-brand {
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

.navbar-dark .navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: var(--color-accent) !important;
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.dropdown-menu {
    animation: fadeInDown 0.3s ease-in-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   4. Hero Section
   ============================================ */
.hero-section {
    background: linear-gradient(135deg, var(--color-primary) 0%, #1a5a7f 100%);
    min-height: 75vh;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../images/hero-pattern.svg');
    background-size: cover;
    opacity: 0.1;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 60, 91, 0.3);
}

.min-vh-75 {
    min-height: 75vh;
}

/* ============================================
   5. Card Styles
   ============================================ */

/* Trek Cards */
.trek-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    overflow: hidden;
}

.trek-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
}

.trek-card .card-img-top {
    transition: transform 0.3s ease;
}

.trek-card:hover .card-img-top {
    transform: scale(1.05);
}

/* Gear Cards */
.gear-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
}

.gear-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
}

/* Region Cards */
.region-card {
    transition: all 0.3s ease;
    border: none;
}

.region-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
}

.hover-lift {
    transition: transform 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
}

/* ============================================
   6. Difficulty Badges
   ============================================ */
.badge {
    font-weight: 600;
    padding: 0.5em 0.75em;
}

/* Custom badge colors already handled by Bootstrap classes */

/* ============================================
   7. Content Sections
   ============================================ */
/* Content Typography - Professional Trekking Style */
.content-text {
    font-family: var(--font-family-base);
    font-size: var(--text-lg);
    line-height: var(--leading-relaxed);
    color: #374151;
}

.content-text h1,
.content-text h2,
.content-text h3,
.content-text h4,
.content-text h5,
.content-text h6 {
    font-family: var(--font-family-display);
    font-weight: 600;
    line-height: var(--leading-tight);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.content-text h1 { 
    font-size: var(--text-4xl); 
    font-weight: 700;
    letter-spacing: -0.02em;
}
.content-text h2 { font-size: var(--text-3xl); }
.content-text h3 { font-size: var(--text-2xl); }
.content-text h4 { font-size: var(--text-xl); }
.content-text h5 { font-size: var(--text-lg); }
.content-text h6 { font-size: var(--text-base); }

.content-text p {
    margin-bottom: 1.25rem;
    color: #4a5568;
}

.content-text ul,
.content-text ol {
    margin-bottom: 1.25rem;
    padding-left: 1.75rem;
    color: #4a5568;
}

.content-text li {
    margin-bottom: 0.75rem;
}

.content-text blockquote {
    font-family: var(--font-family-display);
    font-size: var(--text-xl);
    line-height: var(--leading-relaxed);
    color: #2d3748;
    font-style: italic;
    border-left: 4px solid var(--color-accent);
    padding: 1.5rem;
    margin: 2rem 0;
    background: #f8fafc;
    border-radius: 0 8px 8px 0;
}

.content-text strong {
    font-weight: 600;
    color: #1a202c;
}

.content-text em {
    font-style: italic;
    color: #4a5568;
}

.content-text a {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.content-text a:hover {
    color: #b8621f;
    text-decoration: underline;
}

/* ============================================
   8. Icon Boxes
   ============================================ */
.icon-box {
    width: 80px;
    height: 80px;
    transition: transform 0.3s ease;
}

.icon-box:hover {
    transform: scale(1.1);
}

/* ============================================
   9. Footer Styles
   ============================================ */
footer {
    background-color: #1a1a1a !important;
}

footer a {
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--color-accent) !important;
}

/* ============================================
   10. Forms
   ============================================ */
.form-control:focus,
.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(15, 60, 91, 0.25);
}

/* ============================================
   11. Pagination
   ============================================ */
.pagination .page-link {
    color: var(--color-primary);
}

.pagination .page-item.active .page-link {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.pagination .page-link:hover {
    color: var(--color-accent);
}

/* ============================================
   12. Breadcrumb
   ============================================ */
.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
}

.breadcrumb-item a {
    color: var(--color-primary);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--color-accent);
}

/* ============================================
   13. Accordion
   ============================================ */
.accordion-button:not(.collapsed) {
    background-color: var(--color-primary);
    color: white;
}

.accordion-button:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(15, 60, 91, 0.25);
}

/* ============================================
   14. Sticky Elements
   ============================================ */
.sticky-top {
    position: sticky;
    top: 20px;
    z-index: 1020;
}

/* ============================================
   15. Mobile-First Responsive Design & Performance
   ============================================ */

/* Performance optimizations */
img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
}

/* Lazy loading placeholder */
.lazy-load {
    background: #f8f9fa;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
}

.lazy-load::before {
    content: "Loading...";
    font-size: 0.9rem;
}

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
    .btn:hover, .nav-link:hover {
        transform: none;
    }
    
    .card:hover {
        transform: none;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
}

/* Large tablets and below */
@media (max-width: 992px) {
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    /* Improve navigation on tablet */
    .navbar-nav {
        text-align: center;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
    }
}

/* Tablets and below */
@media (max-width: 768px) {
    /* Hero section optimization */
    .hero-section {
        min-height: 60vh;
        padding: 2rem 0;
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    /* Mobile navigation improvements */
    .navbar-brand img {
        height: 40px !important;
    }
    
    .navbar-toggler {
        border: none;
        padding: 0.25rem 0.5rem;
    }
    
    .navbar-toggler:focus {
        box-shadow: none;
    }
    
    .navbar-collapse {
        background: rgba(15, 60, 91, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-radius: 0.5rem;
        margin-top: 1rem;
        padding: 1rem;
    }
    
    .navbar-nav .nav-link {
        font-size: 1rem !important;
        padding: 0.75rem 1rem;
        border-radius: 0.25rem;
        transition: background-color 0.3s ease;
    }
    
    .navbar-nav .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    /* Cards on mobile */
    .card {
        margin-bottom: 1rem;
        border-radius: 0.75rem;
        overflow: hidden;
    }
    
    .card-img-top {
        height: 200px;
        object-fit: cover;
    }
    
    /* Footer on mobile */
    footer .row > div {
        margin-bottom: 1.5rem;
    }
    
    /* Search suggestions on mobile */
    #searchSuggestions {
        max-height: 300px !important;
        overflow-y: auto;
    }
    
    /* Forms on mobile */
    .form-control, .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px; /* Touch target size */
    }
    
    /* Buttons on mobile */
    .btn {
        min-height: 44px; /* Touch target size */
        min-width: 44px;
        font-weight: 500;
    }
    
    /* Better spacing on mobile */
    section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    /* Text optimization */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    /* Grid adjustments */
    .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .row > * {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* Mobile phones */
@media (max-width: 576px) {
    /* Typography adjustments */
    .display-3 {
        font-size: 1.75rem;
    }
    
    .display-4 {
        font-size: 1.5rem;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }
    
    /* Hero section on small phones */
    .hero-title {
        font-size: 1.5rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }
    
    /* Buttons on small phones */
    .btn-lg {
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
    }
    
    /* Cards on small phones */
    .card-body {
        padding: 1rem;
    }
    
    /* Spacing adjustments */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Navigation improvements */
    .navbar-brand {
        font-size: 1rem;
    }
    
    .navbar-brand img {
        height: 35px !important;
    }
    
    /* Form improvements */
    .form-control, .form-select {
        font-size: 16px;
        padding: 0.75rem;
    }
    
    /* Image galleries */
    .gallery-item {
        margin-bottom: 1rem;
    }
    
    /* Price displays */
    .price-tag {
        font-size: 1.25rem;
    }
    
    /* Feature cards */
    .feature-card {
        text-align: center;
        padding: 1.5rem 1rem;
    }
    
    /* Testimonials */
    .testimonial-card {
        padding: 1.5rem 1rem;
    }
    
    /* Contact forms */
    .contact-form {
        padding: 1rem;
    }
}

/* Ultra-small phones */
@media (max-width: 480px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .hero-title {
        font-size: 1.25rem;
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 0.75rem 1.25rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    h1 { font-size: 1.25rem; }
    h2 { font-size: 1.1rem; }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        min-height: 80vh;
    }
    
    .navbar {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    .navbar-brand img {
        height: 30px !important;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .navbar-brand img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .lazy-load {
        background: #2d3748;
        color: #e2e8f0;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .hero-section {
        background-attachment: scroll;
    }
}

/* Print styles */
@media print {
    .navbar,
    footer,
    .btn,
    .sidebar,
    .pagination {
        display: none !important;
    }
    
    .container {
        width: 100%;
        max-width: none;
        padding: 0;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
        background: #fff;
    }
    
    a {
        text-decoration: none;
        color: #000;
    }
    
    img {
        max-width: 100%;
        height: auto;
        page-break-inside: avoid;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    p, .card {
        orphans: 3;
        widows: 3;
        page-break-inside: avoid;
    }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   19. Print Styles
   ============================================ */
@media print {
    .navbar,
    footer,
    .btn,
    .breadcrumb {
        display: none !important;
    }
}

/* ============================================
   20. Accessibility
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible for keyboard navigation */
a:focus-visible,
button:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ============================================
   21. Nested Dropdown Support
   ============================================ */
/* Submenu container */
.dropdown-submenu {
    position: relative;
}

/* Position nested dropdown to the right */
.dropdown-submenu > .dropdown-menu {
    position: absolute;
    top: 0;
    left: 100%;
    margin-top: 0;
    margin-left: 0.125rem;
    display: none;
}

/* Show nested dropdown on hover */
.dropdown-submenu:hover > .dropdown-menu {
    display: block;
}

/* Add arrow indicator for items with submenu */
.dropdown-submenu > a::after {
    content: "\f285";
    font-family: "bootstrap-icons";
    float: right;
    margin-left: 0.5rem;
    font-size: 0.75rem;
    opacity: 0.6;
}

/* Hover effect for submenu parent */
.dropdown-submenu > a:hover {
    background-color: rgba(0, 0, 0, 0.05);
}
