/* ============================================================
   APP.CSS - Global Styles untuk Arsip Narasumber
   Mencakup: Reset, Layout, Sidebar, Main Content, Responsive
   ============================================================ */

/* ---------- RESET & BASE ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7fa;
    color: #333;
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---------- MAIN CONTENT AREA ---------- */
main {
    margin-left: 275px;
    padding: 20px;
    flex-grow: 1;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    width: calc(100% - 275px);
}

/* Saat sidebar collapsed */
.sidebar.collapsed ~ main {
    margin-left: 78px;
    width: calc(100% - 78px);
}

/* ---------- SIDEBAR STYLES (dipindahkan dari sidebar.php) ---------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 275px;
    background: #1a1a2e;
    color: #fff;
    transition: width .3s ease;
    z-index: 1000;
    overflow: visible;
    box-shadow: 2px 0 10px rgba(0,0,0,.2);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.sidebar.collapsed { width: 78px; }

/* TOGGLE BUTTON */
.sidebar-toggle {
    position: absolute;
    top: 60px;
    right: -17px;
    transform: translateY(0);
    width: 34px;
    height: 34px;
    background: #16213e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1002;
    transition: right .3s ease;
    box-shadow: 0 0 10px rgba(0,0,0,.3);
    font-size: 16px;
    color: #fff;
}
.sidebar.collapsed .sidebar-toggle { right: 22px; }

