/* =================== TRAVELNOW - GLOBAL STYLES =================== */

:root {
    /* ── Brand ── */
    --primary:        #d4af37;
    --primary-dark:   #b8941f;
    --primary-fg:     #0a1d2e;   /* text on gold bg */
    --secondary:      #0f4c75;
    --accent:         #1a5f7a;
    --dark:           #0a1d2e;
    --darker:         #050f17;
    --light:          #f8f9fa;

    /* ── Semantic tokens — Light Mode ── */
    --background:           #f8f9fa;
    --foreground:           #1a1a2e;
    --card:                 #ffffff;
    --card-foreground:      #1a1a2e;
    --muted:                #f1f3f5;
    --muted-foreground:     #5a6c7d;
    --border:               #e0e0e0;
    --input:                #ffffff;
    --input-border:         #d0d7de;
    --placeholder:          #6b7280;   /* Better contrast on white */
    --ring:                 rgba(212,175,55,0.35);

    /* ── Status ── */
    --success:          #28a745;
    --success-fg:       #ffffff;
    --warning:          #ffc107;
    --warning-fg:       #1a1a2e;
    --destructive:      #dc3545;
    --destructive-fg:   #ffffff;
    --info:             #0dcaf0;
    --info-fg:          #0a1d2e;

    /* ── Legacy aliases (keep backward-compat) ── */
    --bg-body:      var(--background);
    --text:         var(--foreground);
    --text-muted:   var(--muted-foreground);
    --card-bg:      var(--card);
    --card-border:  rgba(212,175,55,0.12);
    --input-bg:     var(--input);
    --navbar-bg:    rgba(10,29,46,0.98);
    --sidebar-bg:   linear-gradient(180deg, #0a1d2e 0%, #1a3a5c 100%);
    --topbar-bg:    #ffffff;
    --glass-bg:     rgba(255,255,255,0.8);

    --gradient-gold: linear-gradient(135deg, #d4af37 0%, #f4e5a3 50%, #d4af37 100%);
    --shadow-gold:  0 10px 30px rgba(212,175,55,0.2);
    --shadow-soft:  0 10px 40px rgba(0,0,0,0.05);
}

/* ── Dark Mode tokens ── */
body.dark-mode {
    --background:           #050f17;
    --foreground:           #e8eaed;
    --card:                 #0f233a;
    --card-foreground:      #e8eaed;
    --muted:                #0a1d2e;
    --muted-foreground:     #9aa0a6;
    --border:               rgba(212,175,55,0.15);
    --input:                rgba(255,255,255,0.08);
    --input-border:         rgba(212,175,55,0.25);
    --placeholder:          rgba(229,231,235,0.7);
    --ring:                 rgba(212,175,55,0.25);

    /* Legacy aliases */
    --bg-body:      var(--background);
    --text:         var(--foreground);
    --text-muted:   var(--muted-foreground);
    --card-bg:      var(--card);
    --card-border:  rgba(212,175,55,0.2);
    --input-bg:     var(--input);
    --topbar-bg:    #0a1d2e;
    --glass-bg:     rgba(10,29,46,0.6);
    --shadow-soft:  0 15px 50px rgba(0,0,0,0.4);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text);
    background: var(--bg-body);
    /* clip, not hidden: hidden forces overflow-y to auto and adds a second page scrollbar */
    overflow-x: clip;
    transition: background 0.3s ease, color 0.3s ease;
    line-height: 1.6;
}

img, video, iframe {
    max-width: 100%;
}

table {
    max-width: 100%;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Cinzel', serif;
    font-weight: 700;
}

/* =================== SHARED COMPONENTS =================== */

.btn-gold {
    background: var(--gradient-gold);
    color: var(--dark) !important;
    border: none;
    padding: 12px 32px;
    font-weight: 700;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-gold);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-gold:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 45px rgba(212, 175, 55, 0.4);
}

.btn-outline-gold {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 10px 28px;
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.3s;
}

.btn-outline-gold:hover {
    background: var(--primary);
    color: var(--dark) !important;
}

