/* ============================================================
   KOPERASI DESA MERAH PUTIH - MAIN STYLESHEET
   ============================================================ */

:root {
    --primary: #c41e3a;
    --primary-dark: #9a1830;
    --primary-light: #f8d7dc;
    --secondary: #1e3a5f;
    --secondary-dark: #152840;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --gray-light: #e9ecef;
    --sidebar-width: 270px;
    --sidebar-collapsed: 70px;
    --topbar-height: 60px;
    --footer-height: 50px;
    --border-radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f0f2f5;
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--secondary) 0%, #0d1f33 100%);
    color: #fff;
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 20px;
    gap: 12px;
}

.brand-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.brand-text {
    line-height: 1.2;
}

.brand-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
}

.brand-subtitle {
    display: block;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.7);
    letter-spacing: 0.5px;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 0 20px;
}

.sidebar-nav {
    list-style: none;
    padding: 10px 0;
}

.nav-header {
    padding: 12px 20px 6px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    gap: 12px;
}

.nav-item a:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
    border-left-color: rgba(196,30,58,0.5);
}

.nav-item.active a {
    color: #fff;
    background: rgba(196,30,58,0.2);
    border-left-color: var(--primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
}

/* ============================================================
   MAIN WRAPPER
   ============================================================ */
#main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar-collapsed #main-wrapper {
    margin-left: var(--sidebar-collapsed);
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
}

.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-header,
.sidebar-collapsed .nav-item span {
    display: none;
}

.sidebar-collapsed .nav-item a {
    justify-content: center;
    padding: 12px;
}

.sidebar-collapsed .nav-item i {
    font-size: 1.1rem;
}

.sidebar-collapsed .badge {
    display: none !important;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar .btn-link {
    color: var(--gray);
    text-decoration: none;
    padding: 8px 12px;
}

.topbar .btn-link:hover {
    color: var(--dark);
    background: var(--gray-light);
    border-radius: 8px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
}

.notification-dropdown {
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
}

.notification-dropdown .dropdown-header {
    padding: 12px 16px;
    font-weight: 600;
    border-bottom: 1px solid #eee;
}

.notification-dropdown .dropdown-item {
    padding: 10px 16px;
    border-bottom: 1px solid #f5f5f5;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    padding: 24px;
    min-height: calc(100vh - var(--topbar-height) - var(--footer-height));
}

.content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================================
   FOOTER
   ============================================================ */
.main-footer {
    height: var(--footer-height);
    background: #fff;
    border-top: 1px solid #e9ecef;
    padding: 0 24px;
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: var(--gray);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: #fff;
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #f0f0f0;
    padding: 16px 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 20px;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.info::before { background: var(--info); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 12px;
}

.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: #d4edda; color: var(--success); }
.stat-icon.warning { background: #fff3cd; color: #856404; }
.stat-icon.danger { background: #f8d7da; color: var(--danger); }
.stat-icon.info { background: #d1ecf1; color: #0c5460; }

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--dark);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--gray);
}

.stat-change {
    font-size: 0.75rem;
    margin-top: 8px;
}

/* ============================================================
   BADGES & LABELS
   ============================================================ */
.badge {
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
}

.badge-draft { background: #e9ecef; color: #495057; }
.badge-diajukan { background: #cce5ff; color: #004085; }
.badge-disetujui { background: #d4edda; color: #155724; }
.badge-ditolak { background: #f8d7da; color: #721c24; }
.badge-diproses { background: #fff3cd; color: #856404; }
.badge-dikirim { background: #d1ecf1; color: #0c5460; }
.badge-diterima { background: #d4edda; color: #155724; }
.badge-selesai { background: #c3e6cb; color: #155724; }
.badge-dibatalkan { background: #f5c6cb; color: #721c24; }

/* ============================================================
   TABLES
   ============================================================ */
.table {
    font-size: 0.85rem;
}

.table thead th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid #dee2e6;
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
}

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

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    font-weight: 500;
    font-size: 0.85rem;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

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

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-label {
    font-weight: 500;
    font-size: 0.82rem;
    color: var(--dark);
    margin-bottom: 6px;
}

.form-control, .form-select {
    font-size: 0.85rem;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid #d9d9d9;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(196,30,58,0.15);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 50%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 32px;
    text-align: center;
}

.login-header .logo-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.login-header h3 {
    font-weight: 700;
    margin-bottom: 4px;
}

.login-header p {
    opacity: 0.85;
    margin: 0;
    font-size: 0.85rem;
}

.login-body {
    padding: 32px;
}

.login-footer {
    text-align: center;
    padding: 0 32px 24px;
    font-size: 0.8rem;
    color: var(--gray);
}

/* ============================================================
   PROGRESS BAR CUSTOM
   ============================================================ */
.progress {
    height: 8px;
    border-radius: 10px;
    background: #e9ecef;
}

.progress-bar {
    border-radius: 10px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.page-subtitle {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 4px;
}

/* ============================================================
   SEARCH & FILTER BAR
   ============================================================ */
.filter-bar {
    background: #fff;
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

/* ============================================================
   MODAL CUSTOM
   ============================================================ */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid #f0f0f0;
    padding: 16px 20px;
}

.modal-body {
    padding: 20px;
}

/* ============================================================
   TIMELINE (PO Tracking)
   ============================================================ */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -26px;
    top: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--primary);
    z-index: 1;
}

.timeline-dot.success { border-color: var(--success); }
.timeline-dot.warning { border-color: var(--warning); }
.timeline-dot.danger { border-color: var(--danger); }

.timeline-content {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 8px;
}

.timeline-title {
    font-weight: 600;
    font-size: 0.85rem;
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--gray);
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    border: none;
    border-radius: 8px;
    padding: 14px 18px;
    font-size: 0.85rem;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .sidebar, .topbar, .main-footer, .no-print {
        display: none !important;
    }
    #main-wrapper {
        margin-left: 0 !important;
    }
    .main-content {
        padding: 0 !important;
    }
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.mobile-show {
        transform: translateX(0);
    }
    #main-wrapper {
        margin-left: 0 !important;
    }
    .sidebar-collapsed .sidebar {
        width: var(--sidebar-width);
    }
}

/* ============================================================
   UTILITY
   ============================================================ */
.text-primary-custom { color: var(--primary) !important; }
.bg-primary-custom { background: var(--primary) !important; }
.border-primary-custom { border-color: var(--primary) !important; }

.cursor-pointer { cursor: pointer; }
.text-small { font-size: 0.8rem; }
.text-xs { font-size: 0.7rem; }
.fw-semibold { font-weight: 600; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
