/* ============================================
   ROOT VARIABLES (Style lamamu)
   ============================================ */
:root {
    --sidebar-bg: #0a1628;
    --sidebar-hover: #142b44;
    --sidebar-text: #a7b5c6;
    --sidebar-active: #1e4f8a;
    --body-bg: #f8f9fa;
    --primary-blue: #1a73e8;
}

/* ============================================
   BASE STYLES
   ============================================ */
body {
    background-color: var(--body-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow-x: hidden;
    padding-top: 10px; /* Space untuk mobile toggle */
}

/* ============================================
   MOBILE TOGGLE (Top Bar)
   ============================================ */
.mobile-toggle {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1060;
    background: var(--sidebar-bg);
    padding: 12px 16px;
    display: none; /* Default hidden, muncul di mobile */
    align-items: center;
    border-bottom: 2px solid #1c304a;
    height: 60px;
}

.mobile-toggle .btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    padding: 0;
    line-height: 1;
}

.mobile-toggle .btn:hover {
    color: var(--primary-blue);
}

.mobile-toggle span {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

/* ============================================
   SIDEBAR OVERLAY
   ============================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================
   SIDEBAR - Style lamamu + Responsive fix
   ============================================ */
.sidebar {
    width: 260px;
    min-height: 100vh;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    z-index: 1050;
    transition: left 0.3s ease-in-out;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

/* Responsive: Sidebar geser keluar di mobile */
@media (max-width: 768px) {
    .sidebar {
        left: -300px;
        width: 280px;
    }
    .sidebar.active {
        left: 0;
    }
    .mobile-toggle {
        display: flex !important;
    }
}

.sidebar .brand {
    padding: 25px 20px;
    color: #fff;
    border-bottom: 1px solid #1c304a;
    position: sticky;
    top: 0;
    background: var(--sidebar-bg);
    z-index: 10;
}

.sidebar .brand .logo-text {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
}

.sidebar .brand small {
    font-size: 0.65rem;
    color: #6c8eb0;
}

.sidebar .nav-item {
    margin-bottom: 4px;
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 12px 25px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
    gap: 12px;
}

.sidebar .nav-link i {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active-parent {
    color: #fff;
    background-color: var(--sidebar-hover);
}

.sidebar .nav-link.active-link {
    background-color: var(--sidebar-active) !important;
    color: #fff !important;
    border-left-color: #fff;
}

/* Parent Link dengan arrow */
.sidebar .parent-link {
    cursor: pointer;
    position: relative;
}

.sidebar .parent-link .arrow-icon {
    transition: transform 0.3s;
    font-size: 0.8rem;
    margin-left: auto;
}

.sidebar .menu-group.menu-open .parent-link .arrow-icon {
    transform: rotate(180deg);
}

/* ============================================
   SUBMENU - Style lamamu + fix
   ============================================ */
.sidebar .sub-menu {
    display: none;
    padding-left: 15px;
    background: rgba(0, 0, 0, 0.15);
}

.sidebar .sub-menu .nav-link {
    padding: 8px 25px 8px 45px;
    font-size: 0.85rem;
}

.sidebar .sub-menu .nav-link i {
    width: 16px;
    font-size: 0.5rem;
    margin-right: 12px;
}

.menu-group.menu-open .sub-menu {
    display: block;
}

/* ============================================
   MAIN CONTENT - Fix responsive
   ============================================ */
.main-content {
    margin-left: 260px;
    padding: 25px 30px;
    transition: margin-left 0.3s;
    min-height: 100vh;
}

/* Responsive Main Content */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0 !important;
        padding: 15px !important;
        padding-top: 75px !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .main-content {
        padding: 20px !important;
    }
}

/* ============================================
   TABS
   ============================================ */
.nav-tabs .nav-link {
    border: none;
    color: #6c757d;
    font-weight: 500;
    padding: 10px 20px;
    position: relative;
}

.nav-tabs .nav-link.active {
    color: var(--primary-blue);
    background: transparent;
}

.nav-tabs .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 3px;
    background-color: var(--primary-blue);
    border-radius: 3px 3px 0 0;
}

.nav-tabs .nav-link:hover {
    border: none;
}

/* Responsive Tabs */
@media (max-width: 576px) {
    .nav-tabs .nav-link {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    .nav-tabs .nav-link.active::after {
        left: 12px;
        right: 12px;
    }
}

/* ============================================
   SEARCH BAR
   ============================================ */
.search-container {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

@media (max-width: 576px) {
    .search-container {
        padding: 12px;
    }
    .search-container .row > [class*="col-"] {
        margin-bottom: 10px;
    }
}

/* ============================================
   TABEL - Responsive fix
   ============================================ */
.table thead th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #6c757d;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    padding: 15px;
}

.table td {
    padding: 15px;
    vertical-align: middle;
    font-size: 0.9rem;
}

/* Responsive Table */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 15px;
}

.table-responsive .table {
    margin-bottom: 0;
    min-width: 600px;
}

.table-responsive .table td,
.table-responsive .table th {
    white-space: nowrap;
}

@media (max-width: 576px) {
    .table thead th {
        padding: 10px 8px;
        font-size: 0.65rem;
    }
    .table td {
        padding: 10px 8px;
        font-size: 0.8rem;
    }
}

/* ============================================
   BADGE STATUS
   ============================================ */
.badge-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-aktif {
    background-color: #d1e7dd;
    color: #0f5132;
}

.badge-nonaktif {
    background-color: #f8d7da;
    color: #842029;
}

.badge-dihapus {
    background-color: #fff3cd;
    color: #664d03;
}

/* ============================================
   INFO GRID
   ============================================ */
.info-grid-section {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    padding: 25px;
    margin-top: 25px;
}

.info-item {
    display: flex;
    margin-bottom: 20px;
}

.info-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f0f7ff;
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
}

