/* ═══════════════════════════════════════════════════════════
   Document Issuance Management System — Global Stylesheet
   Primary: #19A6E3  |  Font: System UI stack
   ═══════════════════════════════════════════════════════════ */

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:        #19A6E3;
    --primary-dark:   #1490c8;
    --primary-light:  #e8f6fd;
    --sidebar-w:      250px;
    --topbar-h:       60px;
    --radius:         12px;
    --shadow:         0 2px 12px rgba(0,0,0,0.07);
    --shadow-md:      0 6px 24px rgba(0,0,0,0.11);
    --border:         #edf0f4;
    --text:           #2d3748;
    --text-muted:     #888;
    --bg:             #f4f7fb;
    --white:          #ffffff;
    --danger:         #c62828;
    --success:        #1a7a3f;
    --warning:        #e65100;
    --transition:     0.22s ease;
}

html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
ul, ol { list-style: none; }
button { font-family: inherit; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f0f0f0; }
::-webkit-scrollbar-thumb { background: #c5d5e8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ═══════════════════════════════════════════════════════════
   LAYOUT WRAPPER
   ═══════════════════════════════════════════════════════════ */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    background: #1a1a2e;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ── Sidebar Brand ── */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}
.brand-icon {
    width: 38px; height: 38px;
    background: white;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #fff; flex-shrink: 0;
}
.brand-text {
    font-size: 15px; font-weight: 700;
    color: #fff; line-height: 1.2;
}
.brand-text small {
    display: block; font-size: 10px;
    color: rgba(255,255,255,0.45); font-weight: 400;
}

/* ── Sidebar Nav ── */
.sidebar-nav {
    flex: 1;
    padding: 14px 10px;
}
.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 6px 10px 4px;
    margin-top: 4px;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 9px;
    color: rgba(255,255,255,0.65);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-nav a i { font-size: 16px; flex-shrink: 0; }
.sidebar-nav a:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    text-decoration: none;
}
.sidebar-nav a.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(25,166,227,0.35);
}

