/* ============================================================
   Genventory — Application Stylesheet  v1.0.0
   Bootstrap 5.3 companion · Mobile-first
   ============================================================ */

/* ── Custom Properties ──────────────────────────────────────── */
:root {
    --gv-sidebar-w:          240px;
    --gv-sidebar-collapsed:  64px;
    --gv-topnav-h:           58px;
    --gv-primary:            #0d6efd;
    --gv-primary-light:      #e8f0fe;
    --gv-sidebar-bg:         #ffffff;
    --gv-sidebar-border:     #e9ecef;
    --gv-body-bg:            #f3f5f9;
    --gv-topnav-bg:          #ffffff;
    --gv-card-radius:        10px;
    --gv-transition:         0.22s ease;
    --gv-shadow-sm:          0 1px 4px rgba(0,0,0,.06);
    --gv-shadow:             0 2px 12px rgba(0,0,0,.08);
}

/* ── Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #212529;
    background: var(--gv-body-bg);
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ══════════════════════════════════════════════════════════════
   AUTH LAYOUT
══════════════════════════════════════════════════════════════ */

.gv-auth-body {
    min-height: 100vh;
    background: var(--gv-body-bg);
    display: flex;
    align-items: stretch;
}

.gv-auth-wrap {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Left brand panel */
.gv-auth-brand {
    flex: 0 0 42%;
    background: linear-gradient(145deg, #1a6ef5 0%, #0856d6 50%, #03399e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2.5rem;
    position: relative;
    overflow: hidden;
}

.gv-auth-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(255,255,255,.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,.04) 0%, transparent 50%);
}

.gv-auth-brand-inner {
    position: relative;
    z-index: 1;
    max-width: 360px;
    width: 100%;
}

/* Right form panel */
.gv-auth-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    min-height: 100vh;
    overflow-y: auto;
    background: #fff;
}

.gv-auth-card,
.auth-card {
    width: 100%;
    max-width: 420px;
}

@media (max-width: 575.98px) {
    .gv-auth-form  { padding: 1.5rem 1rem; }
    .gv-auth-brand { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════
   ADMIN LAYOUT — Body & Shell
══════════════════════════════════════════════════════════════ */

.gv-admin-body {
    background: var(--gv-body-bg);
    overflow-x: hidden;
}

/* Sidebar is fixed, so main shifts right by sidebar width */
.gv-main {
    margin-left: var(--gv-sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--gv-transition);
}

.gv-content {
    flex: 1;
}

/* Sidebar collapsed (desktop) */
.gv-sidebar-collapsed .gv-main {
    margin-left: var(--gv-sidebar-collapsed);
}

/* Mobile: sidebar is off-screen so no margin needed */
@media (max-width: 991.98px) {
    .gv-main { margin-left: 0 !important; }
}

/* ── Page Header ─────────────────────────────────────────────── */
.gv-page-header {
    padding-bottom: 0.25rem;
}

.gv-page-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1d23;
}

/* ══════════════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════════════ */

/* Mobile backdrop */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.42);
    z-index: 1039;
    backdrop-filter: blur(1px);
}
.sidebar-backdrop.show { display: block; }

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--gv-sidebar-w);
    height: 100vh;
    background: var(--gv-sidebar-bg);
    border-right: 1px solid var(--gv-sidebar-border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform var(--gv-transition), width var(--gv-transition);
    overflow: hidden;
    box-shadow: var(--gv-shadow-sm);
}

/* Mobile: hidden off-screen */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0,0,0,.14);
    }
    .sidebar.sidebar-open {
        transform: translateX(0);
    }
}

/* Collapsed (desktop) */
.gv-sidebar-collapsed .sidebar {
    width: var(--gv-sidebar-collapsed);
}
.gv-sidebar-collapsed .sidebar-brand-text,
.gv-sidebar-collapsed .sidebar-link span,
.gv-sidebar-collapsed .sidebar-section-label,
.gv-sidebar-collapsed .sidebar-user .overflow-hidden {
    opacity: 0;
    pointer-events: none;
    width: 0;
}
.gv-sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 8px 6px;
    margin: 1px 6px;
}
.gv-sidebar-collapsed .sidebar-link i {
    width: auto;
}

