/* Reset & Base / Reset dan Dasar */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Variabel tema Nature Tech / Nature Tech theme variables */
:root {
    /* Warna utama biru / Primary blue colors */
    --blue-primary:   #2563eb;
    --blue-dark:      #1d4ed8;
    --blue-deeper:    #1e3a8a;
    --blue-light:     #93c5fd;
    --blue-soft:      #dbeafe;

    /* Warna aksen hijau / Green accent colors */
    --green-primary:  #10b981;
    --green-dark:     #059669;
    --green-light:    #6ee7b7;
    --green-soft:     #d1fae5;

    /* Warna netral / Neutral colors */
    --white:          #ffffff;
    --surface:        #f0fdf4;   /* latar belakang halaman / page background */
    --card-bg:        #ffffff;
    --border:         #e2e8f0;
    --border-focus:   #2563eb;
    --text-primary:   #0f172a;
    --text-secondary: #475569;
    --text-muted:     #94a3b8;

    /* Status / Status colors */
    --success:        #10b981;
    --warning:        #f59e0b;
    --danger:         #ef4444;

    /* Bayangan / Shadows */
    --shadow-sm:  0 1px 3px rgba(37, 99, 235, 0.08);
    --shadow-md:  0 4px 16px rgba(37, 99, 235, 0.10);
    --shadow-lg:  0 8px 32px rgba(37, 99, 235, 0.14);

    /* Utilitas / Utilities */
    --radius:     12px;
    --radius-sm:  8px;
    --transition: 0.2s ease;
}

/* ============================================================
   BASE
   ============================================================ */

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--surface);
    min-height: 100vh;
    color: var(--text-primary);
    /* Tidak ada animasi berat / No heavy animations */
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================================
   HEADER
   ============================================================ */

.header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--blue-primary);
    letter-spacing: -0.3px;
}

.logo i { font-size: 1.5rem; color: var(--green-primary); }

.nav {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}

.nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: color var(--transition);
}

.nav a:hover { color: var(--blue-primary); }

.btn-logout {
    background: var(--danger);
    color: var(--white);
    border: none;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background var(--transition);
}

.btn-logout:hover { background: #dc2626; }

/* ============================================================
   MODAL LOGIN
   ============================================================ */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 400px;
    border-top: 4px solid var(--blue-primary);
}

.modal-content h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--blue-primary);
    font-size: 1.25rem;
}

.input-group {
    position: relative;
    margin-bottom: 1rem;
}

.input-group i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: 11px 14px 11px 40px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--white);
    transition: border-color var(--transition);
}

.input-group input:focus {
    outline: none;
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-primary {
    width: 100%;
    background: var(--blue-primary);
    color: var(--white);
    border: none;
    padding: 11px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
    margin-bottom: 1rem;
}

.btn-primary:hover { background: var(--blue-dark); }

.security-info {
    text-align: center;
    color: var(--green-primary);
    font-size: 0.82rem;
    font-weight: 500;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.main-content {
    padding: 1.75rem 0 2.5rem;
    min-height: calc(100vh - 130px);
}

/* ============================================================
   BENTO GRID
   ============================================================ */

.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

/* Kartu bento / Bento card */
.bento-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    /* Hover ringan tanpa animasi berat / Light hover without heavy animation */
    transition: box-shadow var(--transition), border-color var(--transition);
}

.bento-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--blue-light);
}

/* Garis aksen atas kartu / Card top accent line */
.bento-card::before {
    content: '';
    display: block;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(90deg, var(--blue-primary), var(--green-primary));
    margin: -1.5rem -1.5rem 1.25rem;
    border-radius: var(--radius) var(--radius) 0 0;
}

.bento-card h3 {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.2px;
}

.bento-card h3 i { color: var(--blue-primary); }

/* ============================================================
   UPLOAD CARD
   ============================================================ */

.upload-card { grid-column: span 2; }

.upload-area {
    border: 2px dashed var(--blue-light);
    border-radius: var(--radius-sm);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    background: var(--blue-soft);
    transition: border-color var(--transition), background var(--transition);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--blue-primary);
    background: #eff6ff;
}

.upload-content i {
    font-size: 2.5rem;
    color: var(--blue-primary);
    margin-bottom: 0.75rem;
    display: block;
}

.upload-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.btn-upload {
    background: var(--blue-primary);
    color: var(--white);
    border: none;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background var(--transition);
    margin-top: 0.5rem;
}

.btn-upload:hover { background: var(--blue-dark); }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */

.form-select,
.form-input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--white);
    transition: border-color var(--transition);
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.btn-secondary {
    background: var(--green-primary);
    color: var(--white);
    border: none;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background var(--transition);
}

.btn-secondary:hover { background: var(--green-dark); }

/* ============================================================
   FILE LIST
   ============================================================ */