/* ── Sidebar Footer ── */
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.avatar {
    width: 34px; height: 34px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.uname  { font-size: 13px; font-weight: 600; color: #fff; }
.urole  { font-size: 11px; color: rgba(255,255,255,0.4); }

/* ── Sidebar Overlay (mobile) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: opacity var(--transition);
}
.sidebar-overlay.show { display: block; }

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left var(--transition);
}

/* ── Topbar ── */
.topbar {
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
    flex-shrink: 0;
    gap: 10px;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.page-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* ── Hamburger Button ── */
.hamburger {
    display: none;           /* hidden on desktop */
    width: 38px; height: 38px;
    background: var(--primary-light);
    border: none;
    border-radius: 9px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary);
    transition: background var(--transition);
    flex-shrink: 0;
}
.hamburger:hover  { background: #d0edf8; }
.hamburger:active { background: #b8e2f5; }

/* ── Notification button ── */
.notif-btn {
    position: relative;
    width: 38px; height: 38px;
    background: var(--primary-light);
    border: none; border-radius: 9px;
    cursor: pointer; font-size: 17px; color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition);
}
.notif-btn:hover { background: #d0edf8; }
.badge-dot {
    position: absolute;
    top: 5px; right: 5px;
    width: 16px; height: 16px;
    background: var(--danger);
    color: #fff; border-radius: 50%;
    font-size: 9px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff;
}

/* ── Page Content ── */
.page-content {
    flex: 1;
    padding: 22px 24px;
    min-width: 0;
    overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn-primary-custom {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 9px;
    padding: 10px 20px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-primary-custom:hover {
    background: var(--primary-dark);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(25,166,227,0.3);
    transform: translateY(-1px);
}
.btn-primary-custom:active { transform: translateY(0); box-shadow: none; }

.btn-sm-custom {
    padding: 7px 14px;
    font-size: 12.5px;
    border-radius: 8px;
}

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */
.content-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 20px;
}
.card-header-custom {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    background: #fafbfc;
}
.card-header-custom h5 {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-body-custom { padding: 22px; }

/* ── Stat Cards ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all var(--transition);
    text-decoration: none;
    color: inherit;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: inherit;
}
.stat-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.stat-value { font-size: 24px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ═══════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}
.form-control,
.form-select {
    width: 100%;
    padding: 9px 13px;
    border: 1.5px solid #dde3ec;
    border-radius: 9px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(25,166,227,0.12);
}
.form-control::placeholder { color: #bbb; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
    cursor: pointer;
}
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(198,40,40,0.1) !important;
}

/* ── Checkbox / Radio ── */
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* ═══════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════ */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }

.modern-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 600px;
}
.modern-table thead tr {
    background: #f8f9fb;
    border-bottom: 2px solid var(--border);
}
.modern-table th {
    padding: 12px 16px;
    font-weight: 700;
    font-size: 12px;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    text-align: left;
}
.modern-table td {
    padding: 13px 16px;
    border-bottom: 1px solid #f4f6f9;
    vertical-align: middle;
    color: var(--text);
}
.modern-table tbody tr:hover { background: #fafcff; }
.modern-table tbody tr:last-child td { border-bottom: none; }

/* ═══════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════ */
.alert-custom {
    padding: 13px 18px;
    border-radius: 10px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 18px;
    animation: alertSlide 0.3s ease;
}
@keyframes alertSlide {
    from { opacity:0; transform:translateY(-8px); }
    to   { opacity:1; transform:translateY(0); }
}
.alert-success {
    background: #e8f5e9;
    color: #1a5c30;
    border: 1px solid #a5d6a7;
}
.alert-danger {
    background: #fce4ec;
    color: #8b0000;
    border: 1px solid #ef9a9a;
}
.alert-warning {
    background: #fff8e1;
    color: #6d4c00;
    border: 1px solid #ffe082;
}
.alert-info {
    background: var(--primary-light);
    color: #0c5a7a;
    border: 1px solid #b3e0f5;
}

/* ═══════════════════════════════════════════════════════════
   STATUS BADGES
   ═══════════════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
}
.badge-pending    { background: #fff8e1; color: #f57f17; border: 1px solid #ffe082; }
.badge-inreview   { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }
.badge-forwarded  { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.badge-approved   { background: #e8f5e9; color: #1a7a3f; border: 1px solid #a5d6a7; }
.badge-completed  { background: #f3e5f5; color: #6a1b9a; border: 1px solid #ce93d8; }
.badge-rejected   { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE FIRST BREAKPOINTS
   ═══════════════════════════════════════════════════════════ */

/* ── ≤ 992px: show hamburger, hide sidebar off-screen ── */
@media (max-width: 992px) {

    /* Show hamburger button */
    .hamburger {
        display: flex !important;
    }

    /* Push sidebar off-screen by default */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    /* When sidebar is open */
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0,0,0,0.2);
    }

    /* Remove left margin — main content fills full width */
    .main-content {
        margin-left: 0 !important;
    }

    .page-content {
        padding: 16px;
    }

    .page-title {
        font-size: 15px;
        max-width: 160px;
    }

    .topbar { padding: 0 14px; }
}

/* ── ≤ 768px: tighter spacing ── */
@media (max-width: 768px) {
    .page-content { padding: 14px 12px; }
    .card-body-custom { padding: 16px; }
    .card-header-custom { padding: 14px 16px; }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .topbar-right .btn-primary-custom span { display: none; } /* hide text, keep icon */

    .modern-table th,
    .modern-table td { padding: 10px 12px; }
}

/* ── ≤ 480px: single column ── */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-value  { font-size: 20px; }
    .page-title  { max-width: 120px; font-size: 14px; }
    .card-body-custom { padding: 14px; }

    .btn-primary-custom { padding: 8px 14px; font-size: 12.5px; }
    .btn-sm-custom      { padding: 6px 12px; font-size: 12px; }
}

/* ── ≤ 360px: very small phones ── */
@media (max-width: 360px) {
    .page-content { padding: 10px; }
    .topbar { padding: 0 10px; }
    .stats-grid { grid-template-columns: 1fr; }
}