/* Brand row */
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.875rem;
    height: var(--gv-topnav-h);
    border-bottom: 1px solid var(--gv-sidebar-border);
    flex-shrink: 0;
    gap: 8px;
}

.sidebar-brand-text {
    font-size: 14.5px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--gv-transition), width var(--gv-transition);
}

.sidebar-close {
    flex-shrink: 0;
    padding: 4px 8px;
    color: #6c757d;
    border: none;
    background: none;
}

/* User mini-profile */
.sidebar-user {
    flex-shrink: 0;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--gv-sidebar-border);
}

/* Section labels */
.sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .09em;
    color: #adb5bd;
    text-transform: uppercase;
    padding: 0 0.875rem;
    margin-top: 0.75rem;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--gv-transition);
}

/* Nav links */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    margin: 1px 8px;
    border-radius: 7px;
    color: #495057;
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    transition: background var(--gv-transition), color var(--gv-transition);
}

.sidebar-link i {
    font-size: 16px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    color: #6c757d;
    transition: color var(--gv-transition);
}
.sidebar-link:hover i,
.sidebar-link.active i {
    color: var(--gv-primary);
}

.sidebar-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--gv-transition), width var(--gv-transition);
}

.sidebar-link:hover {
    background: #f0f4ff;
    color: var(--gv-primary);
}

.sidebar-link.active {
    background: var(--gv-primary-light);
    color: var(--gv-primary);
    font-weight: 600;
}

/* Scrollable nav area */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 1rem;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 2px; }

/* ══════════════════════════════════════════════════════════════
   TOP NAV BAR
══════════════════════════════════════════════════════════════ */

.topnav {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--gv-topnav-h);
    background: var(--gv-topnav-bg);
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    padding: 0 1rem 0 1.25rem;
    gap: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    flex-shrink: 0;
}

/* Search */
.topnav-search-wrap {
    position: relative;
    width: 260px;
}
.topnav-search-icon {
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    color: #adb5bd;
    font-size: 14px;
    pointer-events: none;
    z-index: 5;
    line-height: 1;
}
.topnav-search-input {
    height: 34px;
    padding-left: 32px;
    padding-right: 12px;
    border-radius: 20px;
    background: #f3f5f9;
    border-color: #e9ecef;
    font-size: 13px;
}
.topnav-search-input:focus {
    background: #fff;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.18rem rgba(13,110,253,.12);
    outline: none;
}

/* ══════════════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════════════ */

.admin-footer {
    background: #fff;
    border-top: 1px solid #e9ecef;
    padding: 0.6rem 1.5rem;
    font-size: 12px;
    color: #6c757d;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════════════════ */

.card {
    border-radius: var(--gv-card-radius);
    border: 1px solid #eaecf0;
}

.card.shadow-sm {
    box-shadow: var(--gv-shadow-sm) !important;
}

.card-header {
    background: transparent;
    font-weight: 600;
    font-size: 13.5px;
    border-bottom: 1px solid #eaecf0;
}

/* ══════════════════════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════════════════════ */

.table {
    font-size: 13.5px;
    margin-bottom: 0;
}

.table th {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6c757d;
    white-space: nowrap;
    background: #f8f9fa;
    border-bottom-width: 1px;
    padding: 0.65rem 0.75rem;
}

.table td {
    vertical-align: middle;
    padding: 0.6rem 0.75rem;
}

.table-hover tbody tr:hover > td {
    background-color: #f5f7ff;
}

/* ══════════════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════════════ */

.form-label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #374151;
}

.form-control,
.form-select {
    font-size: 13.5px;
    border-color: #d1d5db;
    border-radius: 7px;
    padding: 0.45rem 0.75rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,.12);
}

.form-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

.input-group-text {
    font-size: 13.5px;
    border-color: #d1d5db;
    background: #f8f9fa;
    color: #6c757d;
}

/* ══════════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════════ */

.btn {
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 7px;
    padding: 0.42rem 1rem;
    transition: all var(--gv-transition);
}

.btn-sm {
    font-size: 12.5px;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
}

.btn-lg {
    font-size: 15px;
    padding: 0.55rem 1.5rem;
    border-radius: 8px;
}

.btn-primary {
    background: var(--gv-primary);
    border-color: var(--gv-primary);
}

.btn-primary:hover {
    background: #0b5ed7;
    border-color: #0b5ed7;
    box-shadow: 0 3px 8px rgba(13,110,253,.28);
}