/* JUDUL "Arsip Narasumber" - hilang saat collapsed */
.sidebar-title {
    position: absolute;
    top: 53px;
    left: 25px;
    font-size: 27px;
    font-weight: 700;
    color: #3498db;
    letter-spacing: -1px;
    white-space: nowrap;
    z-index: 1001;
    transition: opacity .3s ease;
}
.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .profile-info {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* CARD PROFIL USER */
.profile-card {
    padding: 115px 20px 16px 20px;
    border-bottom: 1px solid #2c2c3d;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    transition: padding-top .3s ease;
}
.sidebar.collapsed .profile-card {
    padding-top: 60px;
    padding: 115px 12px 16px;
    justify-content: center;
    gap: 0;
}

.profile-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    width: 100%;
    transition: background 0.25s ease;
    border-radius: 8px;
    padding: 1px;
}
.profile-link:hover { background: #16213e; }
.profile-avatar { flex-shrink: 0; }
.avatar-img {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #3498db;
    box-shadow: 0 4px 10px rgba(0,0,0,.3);
}

/* PROFILE INFO - teks nama & role ikut hilang saat collapsed */
.profile-info {
    flex: 1;
    min-width: 0;
    padding-left: 10px;
    transition: opacity .3s ease;
}

.profile-name {
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-role {
    font-size: 13px;
    color: #b0b3b8;
    margin: 2px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* STYLE NAVIGASI SIDEBAR */
.sidebar-nav { padding: 10px 0 0; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar-nav ul li { margin-bottom: 8px; }
.nav-link { display: flex; align-items: center; min-height: 52px; padding: 0 20px; color: #b0b3b8; text-decoration: none; transition: background .25s ease, color .25s ease; position: relative; gap: 16px; }
.nav-link:hover, .nav-link.active { background: #16213e; color: #fff; }
.nav-link i { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; line-height: 1; display: flex; align-items: center; justify-content: center; }
.nav-link .text { font-size: 15px; white-space: nowrap; font-weight: 500; transition: opacity .2s ease; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 0; gap: 0; }
.sidebar.collapsed .nav-link i { width: 100%; }
.sidebar.collapsed .nav-link .text { opacity: 0; visibility: hidden; position: absolute; left: 70px; top: 50%; transform: translateY(-50%); background: #16213e; color: #fff; padding: 8px 14px; border-radius: 6px; font-size: 14px; z-index: 1002; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.sidebar.collapsed .nav-link:hover .text { opacity: 1; visibility: visible; }
.sidebar.collapsed .nav-link:hover::before { content: ''; position: absolute; left: 64px; top: 50%; transform: translateY(-50%); border: 6px solid transparent; border-right-color: #16213e; }

/* ---------- DASHBOARD HEADER ---------- */
.dashboard-header {
    background-color: #fff;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    border-radius: 8px;
}

.dashboard-header h2 {
    color: #2c3e50;
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.current-time {
    font-size: 14px;
    color: #7f8c8d;
    margin-top: 5px;
}

.current-time span {
    font-weight: bold;
    color: #2c3e50;
}

/* ---------- DASHBOARD CONTENT ---------- */
.dashboard-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.dashboard-content h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 20px;
}

/* ---------- SUMMARY CARDS (Dashboard) ---------- */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.summary-card i {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
}

.summary-card .card-number {
    font-size: 28px;
    font-weight: 700;
    margin: 5px 0;
}

.summary-card .card-label {
    font-size: 14px;
    opacity: 0.9;
}

/* Variasi warna card */
.summary-card.card-blue { background: linear-gradient(135deg, #3498db, #2980b9); }
.summary-card.card-green { background: linear-gradient(135deg, #2ecc71, #27ae60); }
.summary-card.card-orange { background: linear-gradient(135deg, #f39c12, #e67e22); }
.summary-card.card-red { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.summary-card.card-purple { background: linear-gradient(135deg, #9b59b6, #8e44ad); }
.summary-card.card-teal { background: linear-gradient(135deg, #1abc9c, #16a085); }

/* ---------- DASHBOARD ROW (2 kolom) ---------- */
.dash-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.dash-col {
    flex: 1;
    min-width: 0;
}

/* ---------- CHART CONTAINER ---------- */
.chart-container {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.chart-container h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    max-height: 400px;
}

.chart-wrapper canvas {
    width: 100% !important;
    max-height: 400px;
}

/* ---------- TABLE STYLES (Global) ---------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #ddd;
    color: #333;
}

.data-table th {
    background: #34495e;
    color: #fff;
    font-weight: 600;
}

.data-table tr:hover {
    background: #f5f5f5;
}

/* ---------- BUTTON STYLES (Global) ---------- */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary { background: #3498db; color: #fff; }
.btn-secondary { background: #95a5a6; color: #fff; }
.btn-success { background: #27ae60; color: #fff; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-warning { background: #f39c12; color: #fff; }
.btn-info { background: #2980b9; color: #fff; }

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 16px;
}

/* ---------- FORM STYLES (Global) ---------- */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* ---------- FILTER CONTAINER ---------- */
.filter-container {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
    border: 1px solid #e0e0e0;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 10px;
}

.filter-group {
    flex: 1;
    min-width: 180px;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* ---------- CONTROL BAR ---------- */
.control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.left-actions,
.right-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------- ALERT / MESSAGE ---------- */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
}

.alert-success {
    background: #d5f5e3;
    color: #27ae60;
    border: 1px solid #a9dfbf;
}

.alert-danger {
    background: #fadbd8;
    color: #e74c3c;
    border: 1px solid #f5b7b1;
}

.alert-info {
    background: #d6eaf8;
    color: #2980b9;
    border: 1px solid #aed6f1;
}

.alert-warning {
    background: #fdebd0;
    color: #f39c12;
    border: 1px solid #f9e79f;
}

/* ---------- STATUS BADGE ---------- */
.status-badge {
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
}

.status-badge.aktif,
.status-badge.active {
    background: #d5f5e3;
    color: #27ae60;
}

.status-badge.nonaktif,
.status-badge.inactive {
    background: #fadbd8;
    color: #e74c3c;
}

/* ---------- PROFILE PAGE ---------- */
.profile-container {
    max-width: 600px;
    margin: 0 auto;
}

.profile-photo-section {
    text-align: center;
    margin-bottom: 20px;
}

.profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #3498db;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* ---------- INTRO TEXT ---------- */
.intro-text {
    color: #7f8c8d;
    font-size: 14px;
    margin-bottom: 20px;
}

/* ---------- FOOTER ---------- */
.dashboard-footer {
    text-align: center;
    padding: 15px;
    background-color: #2c3e50;
    color: #fff;
    margin-top: 20px;
    border-radius: 8px;
}

/* ---------- NO RESULTS ---------- */
.no-results {
    text-align: center;
    padding: 30px;
    color: #e74c3c;
    font-style: italic;
    font-size: 15px;
}

/* ---------- MOBILE NAVBAR (hanya tampil di mobile) ---------- */
.mobile-navbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 56px;
    background: #1a1a2e;
    z-index: 1100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.mobile-navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
}

.mobile-navbar-brand i {
    color: #3498db;
    font-size: 20px;
}

.mobile-navbar-hamburger {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.mobile-navbar-hamburger:hover {
    background: #16213e;
}

/* Slide-in drawer menu mobile (dari kiri, menimpa seluruh tinggi layar) */
.mobile-nav-menu {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 82%;
    height: 100%;
    background: #1a1a2e;
    z-index: 1150;
    box-shadow: 4px 0 18px rgba(0, 0, 0, 0.35);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.mobile-nav-menu.open {
    transform: translateX(0);
}

/* Header profil di dalam drawer */
.mobile-nav-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    border-bottom: 1px solid #2c2c3d;
    position: relative;
}

.mobile-nav-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #3498db;
    flex-shrink: 0;
}

.mobile-nav-userinfo {
    min-width: 0;
    flex-grow: 1;
}

.mobile-nav-name {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-nav-role {
    color: #8a8d99;
    font-size: 12px;
    margin-top: 2px;
}

.mobile-nav-close {
    background: none;
    border: none;
    color: #b0b3b8;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    flex-shrink: 0;
}

.mobile-nav-close:hover {
    color: #fff;
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}

.mobile-nav-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: #b0b3b8;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.mobile-nav-menu a:hover,
.mobile-nav-menu a.active {
    background: #16213e;
    color: #fff;
}

.mobile-nav-menu a i {
    width: 22px;
    text-align: center;
    font-size: 16px;
}

.mobile-nav-menu .nav-divider {
    height: 1px;
    background: #2c2c3d;
    margin: 6px 0;
}

/* Overlay gelap saat drawer terbuka (menutupi seluruh layar) */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1098;
}

.mobile-nav-overlay.active {
    display: block;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* ---------- Tablet (max-width: 900px) ---------- */
@media (max-width: 900px) {
    .dash-row {
        flex-direction: column;
    }

    .summary-cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .filter-row {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .control-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .left-actions,
    .right-actions {
        justify-content: flex-start;
    }
}

/* ---------- Mobile Phone (max-width: 768px) ---------- */
@media (max-width: 768px) {
    /* Tampilkan navbar mobile */
    .mobile-navbar {
        display: flex;
    }

    /* Sembunyikan sidebar desktop */
    .sidebar {
        display: none !important;
    }

    /* Main content full width di mobile */
    main {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 15px;
        padding-top: 72px; /* Ruang untuk navbar mobile (56px + 16px) */
    }

    .sidebar.collapsed ~ main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Dashboard header */
    .dashboard-header h2 {
        font-size: 18px;
    }

    /* Summary cards */
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .summary-card {
        padding: 15px;
    }

    .summary-card i {
        font-size: 24px;
    }

    .summary-card .card-number {
        font-size: 22px;
    }

    .summary-card .card-label {
        font-size: 12px;
    }

    /* Chart */
    .chart-wrapper {
        max-height: 300px;
    }

    .chart-wrapper canvas {
        max-height: 300px;
    }

    /* Tables - horizontal scroll */
    .data-table,
    .kategori-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .data-table th,
    .data-table td,
    .kategori-table th,
    .kategori-table td {
        padding: 8px 10px;
        font-size: 13px;
    }

    /* Buttons */
    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Forms */
    .form-control {
        padding: 8px;
        font-size: 13px;
    }

    /* Filter */
    .filter-container {
        padding: 10px;
    }

    .filter-actions {
        flex-direction: column;
    }

    .filter-actions .btn {
        width: 100%;
    }

    /* Control bar */
    .control-bar {
        flex-direction: column;
        gap: 8px;
    }

    .left-actions,
    .right-actions {
        flex-direction: column;
        width: 100%;
    }

    .left-actions .btn,
    .right-actions .btn {
        width: 100%;
        text-align: center;
    }

    /* Dashboard content */
    .dashboard-content {
        padding: 15px;
    }

    /* Profile */
    .profile-container {
        max-width: 100%;
    }

    .profile-photo {
        width: 100px;
        height: 100px;
    }

    /* Footer */
    .dashboard-footer {
        font-size: 13px;
        padding: 10px;
    }
}

/* ---------- Small Mobile Phone (max-width: 480px) ---------- */
@media (max-width: 480px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }

    .dashboard-header h2 {
        font-size: 16px;
    }

    .dashboard-content h3 {
        font-size: 16px;
    }

    .btn {
        padding: 8px 10px;
        font-size: 12px;
    }

    .data-table th,
    .data-table td,
    .kategori-table th,
    .kategori-table td {
        padding: 6px 8px;
        font-size: 11px;
    }

    .chart-wrapper {
        max-height: 250px;
    }

    .chart-wrapper canvas {
        max-height: 250px;
    }

    main {
        padding: 10px;
        padding-top: 55px;
    }
}