/* ═══════════════════════════════════════════════
   MYSTIC TRAVEL — Global Stylesheet
   ═══════════════════════════════════════════════ */

/* ── Variables ── */
:root {
    --navy:    #12385C;
    --navy-d:  #0d2b47;
    --pink:    #E61C83;
    --bg:      #F0F4F8;
    --border:  #D8E3EE;
    --radius:  12px;
    --shadow:  0 2px 16px rgba(18,56,92,.10);
    --nav-h:   54px;
    --side-w:  260px;
    --side-c:  56px;  /* collapsed width */
    --fs-base: .875rem;
    --fs-sm:   .8rem;
    --fs-xs:   .75rem;
    --nav-user-img: 40px;
}

/* ── Reset / Base ── */
html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 15px; } }

html, body { height: 100%; margin: 0; }
body { margin: 0; padding: 0; font-size: var(--fs-base); }

/* ── Focus rings ── */
.btn:focus, .btn:active:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* ═══════════════════════════════════════════════
   NAVBAR
   ═══════════════════════════════════════════════ */
header nav.navbar-sys {
    height: var(--nav-h);
    min-height: var(--nav-h);
}

/* Sidebar toggle button */
.btn-sidebar-toggle {
    background: none; border: none; cursor: pointer;
    padding: 6px 10px; border-radius: 8px;
    color: var(--navy); font-size: 1.35rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s;
    flex-shrink: 0;
}
.btn-sidebar-toggle:hover { background: rgba(18,56,92,.08); }

/* ── Navbar user area ── */
.navbar-user-btn {
    display: flex; align-items: center;
    background: transparent; border: none; cursor: pointer;
    padding: 4px 6px; border-radius: 10px;
    transition: background .2s;
    gap: 10px;
}
.navbar-user-btn:hover { background: rgba(18,56,92,.06); }
.navbar-user-img {
    height: var(--nav-user-img);
    width: var(--nav-user-img);
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(18,56,92,.15);
    flex-shrink: 0;
    transition: border-color .2s;
}
.navbar-user-btn:hover .navbar-user-img { border-color: rgba(18,56,92,.35); }
.navbar-user-info { line-height: 1.15; text-align: left; }
.navbar-user-name { display: block; font-weight: 700; color: var(--navy); font-size: .85rem; white-space: nowrap; }
.navbar-user-role { display: block; font-size: .75rem; color: #e8328f; white-space: nowrap; }

/* Sidebar backdrop (mobile overlay) */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1049;
    transition: opacity .28s ease;
}
.sidebar-backdrop.show { display: block; }

/* ═══════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════ */
.opcionesbar {
    width: var(--side-w);
    height: calc(100vh - var(--nav-h));
    top: var(--nav-h);
    overflow: hidden;
    overflow-y: auto;
    transition: width 0.25s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(18,56,92,.2) transparent;
    background: #fff;
    border-right: 1px solid var(--border);
    z-index: 200;
}
.opcionesbar.collapsed { width: var(--side-c); }
.opcionesbar::-webkit-scrollbar { width: 4px; }
.opcionesbar::-webkit-scrollbar-thumb { background: rgba(18,56,92,.2); border-radius: 4px; }

.opcionesbar-item {
    text-decoration: none; white-space: nowrap;
    overflow: hidden; padding: 10px 12px; border-radius: 10px;
    display: flex; align-items: center; gap: 12px;
    transition: background .2s;
}
.opcionesbar-item:hover {
    background: linear-gradient(90deg, rgba(18,56,92,.08), rgba(18,56,92,.18));
}
.opcionesspan { color: var(--navy); font-size: var(--fs-base); font-weight: 600; }

/* ═══════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════ */
.main-content {
    margin-left: var(--side-w);
    height: calc(100vh - var(--nav-h));
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease;
}
.main-content.expanded { margin-left: var(--side-c); }

/* ═══════════════════════════════════════════════
   MOBILE — sidebar as full overlay (slide-in drawer)
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Sidebar becomes a slide-in drawer */
    .opcionesbar {
        width: 270px !important;        /* fixed drawer width regardless of collapsed */
        transform: translateX(-100%);   /* hidden off-screen by default */
        z-index: 1050;
        box-shadow: 4px 0 28px rgba(18,56,92,.22);
        transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    }
    .opcionesbar.mobile-open {
        transform: translateX(0);
    }
    /* Desktop collapsed class has no visual effect on mobile */
    .opcionesbar.collapsed {
        width: 270px !important;
        transform: translateX(-100%);
    }
    .opcionesbar.collapsed.mobile-open {
        transform: translateX(0);
    }

    /* Main content always full-width on mobile */
    .main-content,
    .main-content.expanded {
        margin-left: 0 !important;
    }

    /* Hide user name/role text on mobile – show icon only */
    .navbar-user-info { display: none; }

    /* Slightly smaller avatar on mobile */
    :root { --nav-user-img: 36px; }

    /* Compact page topbar on mobile */
    .page-topbar { padding: 10px 0 8px; gap: 8px; }
    .page-title { font-size: 1.15rem; }

    /* Sidebar items slightly larger tap targets */
    .opcionesbar-item { padding: 12px 14px; }
}

/* ═══════════════════════════════════════════════
   PAGE LAYOUT (full-height table pages)
   ═══════════════════════════════════════════════ */
.page-fill {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    padding: 0 20px 12px;
}
@media (min-width: 992px) { .page-fill { padding: 0 32px 16px; } }