/* ══════════════════════════════════════════════════════════════
   BADGES & ALERTS
══════════════════════════════════════════════════════════════ */

.badge {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
    border-radius: 5px;
    padding: 0.28em 0.55em;
}

.badge.rounded-pill { border-radius: 50rem; }

.alert {
    font-size: 13.5px;
    border-radius: 8px;
    border: none;
    padding: 0.75rem 1rem;
}

/* ══════════════════════════════════════════════════════════════
   BREADCRUMB
══════════════════════════════════════════════════════════════ */

.breadcrumb {
    margin-bottom: 0;
}

.breadcrumb-item a {
    color: #6c757d;
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--gv-primary);
}

.breadcrumb-item.active {
    color: #495057;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #adb5bd;
}

/* ══════════════════════════════════════════════════════════════
   DROPDOWN
══════════════════════════════════════════════════════════════ */

.dropdown-menu {
    font-size: 13.5px;
    border: 1px solid #eaecf0;
    border-radius: 9px;
    box-shadow: 0 6px 20px rgba(0,0,0,.1);
    padding: 0.4rem 0;
}

.dropdown-item {
    padding: 0.45rem 1rem;
    color: #374151;
    border-radius: 5px;
    margin: 0 0.3rem;
    width: calc(100% - 0.6rem);
}

.dropdown-item:hover {
    background: #f0f4ff;
    color: var(--gv-primary);
}

.dropdown-divider { margin: 0.3rem 0; }

.dropdown-header {
    font-size: 12px;
    font-weight: 700;
    color: #6c757d;
    padding: 0.5rem 1rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* ══════════════════════════════════════════════════════════════
   SETTINGS PAGE
══════════════════════════════════════════════════════════════ */

/* Nav-tabs sit in card-header; Bootstrap tab content below */
.card .nav-tabs {
    border-bottom: none;
    gap: 2px;
}

.card .nav-tabs .nav-link {
    font-size: 13.5px;
    font-weight: 500;
    color: #6c757d;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 8px 16px 10px;
    background: none;
    transition: color var(--gv-transition), border-color var(--gv-transition);
}

.card .nav-tabs .nav-link:hover {
    color: var(--gv-primary);
}

.card .nav-tabs .nav-link.active {
    color: var(--gv-primary);
    font-weight: 600;
    border-bottom-color: var(--gv-primary);
    background: none;
}

/* Section dividers inside settings forms */
.settings-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #9ca3af;
    border-bottom: 1px solid #eaecf0;
    padding-bottom: 8px;
    margin-bottom: 1rem;
}

/* ══════════════════════════════════════════════════════════════
   DASHBOARD KPI CARDS
══════════════════════════════════════════════════════════════ */

.icon-box {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 10px;
}

/* ══════════════════════════════════════════════════════════════
   PAGINATION
══════════════════════════════════════════════════════════════ */

.pagination {
    font-size: 13px;
    margin-bottom: 0;
}

.page-link {
    color: var(--gv-primary);
    border-color: #dee2e6;
    border-radius: 6px;
    margin: 0 2px;
    padding: 0.35rem 0.65rem;
}

.page-link:hover {
    background: #f0f4ff;
    border-color: #c8d8ff;
    color: var(--gv-primary);
}

.page-item.active .page-link {
    background: var(--gv-primary);
    border-color: var(--gv-primary);
}

.page-item.disabled .page-link {
    color: #adb5bd;
}

/* ══════════════════════════════════════════════════════════════
   STATUS BADGES (custom)
══════════════════════════════════════════════════════════════ */

