/* ====================================================
   1. IMPORT FONT UTAMA (POPPINS & INTER)
   ==================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Poppins:wght@500;600;700&display=swap');

/* ====================================================
   2. VARIABEL WARNA & TEMA (SAAS BLUE & ELEGANT WHITE)
   ==================================================== */
:root {
    --color-primary: #2563eb;       /* Biru Utama (Royal SaaS Blue) */
    --color-primary-hover: #1d4ed8; /* Biru Gelap saat Tombol Disorot */
    --color-navy: #1e293b;          /* Warna Navy untuk Header/Sidebar */
    --color-bg: #f8fafc;            /* Latar Belakang Layar */
    --color-surface: #ffffff;       /* Kartu / Panel Putih */
    --color-border: #e2e8f0;        /* Garis Pembatas Lembut */
    --color-text-main: #0f172a;     /* Teks Utama */
    --color-text-muted: #64748b;    /* Teks Sekunder / Keterangan */
    --color-success: #10b981;       /* Hijau untuk Aksi Berhasil */
    --color-danger: #ef4444;        /* Merah untuk Hapus/Batal */
    --color-warning: #f59e0b;      /* Kuning/Oranye untuk Edit */

    --font-ui-heading: 'Poppins', sans-serif;
    --font-ui-body: 'Inter', sans-serif;
    --font-document: 'Calibri', 'Arial', sans-serif; /* Khusus Kertas Hasil AI */
}

/* ====================================================
   3. BASE STYLES APLIKASI
   ==================================================== */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-ui-body);
    background-color: var(--color-bg);
    color: var(--color-text-main);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, .btn, .step-btn, .tab-btn {
    font-family: var(--font-ui-heading);
}

/* Header Utama Aplikasi */
.header {
    background-color: var(--color-navy);
    color: #ffffff;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.header h1, .header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Kartu / Container UI */
.card, .container {
    background: var(--color-surface);
    border-radius: 10px;
    border: 1px solid var(--color-border);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

/* ====================================================
   4. TOMBOL & FORMULIR MODERN
   ==================================================== */
.btn {
    padding: 9px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-primary { background-color: var(--color-primary); color: white; }
.btn-primary:hover { background-color: var(--color-primary-hover); }

.btn-success { background-color: var(--color-success); color: white; }
.btn-warning { background-color: var(--color-warning); color: white; }
.btn-danger { background-color: var(--color-danger); color: white; }

.form-group {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: var(--font-ui-body);
    background-color: #ffffff;
    transition: border-color 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ====================================================
   5. TABEL APLIKASI SAAS (ADMIN & DASHBOARD)
   ==================================================== */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-top: 10px;
}

th, td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

th {
    background-color: #f1f5f9;
    color: var(--color-navy);
    font-weight: 600;
    font-family: var(--font-ui-heading);
    font-size: 13px;
}

tr:hover {
    background-color: #f8fafc;
}

/* ====================================================
   6. LEMBAR KERTAS HASIL AI (PAPER CANVAS A4)
   ==================================================== */
.paper-canvas {
    background: #ffffff;
    width: 100%;
    max-width: 210mm; /* Standar Lebar A4 Portrait */
    min-height: 297mm; /* Standar Tinggi A4 Portrait */
    margin: 0 auto;
    padding: 20mm; /* Margin Resmi Dokumen */
    border: 1px solid var(--color-border);
    box-shadow: 0 10px 25px rgba(0,0,0,0.06);
    border-radius: 4px;
    transition: all 0.3s ease;
    
    /* Font Dokumen Resmi Kemendikbud */
    font-family: var(--font-document);
    font-size: 11pt;
    line-height: 1.6;
    color: #000000;
}

/* Mode Kertas Landscape (Khusus Matriks Banyak Kolom seperti ATP) */
.paper-canvas.landscape {
    max-width: 297mm; /* Lebar A4 Landscape */
    min-height: 210mm; /* Tinggi A4 Landscape */
}

/* Tabel di Dalam Dokumen Resmi */
.paper-canvas table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.paper-canvas th, .paper-canvas td {
    border: 1px solid #000000;
    padding: 8px 10px;
    font-size: 11pt;
}

.paper-canvas th {
    background-color: #e2e8f0;
    font-weight: bold;
    text-align: center;
}

/* Kolom Tanda Tangan Resmi (TTD) */
.signature-container {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    page-break-inside: avoid;
}

.signature-box {
    text-align: center;
    width: 45%;
}

.signature-space {
    height: 70px;
}

/* ====================================================
   7. FITUR CETAK KERTAS (@MEDIA PRINT & PAGE SETTING)
   ==================================================== */
@page {
    size: A4 portrait;
    margin: 15mm 20mm;
}

@media print {
    .header, .sidebar, .toolbar-actions, .stepper, .card, button, #modalProyek, #modalUploadGuru {
        display: none !important;
    }

    body {
        background: #ffffff !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .paper-canvas {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        font-size: 11pt !important;
        line-height: 1.5 !important;
    }

    table {
        page-break-inside: auto;
    }
    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}

/* ====================================================
   8. DUKUNGAN RESPONSIVE MOBILE & TABLET
   ==================================================== */
@media (max-width: 768px) {
    .layout {
        flex-direction: column;
        height: auto;
    }

    .sidebar {
        width: 100% !important;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        max-height: 200px;
    }

    .workspace-grid {
        grid-template-columns: 1fr !important;
    }

    .stepper {
        flex-wrap: wrap;
    }
    
    .step-btn {
        flex: 1 1 45%;
        font-size: 12px;
        padding: 8px;
    }

    .paper-canvas {
        padding: 15px;
        font-size: 10pt;
    }

    .header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* ====================================================
   9. LAYOUT ADMIN & WORKSPACE 2 KOLOM (SAAS STANDAR)
   ==================================================== */
body, html { 
    margin: 0; 
    padding: 0; 
    height: 100%; 
    font-family: var(--font-ui-body); 
    background-color: var(--color-bg); 
}

.admin-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.admin-sidebar {
    width: 260px;
    background-color: var(--color-navy);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-height: 100vh;
}

.admin-sidebar-logo {
    padding: 22px 20px;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    letter-spacing: 0.5px;
}

.admin-menu {
    flex: 1;
    padding: 15px 0;
}

.admin-menu-item {
    display: block;
    padding: 12px 20px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.admin-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.admin-menu-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-left-color: var(--color-primary);
    font-weight: 600;
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--color-bg);
}

.admin-topbar {
    height: 65px;
    background: #ffffff;
    padding: 0 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.admin-content {
    padding: 25px;
    flex: 1;
}

.tab-box { 
    display: flex; 
    gap: 10px; 
    margin-bottom: 20px; 
    border-bottom: 2px solid var(--color-border); 
    padding-bottom: 10px; 
}

.tab-btn { 
    padding: 9px 18px; 
    background: #e2e8f0; 
    border: none; 
    border-radius: 6px; 
    font-weight: 600; 
    cursor: pointer; 
    color: var(--color-navy); 
}

.tab-btn.active { 
    background: var(--color-primary); 
    color: white; 
}

/* SUBMENU PENGATURAN */
.admin-menu-group {
    padding: 12px 20px 4px 20px;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-menu-subitem {
    display: block;
    padding: 8px 20px 8px 35px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.admin-menu-subitem:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.admin-menu-subitem.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-left-color: var(--color-primary);
    font-weight: 600;
}