.page-topbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 0 10px;
}
.page-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--navy);
    margin: 0;
    white-space: nowrap;
}

/* Search input */
.pg-search {
    position: relative;
    flex: 1;
    min-width: 160px;
    max-width: 280px;
}
.pg-search input {
    width: 100%;
    height: 36px;
    padding: 0 12px 0 34px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-size: var(--fs-sm);
    color: var(--navy);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.pg-search input:focus {
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(18,56,92,.1);
}
.pg-search .search-icon {
    position: absolute; left: 10px; top: 50%;
    transform: translateY(-50%); color: #9ab; pointer-events: none;
}

/* ═══════════════════════════════════════════════
   TABLE WRAPPER — scrollable, full height
   ═══════════════════════════════════════════════ */
.tbl-wrap {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.tbl-wrap::-webkit-scrollbar { width: 6px; }
.tbl-wrap::-webkit-scrollbar-track { background: transparent; }
.tbl-wrap::-webkit-scrollbar-thumb { background: rgba(18,56,92,.2); border-radius: 6px; }

.tbl-wrap table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
    font-size: var(--fs-base);
}
.tbl-wrap table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 12px 14px;
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    background: var(--navy) !important;
    color: #fff !important;
    border: none;
}
.tbl-wrap table tbody td {
    padding: 10px 14px;
    font-size: var(--fs-base);
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}
.tbl-wrap table tbody tr:last-child td { border-bottom: none; }
.tbl-wrap table tbody tr { background: #fff; transition: background .12s; }
.tbl-wrap table tbody tr:nth-child(even) { background: #F8FAFD; }
.tbl-wrap table tbody tr:hover { background: #EEF5FF !important; }
.tbl-wrap table tbody tr.row-link { cursor: pointer; }

/* Cell helpers */
.cell-primary { font-weight: 700; color: var(--navy); font-size: var(--fs-base); }
.cell-sub     { font-size: var(--fs-xs); color: var(--pink); margin-top: 1px; }
.cell-muted   { font-size: var(--fs-sm); color: #6b7a8d; }

/* Empty / no-results message inside tbl-wrap */
.tbl-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    color: #9ab;
}
.tbl-empty svg { opacity: .35; margin-bottom: 12px; }
.tbl-empty p { font-weight: 600; font-size: .95rem; margin: 0; }

/* ═══════════════════════════════════════════════
   ACTION BUTTONS (table rows)
   ═══════════════════════════════════════════════ */
.btn-acts { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }

.btn-act {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 11px; border-radius: 8px; border: none;
    font-size: var(--fs-xs); font-weight: 700; cursor: pointer;
    text-decoration: none; white-space: nowrap;
    transition: opacity .18s, transform .12s;
    line-height: 1;
}
.btn-act:hover { opacity: .85; transform: translateY(-1px); }
.btn-act:active { transform: translateY(0); }
.btn-act img { height: 14px; flex-shrink: 0; }

.btn-act-navy    { background: var(--navy); color: #fff; }
.btn-act-navy:hover { color: #fff; }
.btn-act-danger  { background: #dc3545; color: #fff; }
.btn-act-danger:hover { color: #fff; }
.btn-act-success { background: #198754; color: #fff; }
.btn-act-success:hover { color: #fff; }
.btn-act-info    { background: #0d9488; color: #fff; }
.btn-act-info:hover { color: #fff; }

/* Labels hidden on small screens */
.btn-act .btn-lbl { display: none; }
@media (min-width: 992px) { .btn-act .btn-lbl { display: inline; } }

/* ═══════════════════════════════════════════════
   NEW / PRIMARY TOP BUTTONS
   ═══════════════════════════════════════════════ */
.btn-new-item {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 16px; border-radius: 9px; border: none;
    background: var(--navy); color: #fff;
    font-size: var(--fs-sm); font-weight: 700;
    text-decoration: none; white-space: nowrap;
    cursor: pointer; transition: background .2s, transform .12s;
}
.btn-new-item:hover { background: #1a4a78; color: #fff; transform: translateY(-1px); }
.btn-new-item img { height: 18px; }
.btn-new-item span { display: none; }
@media (min-width: 576px) { .btn-new-item span { display: inline; } }

/* ═══════════════════════════════════════════════
   MODALS — consistent style
   ═══════════════════════════════════════════════ */
.modal-title { font-size: 1rem; font-weight: 700; color: var(--navy); }

/* ═══════════════════════════════════════════════
   BADGES / STATUS
   ═══════════════════════════════════════════════ */
.status-badge {
    display: inline-flex; align-items: center;
    padding: 3px 9px; border-radius: 20px;
    font-size: var(--fs-xs); font-weight: 700;
}

/* ═══════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════ */
.rsl { background: linear-gradient(to bottom, #51C9DE, #4057B4); }

/* ═══════════════════════════════════════════════
   LEGACY — kept for non-table pages compatibility
   ═══════════════════════════════════════════════ */
.res-hed { font-size: var(--fs-base); }

/* ═══════════════════════════════════════════════
   CARD CLICKABLE (Contratos/Details — Gerente y Vendedor)
   ═══════════════════════════════════════════════ */
.card-clickable {
    cursor: pointer;
    transition: box-shadow .18s, transform .18s;
}
.card-clickable:hover {
    box-shadow: 0 6px 22px rgba(18,56,92,.18);
    transform: translateY(-2px);
}