.info-content h6 {
    font-size: 0.8rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 2px;
}

.info-content p {
    font-size: 0.8rem;
    color: #6c757d;
    margin: 0;
}

/* Responsive Info Grid */
@media (max-width: 576px) {
    .info-grid-section {
        padding: 15px;
    }
    .info-item {
        margin-bottom: 12px;
    }
    .info-content h6 {
        font-size: 0.7rem;
    }
    .info-content p {
        font-size: 0.7rem;
    }
}

/* ============================================
   FOOTER BLUE INFO
   ============================================ */
.footer-blue-info {
    background: #f0f7ff;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

@media (max-width: 576px) {
    .footer-blue-info {
        padding: 12px;
    }
}

/* ============================================
   WIZARD / STEPPER
   ============================================ */
.stepper-wrapper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    position: relative;
}

.stepper-wrapper::before {
    content: "";
    position: absolute;
    top: 25px;
    left: 5%;
    width: 90%;
    height: 2px;
    background: #e9ecef;
    z-index: 0;
}

.stepper-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    z-index: 1;
    background: #fff;
    padding: 0 10px;
}

.stepper-item .step-counter {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 8px;
    transition: all 0.3s;
}

.stepper-item.active .step-counter {
    background-color: #0d6efd;
    color: #fff;
    box-shadow: 0 4px 6px rgba(13, 110, 253, 0.2);
}

.stepper-item.completed .step-counter {
    background-color: #198754;
    color: #fff;
}

.stepper-item .step-name {
    font-weight: 500;
    font-size: 0.85rem;
    color: #6c757d;
}

.stepper-item.active .step-name {
    color: #0d6efd;
    font-weight: 600;
}

/* Responsive Stepper */
@media (max-width: 576px) {
    .stepper-wrapper {
        overflow-x: auto;
        padding-bottom: 10px;
        gap: 5px;
    }
    .stepper-wrapper::before {
        display: none;
    }
    .stepper-item {
        flex: 0 0 auto;
        padding: 0 8px;
        min-width: 60px;
        background: transparent;
    }
    .stepper-item .step-counter {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
    .stepper-item .step-name {
        font-size: 0.6rem;
        text-align: center;
        white-space: nowrap;
    }
}

/* ============================================
   RINGKASAN / FORM SIDEBAR
   ============================================ */
.ringkasan-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
}

.ringkasan-item {
    display: flex;
    margin-bottom: 15px;
}

.ringkasan-icon {
    width: 40px;
    height: 40px;
    background: #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    color: #0d6efd;
}

.ringkasan-content h6 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.ringkasan-content p {
    font-size: 0.8rem;
    color: #6c757d;
    margin: 0;
}