.badge-status-available  { background: #d1fae5; color: #065f46; }
.badge-status-sold       { background: #fee2e2; color: #991b1b; }
.badge-status-repair     { background: #fef3c7; color: #92400e; }
.badge-status-reserved   { background: #dbeafe; color: #1e40af; }
.badge-status-disposed   { background: #f3f4f6; color: #4b5563; }

/* ══════════════════════════════════════════════════════════════
   UTILITY
══════════════════════════════════════════════════════════════ */

.text-orange  { color: #f97316 !important; }
.bg-orange    { background: #f97316 !important; }
.text-purple  { color: #7c3aed !important; }
.bg-purple    { background: #7c3aed !important; }

.cursor-pointer { cursor: pointer; }
.user-select-none { user-select: none; }

/* Hover underline utility */
.hover-underline:hover { text-decoration: underline !important; }

/* Smooth fade for tab transitions */
.tab-pane.fade { transition: opacity .18s ease; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE FIRST
══════════════════════════════════════════════════════════════ */

/* ── Sidebar nav links: taller tap targets on touch screens ── */
@media (max-width: 991.98px) {
    .sidebar-link {
        padding: 10px 14px;
        margin: 2px 8px;
        font-size: 14px;
    }
    .sidebar-link i { font-size: 17px; }
    .sidebar-close {
        width: 36px; height: 36px;
        display: flex; align-items: center; justify-content: center;
        border-radius: 6px;
    }
}

/* Body scroll lock when mobile sidebar open */
body.sidebar-is-open { overflow: hidden; }

/* ── Topnav ── */
@media (max-width: 767.98px) {
    .topnav { padding: 0 0.75rem; gap: 0.35rem; }
    .topnav-search-wrap { display: none; }
    /* Mobile search bar (expands on icon tap) */
    .topnav-search-expand {
        position: absolute;
        top: 0; left: 0; right: 0;
        height: 58px;
        background: #fff;
        display: flex;
        align-items: center;
        padding: 0 0.75rem;
        gap: 8px;
        z-index: 1031;
        transform: translateY(-100%);
        transition: transform 0.2s ease;
        border-bottom: 1px solid #e9ecef;
    }
    .topnav-search-expand.open { transform: translateY(0); }
    .topnav-search-expand input {
        flex: 1; height: 36px;
        border-radius: 20px;
        border: 1px solid #e9ecef;
        background: #f3f5f9;
        padding: 0 14px 0 36px;
        font-size: 14px;
    }
    .topnav-search-expand input:focus {
        outline: none;
        border-color: #0d6efd;
        background: #fff;
        box-shadow: 0 0 0 0.18rem rgba(13,110,253,.12);
    }
    .topnav-search-expand .si-close {
        width: 34px; height: 34px;
        display: flex; align-items: center; justify-content: center;
        border: none; background: none; color: #6c757d; cursor: pointer;
        font-size: 16px; flex-shrink: 0;
    }
    .icon-box { width: 44px; height: 44px; }

    /* Bigger tap targets for topnav buttons */
    .topnav .btn-sm {
        width: 36px; height: 36px;
        padding: 0;
        display: inline-flex; align-items: center; justify-content: center;
    }
}

/* ── Page header & content ── */
@media (max-width: 575.98px) {
    /* Fix dead selector — was .admin-content; layout uses .gv-content */
    .gv-content .container-fluid,
    .container-fluid {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .gv-page-title { font-size: 14.5px; }

    /* Page header: stack title + actions vertically */
    .gv-page-header .d-flex { flex-direction: column !important; align-items: flex-start !important; }
    .gv-page-header .flex-shrink-0 { width: 100%; }
    .gv-page-header .flex-shrink-0 .d-flex { flex-direction: row !important; flex-wrap: wrap; }

    /* Tables */
    .table th, .table td { font-size: 12px; padding: 0.45rem 0.5rem; }

    /* Cards */
    .card-body { padding: 0.875rem !important; }

    /* Pagination — smaller on mobile */
    .page-link { padding: 0.3rem 0.55rem; font-size: 12px; }

    /* Alerts */
    .alert { font-size: 13px; padding: 0.65rem 0.875rem; }

    /* Modals full-width on mobile */
    .modal-dialog { margin: 0.5rem; }
    .modal-content { border-radius: 10px; }
}

/* ── Topnav position context for slide-down search ── */
.topnav { position: sticky; overflow: visible; }

/* ── Tables: ensure horizontal scroll, no overflow clipping ── */
.table-responsive { -webkit-overflow-scrolling: touch; }

/* ── Forms on mobile ── */
@media (max-width: 575.98px) {
    .form-control, .form-select {
        font-size: 14px; /* prevent iOS auto-zoom (needs ≥16px ideally, 14 is compromise) */
    }
}

/* ── Buttons: minimum tap target ── */
@media (max-width: 767.98px) {
    .btn { min-height: 36px; }
    .btn-sm { min-height: 32px; }
}
