/* ===================================================================
   ID Card Template Builder — ERP Module Theme (Bootstrap 5.3)
   =================================================================== */

:root {
    /* Brand Theme - ClassOn ERP Maroon */
    --brand:        #a4262c;
    --brand-700:    #8c1f24;
    --brand-600:    #b53a40;
    --brand-soft:   #fbeaea;
    --brand-grad:   linear-gradient(135deg, #b53a40 0%, #8c1f24 100%);

    /* Surfaces */
    --bg:           #f4f6fb;
    --surface:      #ffffff;
    --border:       #eaedf3;
    --border-2:     #f1f3f8;

    /* Text Colors */
    --text:         #1f2533;
    --text-2:       #5a6577;
    --text-3:       #98a2b3;

    /* Status Accents */
    --primary:      #a4262c;
    --info:         #0284c7;
    --success:      #16a34a;
    --warning:      #d97706;
    --danger:       #dc2626;

    /* System Tokens */
    --radius:       16px;
    --radius-sm:    12px;
    --shadow-sm:    0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
    --shadow-md:    0 4px 16px rgba(16,24,40,.06);
    --shadow-lg:    0 12px 32px rgba(16,24,40,.10);
    --header-h:     64px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { text-decoration: none; color: inherit; }
.container-xxl { max-width: 1480px; }

/* ===================== TOP BRAND HEADER ===================== */
.app-header {
    background: var(--brand-grad);
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 14px rgba(140,31,36,.25);
}
.app-header__inner {
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 18px;
}

/* Brand */
.app-brand { display: flex; align-items: center; gap: 11px; color: #fff; }
.app-brand:hover { color: #fff; }
.app-brand__mark {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 11px;
    font-size: 20px;
    backdrop-filter: blur(4px);
}
.app-brand__text { font-size: 19px; font-weight: 800; letter-spacing: -.5px; }
.app-brand__text span { font-weight: 400; opacity: .85; }

/* Search */
.app-search {
    flex: 1;
    max-width: 420px;
    position: relative;
    align-items: center;
}
.app-search i {
    position: absolute; left: 14px;
    color: rgba(255,255,255,.7); font-size: 15px;
}
.app-search input {
    width: 100%;
    height: 40px;
    padding: 0 44px 0 40px;
    border: 1px solid rgba(255,255,255,.2);
    background: rgba(255,255,255,.12);
    color: #fff;
    border-radius: 10px;
    font-size: 13.5px;
    transition: .2s;
}
.app-search input::placeholder { color: rgba(255,255,255,.7); }
.app-search input:focus {
    outline: none;
    background: rgba(255,255,255,.2);
    border-color: rgba(255,255,255,.45);
}
.app-search kbd {
    position: absolute; right: 12px;
    background: rgba(255,255,255,.18);
    border: none; color: #fff;
    font-size: 11px; padding: 2px 6px; border-radius: 6px;
}

/* Topbar Actions */
.app-topbar { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.topbar-session {
    display: flex; align-items: center; gap: 8px;
    padding-right: 8px; margin-right: 4px;
    border-right: 1px solid rgba(255,255,255,.2);
}
.topbar-session label { color: rgba(255,255,255,.85); font-weight: 600; font-size: 12.5px; margin: 0; }
.topbar-session .form-select {
    width: auto;
    background-color: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.22);
    color: #fff; font-weight: 600; font-size: 12.5px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3e%3cpath d='M8 11L3 6h10z'/%3e%3c/svg%3e");
}
.topbar-session .form-select option { color: #1f2533; }

.topbar-btn {
    position: relative;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.16);
    color: #fff; border-radius: 11px;
    font-size: 17px; transition: .18s;
    cursor: pointer;
}
.topbar-btn:hover { background: rgba(255,255,255,.22); color: #fff; }
.topbar-badge {
    position: absolute; top: -5px; right: -5px;
    min-width: 18px; height: 18px; padding: 0 4px;
    background: #fbbf24; color: #78350f;
    font-size: 10.5px; font-weight: 800;
    border-radius: 9px; display: grid; place-items: center;
    border: 2px solid var(--brand-900);
}

/* User Profile Header */
.topbar-user {
    display: flex; align-items: center; gap: 9px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 11px; padding: 4px 10px 4px 4px; color: #fff;
    transition: .18s; cursor: pointer;
}
.topbar-user:hover { background: rgba(255,255,255,.2); color: #fff; }
.topbar-user__avatar {
    width: 34px; height: 34px; border-radius: 9px;
    background: #fff; color: var(--brand);
    font-weight: 800; font-size: 13px;
    display: grid; place-items: center;
}
.topbar-user__avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.topbar-user__meta { flex-direction: column; line-height: 1.1; align-items: flex-start; }
.topbar-user__name { font-weight: 700; font-size: 13px; }
.topbar-user__role { font-size: 11px; opacity: .8; }

/* Dropdown styling */
.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
    margin-top: 10px !important;
    animation: ddIn .16s ease;
}
@keyframes ddIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.quick-actions-menu { width: 300px; }
.quick-actions-menu__title { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); padding: 6px 8px; margin: 0; }
.quick-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.quick-actions-grid a {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 14px 8px; border-radius: 12px; color: var(--text-2);
    font-weight: 600; font-size: 12.5px; text-align: center; transition: .15s;
}
.quick-actions-grid a:hover { background: var(--bg); color: var(--brand); }
.qa-ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 19px; }

.notify-menu { width: 340px; }
.notify-menu__head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 12px; font-weight: 700; }
.notify-item { display: flex; gap: 12px; padding: 11px 10px; border-radius: 12px; transition: .15s; }
.notify-item:hover { background: var(--bg); }
.notify-ico { flex-shrink: 0; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 17px; }
.notify-body { display: flex; flex-direction: column; color: var(--text-2); font-size: 12.5px; line-height: 1.4; }
.notify-body strong { color: var(--text); }
.notify-body small { color: var(--text-3); font-size: 11px; margin-top: 2px; }

.user-menu { width: 264px; }
.user-menu__head { display: flex; align-items: center; gap: 12px; padding: 8px 8px 14px; border-bottom: 1px solid var(--border-2); margin-bottom: 6px; }
.user-menu__head .topbar-user__avatar { background: var(--brand-soft); color: var(--brand); }
.user-menu .dropdown-item { border-radius: 9px; padding: 9px 12px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.user-menu .dropdown-item i { font-size: 16px; width: 18px; }
.user-menu .dropdown-item:hover { background: var(--bg); color: var(--brand); }

/* ===================== HORIZONTAL NAV ===================== */
.app-nav { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: var(--header-h); z-index: 1020; box-shadow: var(--shadow-sm); }
.app-nav__list { list-style: none; display: flex; margin: 0; padding: 0; gap: 4px; }
.app-nav__list a {
    display: flex; align-items: center; gap: 11px;
    padding: 13px 18px; color: var(--text-2);
    border-bottom: 2.5px solid transparent; transition: .15s;
}
.app-nav__list a i { font-size: 20px; }
.app-nav__list a span { display: flex; flex-direction: column; line-height: 1.2; }
.app-nav__list a strong { font-weight: 700; font-size: 13.5px; color: var(--text); }
.app-nav__list a small { font-size: 11px; color: var(--text-3); }
.app-nav__list a:hover { background: var(--bg); color: var(--brand); }
.app-nav__list a.active { border-bottom-color: var(--brand); color: var(--brand); }
.app-nav__list a.active i, .app-nav__list a.active strong { color: var(--brand); }

/* Mobile Menu Toggle Button */
.mobile-nav-toggle { display: none; background: transparent; border: none; color: #fff; font-size: 24px; padding: 0 4px; }

/* ===================== CONTENT ===================== */
.app-content { flex: 1; padding: 26px 0 40px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head__title { font-size: 24px; font-weight: 800; letter-spacing: -.5px; margin: 0; }
.page-head__crumbs { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.page-head__crumbs a { color: var(--text-2); }
.page-head__crumbs a:hover { color: var(--brand); }
.page-head__crumbs i { font-size: 10px; }
.page-head__actions { display: flex; gap: 10px; }

/* Buttons */
.btn-brand { background: var(--brand-grad); color: #fff; font-weight: 600; border: none; border-radius: 10px; padding: 9px 18px; box-shadow: 0 4px 12px rgba(140,31,36,.28); transition: .18s; }
.btn-brand:hover { color: #fff; filter: brightness(1.08); transform: translateY(-1px); }
.btn-light-soft { background: var(--surface); color: var(--text-2); border: 1px solid var(--border); font-weight: 600; border-radius: 10px; padding: 9px 16px; transition: .18s; }
.btn-light-soft:hover { background: var(--bg); color: var(--text); }

/* Hero card */
.hero-card { position: relative; overflow: hidden; background: var(--brand-grad); border-radius: var(--radius); color: #fff; padding: 26px 30px; box-shadow: var(--shadow-md); }
.hero-card__bg { position: absolute; right: -20px; bottom: -40px; font-size: 200px; opacity: .08; transform: rotate(-12deg); }
.hero-card__body { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-card__hi { font-size: 13px; opacity: .9; font-weight: 500; }
.hero-card__welcome h2 { font-size: 23px; font-weight: 800; margin: 4px 0 4px; letter-spacing: -.5px; }
.hero-card__welcome p { margin: 0; opacity: .88; font-size: 13px; max-width: 580px; }
.hero-card__stats { display: flex; gap: 14px; }
.hero-card__stats > div { text-align: center; padding: 0 18px; border-left: 1px solid rgba(255,255,255,.22); }
.hero-card__stats > div:first-child { border-left: none; }
.hero-stat__num { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; }
.hero-stat__lbl { font-size: 11.5px; opacity: .85; }

/* Stat Cards */
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 14px; box-shadow: var(--shadow-sm); transition: .2s; height: 100%; }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card__top { display: flex; align-items: center; justify-content: space-between; }
.stat-ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 22px; }
.stat-trend { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 20px; }
.stat-trend.up { color: var(--success); background: #e8f6ee; }
.stat-trend.down { color: var(--danger); background: #fdeaea; }
.stat-card__num { font-size: 26px; font-weight: 800; margin-top: 14px; letter-spacing: -.5px; }
.stat-card__lbl { color: var(--text-2); font-size: 13px; font-weight: 500; }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); height: 100%; }
.panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.panel__title { font-size: 16px; font-weight: 700; margin: 0; }
.panel__sub { font-size: 12.5px; color: var(--text-3); margin: 2px 0 0; }
.panel__body { padding: 16px 20px 20px; }
.panel__link { color: var(--brand); font-weight: 600; font-size: 13px; }
.panel__link:hover { text-decoration: underline; }

/* Soft color helpers */
.bg-soft-primary { background: #eff6ff; color: var(--primary); }
.bg-soft-info { background: #f0f9ff; color: var(--info); }
.bg-soft-success { background: #f0fdf4; color: var(--success); }
.bg-soft-warning { background: #fffbeb; color: var(--warning); }
.bg-soft-danger { background: #fef2f2; color: var(--danger); }

/* Table overrides & User Table */
.table-custom { margin: 0; width: 100%; border-collapse: separate; border-spacing: 0; }
.table-custom th { background: var(--bg); color: var(--text-2); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.table-custom td { padding: 14px 16px; border-bottom: 1px solid var(--border-2); vertical-align: middle; font-size: 13px; }
.table-custom tr:last-child td { border-bottom: none; }
.table-custom tr:hover td { background: rgba(244,246,251,.5); }

.user-avatar-img {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #e2e8f0;
    border: 1px solid var(--border);
}

/* Footer */
.app-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 18px 0; margin-top: auto; }
.app-footer .container-xxl { display: flex; align-items: center; justify-content: space-between; color: var(--text-3); font-size: 12.5px; font-weight: 500; }

/* ===================== PRINT ENGINE CSS (@media print) ===================== */
@media print {
    /* Hide non-printable layout elements */
    .app-header, .app-nav, .page-head, .panel__head, .app-footer, .no-print, .btn, .dropdown {
        display: none !important;
    }
    body {
        background: #ffffff !important;
        color: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .container-xxl, .app-content {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    /* Printable Grid Layout */
    .printable-cards-grid {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 20px !important;
        justify-content: flex-start !important;
        padding: 10px !important;
    }
    .printable-card-item {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        box-shadow: none !important;
        border: 1px solid #cbd5e1 !important;
    }
}