/* ============================================
   UPLOAD AREA
   ============================================ */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: #fff;
    cursor: pointer;
    transition: 0.3s;
}

.upload-area:hover {
    border-color: #0d6efd;
    background: #f8f9fa;
}

.upload-area img {
    max-width: 100%;
    max-height: 150px;
    margin-bottom: 10px;
    border-radius: 4px;
}

/* ============================================
   TABLE HOVER
   ============================================ */
.table-hover tbody tr:hover {
    background-color: #f1f4f9;
    cursor: pointer;
}

.table tbody tr.active-row {
    background-color: #eaf3ff !important;
    border-left: 3px solid #0d6efd;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: none;
    margin-bottom: 20px;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    padding: 15px 20px;
    border-radius: 10px 10px 0 0 !important;
}

.card-body {
    padding: 20px;
}

@media (max-width: 576px) {
    .card-header {
        padding: 12px 15px;
    }
    .card-body {
        padding: 15px;
    }
}

/* ============================================
   FORM ELEMENTS - Fix iOS zoom
   ============================================ */
.form-control,
.form-select,
.input-group-text {
    font-size: 16px !important;
    border-radius: 8px;
}

.form-control:focus,
.form-select:focus {
    border-color: #5b9bd5;
    box-shadow: 0 0 0 0.2rem rgba(91, 155, 213, 0.25);
}

/* ============================================
   SELECT2 FIX
   ============================================ */
.select2-container {
    width: 100% !important;
    max-width: 100%;
}

.select2-selection {
    height: auto !important;
    min-height: 38px;
    border-radius: 8px !important;
    border: 1px solid #ced4da !important;
}

.select2-selection__rendered {
    white-space: normal !important;
    word-wrap: break-word !important;
    padding: 6px 12px !important;
}

.select2-selection__arrow {
    top: 50% !important;
    transform: translateY(-50%);
}

/* ============================================
   DATATABLES RESPONSIVE FIX
   ============================================ */
.dt-buttons {
    margin-bottom: 10px;
}

.dt-buttons .btn {
    margin-right: 5px;
    margin-bottom: 5px;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 10px;
}

@media (max-width: 576px) {
    .dataTables_wrapper .dataTables_length {
        float: none !important;
        text-align: left !important;
    }
    .dataTables_wrapper .dataTables_filter {
        float: none !important;
        text-align: left !important;
    }
    .dataTables_wrapper .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
    }
    .dataTables_wrapper .dataTables_info {
        float: none !important;
        text-align: center !important;
        padding-top: 10px !important;
    }
    .dataTables_wrapper .dataTables_paginate {
        float: none !important;
        text-align: center !important;
        padding-top: 10px !important;
    }
}

/* ============================================
   MODAL RESPONSIVE
   ============================================ */
.modal-dialog {
    margin: 10px;
}

@media (min-width: 576px) {
    .modal-dialog {
        margin: 1.75rem auto;
    }
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

@media (max-width: 576px) {
    .modal-body {
        padding: 15px;
        max-height: 60vh;
    }
    .modal-header {
        padding: 12px 15px;
    }
    .modal-footer {
        padding: 12px 15px;
    }
}

/* ============================================
   RESPONSIVE UTILITY
   ============================================ */
/* Grid gap untuk mobile */
@media (max-width: 576px) {
    .row.gap-mobile {
        --bs-gutter-y: 10px;
    }
}

/* Button full width di mobile */
@media (max-width: 576px) {
    .btn-mobile-block {
        width: 100%;
        display: block;
    }
    .btn-mobile-block + .btn-mobile-block {
        margin-top: 8px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .sidebar,
    .mobile-toggle,
    .sidebar-overlay {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 20px !important;
    }
    .table-responsive {
        overflow: visible !important;
    }
    .table-responsive .table {
        min-width: auto !important;
    }
    .table-responsive .table td,
    .table-responsive .table th {
        white-space: normal !important;
    }
    .no-print {
        display: none !important;
    }
}

/* ============================================
   ANIMATION
   ============================================ */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar.active {
    animation: slideIn 0.3s ease-out;
}

/* ============================================
   SCROLLBAR SIDEBAR
   ============================================ */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--sidebar-bg);
}

.sidebar::-webkit-scrollbar-thumb {
    background: #2c3e50;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #3d5a78;
}