/* =================== CARDS =================== */
.dashboard-card, .attraction-card, .offer-card, .category-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border) !important;
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
}

.dashboard-card:hover, .attraction-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
}

/* =================== FORMS =================== */
.form-control, .form-select {
    background: var(--input-bg) !important;
    border: 1px solid var(--input-border) !important;
    color: var(--text) !important;
    border-radius: 12px;
    padding: 12px 18px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1) !important;
}

.form-control::placeholder {
    color: var(--placeholder) !important;
    opacity: 0.85 !important;
}

/* Light mode placeholder improvements */
body:not(.dark-mode) .form-control::placeholder,
body:not(.dark-mode) .form-select::placeholder,
body:not(.dark-mode) textarea::placeholder,
body:not(.dark-mode) input::placeholder {
    color: var(--placeholder) !important;
    opacity: 0.85 !important;
}

/* Dark mode placeholder improvements */
body.dark-mode .form-control::placeholder,
body.dark-mode .form-select::placeholder,
body.dark-mode textarea::placeholder,
body.dark-mode input::placeholder {
    color: var(--placeholder) !important;
    opacity: 0.85 !important;
}

/* =================== UTILITIES =================== */
.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin: 60px 0 20px;
    color: var(--text);
    position: relative;
    padding-bottom: 20px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 80px; height: 3px;
    background: var(--gradient-gold);
}

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

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* =================== CUSTOM SELECT DROPDOWN =================== */
/* Replaces native <select> with a styled custom dropdown */

.tn-select-wrapper {
    position: relative;
    z-index: 20;
    display: block;
    width: 100%;
}

/* Hide the original select but keep it functional for form submission */
.tn-select-wrapper select.tn-select-hidden {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

/* The visible trigger button */
.tn-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 18px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    color: var(--text);
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 400;
    cursor: pointer;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    user-select: none;
    box-sizing: border-box;
}

.tn-select-trigger:hover {
    border-color: var(--primary);
}

.tn-select-trigger.open {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.12);
}

/* Arrow icon */
.tn-select-arrow {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-left: 10px;
    color: var(--primary);
    transition: transform 0.25s ease;
}

.tn-select-trigger.open .tn-select-arrow {
    transform: rotate(180deg);
}

/* Dropdown panel */
.tn-select-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 99999;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    padding: 6px 0;
}

.tn-select-dropdown.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Individual option */
.tn-select-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    border-radius: 0;
}

.tn-select-option:hover {
    background: rgba(212, 175, 55, 0.12);
    color: var(--primary);
}

.tn-select-option.selected {
    background: rgba(212, 175, 55, 0.18);
    color: var(--primary);
    font-weight: 600;
}

/* Dot indicator for selected */
.tn-select-option.selected::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

/* Dark mode extra polish */
body.dark-mode .tn-select-trigger {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(212, 175, 55, 0.2);
    color: #f1f3f5;
}

body.dark-mode .tn-select-trigger:hover,
body.dark-mode .tn-select-trigger.open {
    background: rgba(212, 175, 55, 0.08);
    border-color: var(--primary);
}

