/* =============================================
   KSKT — Global Stylesheet
   ============================================= */

:root {
    --primary:      #7B1818;
    --primary-dark: #5E1010;
    --primary-light:#A52020;
    --gold:         #DAA520;
    --gold-light:   #F0C040;
    --sidebar-bg:   #1C2536;
    --sidebar-w:    260px;
    --topbar-h:     64px;
    --card-radius:  14px;
    --shadow-sm:    0 2px 8px rgba(0,0,0,0.08);
    --shadow-md:    0 4px 20px rgba(0,0,0,0.12);
    --shadow-lg:    0 8px 40px rgba(0,0,0,0.16);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f5;
    color: #1f2937;
    margin: 0;
}

/* ── SIDEBAR ─────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.sidebar-brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--gold);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(123,24,24,0.4);
}

.sidebar-brand-text {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
}

.sidebar-brand-text small {
    color: rgba(255,255,255,0.5);
    font-size: 0.72rem;
    font-weight: 400;
    display: block;
}

.sidebar-section {
    padding: 1rem 0;
    flex: 1;
}

.sidebar-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.3);
    padding: 0.75rem 1.25rem 0.35rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0;
    transition: all 0.2s;
    position: relative;
}

.sidebar-item:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
}

.sidebar-item.active {
    background: rgba(123,24,24,0.35);
    color: #fff;
    border-right: 3px solid var(--gold);
}

.sidebar-item.active .sidebar-icon {
    color: var(--gold);
}

.sidebar-icon {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

/* ── SIDEBAR DROPDOWN ────────────────────── */
.sidebar-dropdown-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease;
    background: rgba(0,0,0,0.18);
}

.sidebar-dropdown.open .sidebar-dropdown-menu {
    max-height: 300px;
}

.sidebar-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.sidebar-dropdown-toggle {
    display: flex;
    align-items: center;
}

.sidebar-subitem {
    padding-left: 2.5rem !important;
    font-size: 0.83rem;
}

.sidebar-subitem::before,
.sidebar-subitem.active::before {
    content: none !important;
    display: none !important;
}

.sidebar-dropdown-toggle:hover .dropdown-arrow {
    color: rgba(255,255,255,0.8);
}

/* ── TOPBAR ──────────────────────────────── */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 900;
    box-shadow: var(--shadow-sm);
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

.topbar-user-info {
    text-align: right;
}

.topbar-user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1f2937;
    line-height: 1.2;
}

.topbar-user-role {
    font-size: 0.72rem;
    color: #6b7280;
    text-transform: capitalize;
}

/* ── CONTENT AREA ────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    padding-top: var(--topbar-h);
    min-height: 100vh;
}

.content-inner {
    padding: 1.75rem;
}

/* ── BREADCRUMB ──────────────────────────── */
.breadcrumb-wrapper {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.65rem 1.75rem;
    display: flex;
    align-items: center;
}

.breadcrumb {
    margin: 0;
    font-size: 0.825rem;
}

.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
}

/* ── STATS CARDS ─────────────────────────── */
.stats-card {
    background: #fff;
    border-radius: var(--card-radius);
    padding: 1.35rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: box-shadow 0.2s, transform 0.2s;
    border: 1px solid rgba(0,0,0,0.04);
}

.stats-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stats-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stats-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1f2937;
    line-height: 1;
}

.stats-label {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.2rem;
}

/* ── TABLE CARD ──────────────────────────── */
.table-card {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0,0,0,0.04);
}

.table-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: #fff;
}

.table-title {
    font-weight: 700;
    font-size: 1rem;
    color: #1f2937;
    margin: 0;
}

.table {
    margin: 0;
    font-size: 0.875rem;
}

.table thead th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
    padding: 0.75rem 1rem;
}

.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-color: #f3f4f6;
}

.table tbody tr:hover {
    background: #fafafa;
}

/* ── BADGES ──────────────────────────────── */
.badge-umkm  { background: #B8860B; color: #fff; }
.badge-mou   { background: #1565c0; color: #fff; }
.badge-perum { background: #2e7d32; color: #fff; }

.badge-aktif    { background: #d1fae5; color: #065f46; }
.badge-nonaktif { background: #fee2e2; color: #991b1b; }

/* ── FORM ────────────────────────────────── */
.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid #e5e7eb;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(123,24,24,0.1);
}

.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: #374151;
    margin-bottom: 0.35rem;
}

/* ── MODAL ───────────────────────────────── */
.modal-header-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border-bottom: none;
}

.modal-header-primary .btn-close {
    filter: invert(1);
}

/* ── BUTTONS ─────────────────────────────── */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* ── ALERTS ──────────────────────────────── */
.alert {
    border-radius: 10px;
    border: none;
    font-size: 0.875rem;
}

/* ── MOBILE RESPONSIVE ───────────────────── */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #374151;
    cursor: pointer;
    padding: 0.25rem;
}

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .main-content {
        margin-left: 0;
    }
    .topbar {
        left: 0;
    }
    .sidebar-toggle {
        display: block;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 576px) {
    .content-inner {
        padding: 1rem;
    }
    .topbar-user-info {
        display: none;
    }
}

/* ── PRINT ───────────────────────────────── */
@media print {
    .sidebar, .topbar, .breadcrumb-wrapper, .no-print { display: none !important; }
    .main-content { margin-left: 0; padding-top: 0; }
}

/* ── ANIMATIONS ──────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease forwards; }

/* ── SCROLLBAR ───────────────────────────── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
