/* ============================================================
   CMS Styles — Surat Jalan Application
   ============================================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 0px;
    --topbar-height: 60px;
    --primary-color: #4361ee;
    --primary-dark: #3a0ca3;
    --primary-light: #4cc9f0;
    --secondary-color: #6c757d;
    --success-color: #06d6a0;
    --warning-color: #ffd166;
    --danger-color: #ef476f;
    --info-color: #118ab2;
    --bg-color: #f0f2f5;
    --sidebar-bg: #1a1d2e;
    --sidebar-hover: #252840;
    --sidebar-active: #4361ee;
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: #333;
    overflow-x: hidden;
}

/* ============================================================
   Sidebar
   ============================================================ */
.cms-wrapper {
    display: flex;
    min-height: 100vh;
}

.cms-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #c2c7d0;
    position: fixed;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-speed) ease;
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: var(--primary-light);
}

.sidebar-nav {
    list-style: none;
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-item {
    margin: 2px 12px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: #a0a4b8;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.sidebar-link i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-info > i {
    font-size: 2rem;
    color: #a0a4b8;
}

.sidebar-user-details {
    display: flex;
    flex-direction: column;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: #a0a4b8;
}

/* ============================================================
   Main Content
   ============================================================ */
.cms-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-speed) ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   Top Navbar
   ============================================================ */
.cms-topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1f2937;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-toggle {
    color: #6b7280;
    font-size: 1.3rem;
    padding: 4px 8px;
    text-decoration: none;
}

.sidebar-toggle:hover {
    color: #1f2937;
}

.topbar-user-btn {
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
}

/* ============================================================
   Content Area
   ============================================================ */
.cms-content {
    padding: 24px;
    flex: 1;
}

/* ============================================================
   Sidebar Collapsed State
   ============================================================ */
.sidebar-collapsed .cms-sidebar {
    transform: translateX(-100%);
}

.sidebar-collapsed .cms-main {
    margin-left: 0;
}

/* ============================================================
   Cards & Components
   ============================================================ */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 2px;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.content-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.content-card .card-header {
    background: transparent;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.content-card .card-header h5 {
    font-weight: 600;
    font-size: 1rem;
    color: #1f2937;
    margin: 0;
}

.content-card .card-body {
    padding: 24px;
}

/* ============================================================
   Table Styles
   ============================================================ */
.table-cms {
    margin-bottom: 0;
}

.table-cms thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #e5e7eb;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    padding: 12px 16px;
    white-space: nowrap;
}

.table-cms tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.875rem;
}

.table-cms tbody tr:hover {
    background-color: #f8f9ff;
}

.table-cms tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================================
   Form Styles
   ============================================================ */
.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 6px;
}

.form-control,
.form-select {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.875rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

/* ============================================================
   Button Styles
   ============================================================ */
.btn {
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: 8px;
    padding: 8px 16px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

/* ============================================================
   Badge Styles
   ============================================================ */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 5px 10px;
    border-radius: 6px;
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    margin-bottom: 0;
}

.page-link {
    border-radius: 6px;
    margin: 0 2px;
    font-size: 0.85rem;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

.page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* ============================================================
   Action Buttons Group
   ============================================================ */
.action-btns {
    display: flex;
    gap: 6px;
}

.action-btns .btn {
    padding: 5px 10px;
    font-size: 0.8rem;
}

/* ============================================================
   Search Filter Bar
   ============================================================ */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-bar .form-control,
.filter-bar .form-select {
    max-width: 250px;
}

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1d2e 0%, #2d1b69 50%, #4361ee 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .login-logo i {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.login-card .login-logo h3 {
    font-weight: 700;
    margin-top: 12px;
    color: #1f2937;
}

.login-card .login-logo p {
    color: #6b7280;
    font-size: 0.875rem;
}

/* ============================================================
   Print Styles
   ============================================================ */
@media print {
    .cms-sidebar,
    .cms-topbar,
    .no-print {
        display: none !important;
    }

    .cms-main {
        margin-left: 0 !important;
    }

    .cms-content {
        padding: 0 !important;
    }

    .content-card {
        box-shadow: none !important;
        border: none !important;
    }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 992px) {
    .cms-sidebar {
        transform: translateX(-100%);
    }

    .cms-main {
        margin-left: 0;
    }

    .cms-wrapper.sidebar-open .cms-sidebar {
        transform: translateX(0);
    }

    .sidebar-collapsed .cms-sidebar {
        transform: translateX(0);
    }

    .sidebar-collapsed .cms-main {
        margin-left: 0;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar .form-control,
    .filter-bar .form-select {
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    .cms-content {
        padding: 16px;
    }

    .stat-card {
        padding: 16px;
    }

    .content-card .card-header {
        padding: 12px 16px;
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .content-card .card-body {
        padding: 16px;
    }
}