.file-list {
    max-height: 300px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 8px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.file-item:hover { background: var(--surface); }

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-info i { color: var(--blue-primary); }

.file-name { font-size: 0.875rem; font-weight: 500; }

.file-meta { font-size: 0.78rem; color: var(--text-muted); }

.file-actions { display: flex; gap: 5px; }

.btn-small {
    padding: 4px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    transition: opacity var(--transition);
}

.btn-small:hover { opacity: 0.85; }

.btn-view   { background: var(--blue-soft);  color: var(--blue-primary); }
.btn-rename { background: #fef3c7;            color: #92400e; }
.btn-delete { background: #fee2e2;            color: #991b1b; }

/* ============================================================
   SYSTEM MONITOR
   ============================================================ */

.system-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.stat-item i { color: var(--blue-primary); width: 18px; }

.stat-item span:first-of-type {
    width: 55px;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-bar {
    flex: 1;
    height: 7px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--blue-primary), var(--green-primary));
    border-radius: 99px;
    transition: width 0.4s ease;
}

.stat-item span:last-child {
    width: 38px;
    text-align: right;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ============================================================
   DBSM HIERARCHY
   ============================================================ */

.hierarchy-card { grid-column: span 2; }

.hierarchy-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hierarchy-info {
    margin-top: 0.75rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: none;
}

.hierarchy-info.active { display: block; }

.hierarchy-path {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.8rem;
    background: var(--white);
    padding: 7px 10px;
    border-radius: 6px;
    margin: 4px 0;
    border-left: 3px solid var(--blue-primary);
    color: var(--text-secondary);
}

.current-hierarchy {
    padding: 10px 12px;
    background: var(--blue-soft);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--blue-primary);
    font-size: 0.875rem;
}

.current-hierarchy.active {
    background: var(--green-soft);
    border-left-color: var(--green-primary);
}

.current-hierarchy p { margin-bottom: 3px; color: var(--text-secondary); }
.current-hierarchy strong { color: var(--text-primary); }
.current-hierarchy code {
    font-size: 0.78rem;
    background: var(--white);
    padding: 1px 5px;
    border-radius: 4px;
    color: var(--blue-primary);
}

/* ============================================================
   DATABASE EXPLORER
   ============================================================ */

.explorer-card { grid-column: span 1; }

.db-tree {
    margin-top: 0.75rem;
    max-height: 380px;
    overflow-y: auto;
}

.tree-node {
    margin-left: 16px;
    border-left: 1.5px solid var(--border);
    padding-left: 10px;
    margin-bottom: 3px;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 7px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: background var(--transition);
}

.tree-item:hover { background: var(--surface); }

.tree-item.jurusan { font-weight: 700; color: var(--blue-primary); }
.tree-item.kelas   { color: var(--green-dark); font-weight: 600; }
.tree-item.creator { color: var(--text-secondary); }

.tree-toggle {
    cursor: pointer;
    user-select: none;
    width: 14px;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.tree-children         { display: none; }
.tree-children.expanded { display: block; }

.db-stats {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
    background: var(--surface);
    padding: 1px 6px;
    border-radius: 99px;
}

/* ============================================================
   PROJECT MANAGEMENT
   ============================================================ */

.project-card { grid-column: span 2; }

.project-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.project-list {
    max-height: 220px;
    overflow-y: auto;
    margin-top: 0.75rem;
}

.project-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: var(--surface);
    transition: border-color var(--transition);
}

.project-item:hover { border-color: var(--blue-light); }

.project-info h4 {
    margin: 0 0 3px;
    color: var(--blue-primary);
    font-size: 0.9rem;
}

.project-info p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.project-url {
    font-family: 'Consolas', monospace;
    font-size: 0.75rem;
    background: var(--blue-soft);
    color: var(--blue-primary);
    padding: 1px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 3px;
}

.project-actions { display: flex; gap: 5px; flex-shrink: 0; }

/* ============================================================
   QR VERIFICATION
   ============================================================ */

.qr-scanner { margin-bottom: 1rem; }

.verification-result {
    margin-top: 0.75rem;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    display: none;
}

.verification-result.success {
    background: var(--green-soft);
    border: 1px solid var(--green-primary);
    color: var(--green-dark);
    display: block;
}

.verification-result.error {
    background: #fee2e2;
    border: 1px solid var(--danger);
    color: #991b1b;
    display: block;
}

.verification-result pre {
    font-family: inherit;
    white-space: pre-wrap;
    font-size: 0.82rem;
}

.qr-container {
    min-height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.qr-display {
    text-align: center;
    padding: 1rem;
    width: 100%;
}

.qr-display h4 {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.qr-info {
    margin-top: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-align: left;
}

.qr-info p { margin-bottom: 3px; }
.qr-info strong { color: var(--blue-primary); }

/* ============================================================
   UPLOAD RESULTS
   ============================================================ */

.results-list {
    max-height: 300px;
    overflow-y: auto;
}

.result-item {
    padding: 9px 8px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.result-link {
    color: var(--blue-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.result-link:hover { text-decoration: underline; }

.result-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.no-results {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-size: 0.875rem;
}

/* ============================================================
   FOOTER
   ============================================================ */

.footer {
    background: var(--white);
    padding: 0.875rem 0;
    border-top: 1px solid var(--border);
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.security-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--green-primary);
    font-weight: 600;
    font-size: 0.82rem;
}

/* ============================================================
   MESSAGES / NOTIFIKASI
   ============================================================ */

.message {
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    margin: 8px 0;
    font-size: 0.875rem;
    font-weight: 500;
}

.message.success {
    background: var(--green-soft);
    color: var(--green-dark);
    border: 1px solid var(--green-light);
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.message.warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */

.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   SCROLLBAR KUSTOM / Custom scrollbar
   ============================================================ */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb {
    background: var(--blue-light);
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--blue-primary); }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .bento-grid { grid-template-columns: 1fr; }

    .upload-card,
    .hierarchy-card,
    .project-card { grid-column: span 1; }

    .header .container {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 20px;
    }

    .nav { gap: 1rem; flex-wrap: wrap; justify-content: center; }

    .footer .container {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}