body.dark-mode .tn-select-dropdown {
    background: #0f233a;
    border-color: rgba(212, 175, 55, 0.25);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

body.dark-mode .tn-select-option {
    color: #e0e6ed;
}

body.dark-mode .tn-select-option:hover {
    background: rgba(212, 175, 55, 0.15);
    color: var(--primary);
}

body.dark-mode .tn-select-option.selected {
    background: rgba(212, 175, 55, 0.2);
    color: var(--primary);
}

/* Light mode extra polish */
body:not(.dark-mode) .tn-select-trigger {
    background: #ffffff;
    border-color: #e0e0e0;
    color: #2c3e50;
}

body:not(.dark-mode) .tn-select-dropdown {
    background: #ffffff;
    border-color: rgba(212, 175, 55, 0.2);
    box-shadow: 0 12px 40px rgba(10, 29, 46, 0.12);
}

body:not(.dark-mode) .tn-select-option {
    color: #2c3e50;
}

body:not(.dark-mode) .tn-select-option:hover {
    background: rgba(212, 175, 55, 0.08);
    color: #b8941f;
}

body:not(.dark-mode) .tn-select-option.selected {
    background: rgba(212, 175, 55, 0.12);
    color: #b8941f;
}

/* =================== RESPONSIVE BASE =================== */
@media (max-width: 767px) {
    .container,
    .container-fluid {
        padding-left: 14px;
        padding-right: 14px;
    }

    .section-title {
        font-size: 1.75rem;
        margin: 38px 0 16px;
        padding-bottom: 14px;
    }

    .btn-gold,
    .btn-outline-gold {
        max-width: 100%;
        padding: 10px 18px;
        font-size: 0.78rem;
        letter-spacing: 0.5px;
    }

    .form-control,
    .form-select,
    .tn-select-trigger {
        min-height: 44px;
        padding: 10px 13px;
        font-size: 0.88rem;
    }

    .modal-dialog {
        margin: 0.75rem;
    }

    .table-responsive {
        border-radius: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .section-title { font-size: 1.45rem; }
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.45rem; }
    h3 { font-size: 1.2rem; }
}

/* ═══════════════════════════════════════════════════════════════
   DEVICE FIT — phone / tablet / small-phone safety net
   Layered last so it settles conflicts the per-component rules leave.
   ═══════════════════════════════════════════════════════════════ */

/* Nothing may push the document sideways; inner scrollers handle width. */
html {
    overflow-x: clip;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Long unbreakable strings (URLs, Arabic+latin mixes) must not widen a card. */
p, li, h1, h2, h3, h4, td, th, .btn {
    overflow-wrap: anywhere;
}

/* Media always fits its container. */
img, video, iframe, embed, object, canvas {
    max-width: 100%;
}

/* Bootstrap's fixed 600px map embed and any other bare iframe. */
iframe {
    width: 100%;
    max-width: 100%;
    border: 0;
}

/* Tables scroll inside their own box instead of stretching the page. */
table {
    max-width: 100%;
}

@media (max-width: 991px) {
    /* Full-bleed sections lose desktop gutters that no longer fit. */
    .container, .container-lg, .container-md {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Fixed-size desktop grids collapse to two tracks, then one below. */
    .row {
        margin-left: -8px;
        margin-right: -8px;
    }

    /* Modals should never touch the screen edges on a tablet. These pages set
      max-width inline on .modal-dialog, so !important is what wins here. */
    .modal-dialog {
        max-width: calc(100vw - 32px) !important;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 767px) {
    /* Inputs and selects inside flex rows must be allowed to shrink. */
    input, select, textarea {
        max-width: 100%;
        min-width: 0;
    }

    /* iOS Safari zooms the whole page when a focused field is under 16px.
       !important is needed because these pages set small inline font sizes. */
    input[type="text"], input[type="search"], input[type="email"],
    input[type="password"], input[type="number"], input[type="tel"],
    input[type="date"], input[type="time"], input[type="url"],
    select, textarea {
        font-size: 16px !important;
    }

    /* Two tracks still fit a large phone; one track is the only honest
       layout once the viewport is narrower than that. */
    [style*="grid-template-columns"] {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    /* Keep the exception: icon+label micro-grids stay as authored. */
    [style*="grid-template-columns"][class*="keep-cols"],
    .keep-cols {
        grid-template-columns: revert !important;
    }

    .modal-xl, .modal-lg {
        max-width: calc(100vw - 20px);
    }

    /* Decorative fixed-width glows/orbs otherwise extend the scroll area. */
    .orb, .bg-orb, [class*="glow"] {
        max-width: 100vw;
    }
}

@media (max-width: 560px) {
    [style*="grid-template-columns"]:not(.keep-cols) {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 380px) {
    /* iPhone SE / Galaxy S8 class devices. */
    :root { --navbar-height: 58px; }

    body { font-size: 0.94rem; }

    .btn-gold, .btn { padding: 10px 14px; }

    .modal-content { border-radius: 14px; }
}
