:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f1f5f9;
    --sidebar-bg: rgba(255, 255, 255, 0.8);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --paper-bg: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    color: var(--primary);
    font-weight: 700;
}

.sidebar-header p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.sidebar-search {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-search input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
    background: rgba(255, 255, 255, 0.5);
}

.sidebar-search input:focus {
    border-color: var(--primary);
    background: #fff;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.nav-category {
    margin-bottom: 16px;
}

.nav-category-title {
    padding: 8px 24px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--text-muted);
}

.nav-item {
    display: block;
    padding: 8px 24px 8px 32px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text-main);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary);
}

.nav-item.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    height: 72px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 5;
}

.topbar-info h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    background: #e0e7ff;
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

/* Document Workspace */
.document-workspace {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    display: flex;
    justify-content: center;
    background-color: #cbd5e1;
}

/* A4 Paper setup */
.a4-paper {
    background: var(--paper-bg);
    width: 210mm;
    min-height: 297mm;
    padding: 20mm;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.document-header {
    width: 100%;
    margin-bottom: 20px;
}

.kop-surat {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-bottom: 3px solid #000;
    padding-bottom: 10px;
}

.document-body {
    flex: 1;
    outline: none;
    font-size: 11pt; /* Standard formal font size */
    color: #000;
}

.document-body h1, .document-body h2, .document-body h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: #000;
}

.document-body h1 { font-size: 16pt; text-align: center; }
.document-body h2 { font-size: 14pt; }
.document-body h3 { font-size: 12pt; }

.document-body p {
    margin-bottom: 1em;
    text-align: justify;
}

.document-body ul, .document-body ol {
    margin-left: 2em;
    margin-bottom: 1em;
}

.document-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
}

.document-body th, .document-body td {
    border: 1px solid #000;
    padding: 8px;
    text-align: left;
}

.document-footer {
    margin-top: 40px;
    width: 100%;
    display: flex;
    justify-content: flex-end;
}

.signature-area {
    width: 250px;
    text-align: center;
    color: #000;
}

.welcome-screen {
    text-align: center;
    color: var(--text-muted);
    margin-top: 100px;
}

/* 
 * PRINT STYLES
 * Crucial for generating clean PDFs
 */
@media print {
    @page {
        size: A4;
        margin: 0; /* Let the paper handle margins */
    }

    body, html {
        background: #fff;
        height: auto;
        overflow: visible;
    }

    .no-print, .sidebar, .topbar {
        display: none !important;
    }

    .app-container {
        display: block;
        height: auto;
    }

    .main-content {
        display: block;
        overflow: visible;
    }

    .document-workspace {
        padding: 0;
        background: none;
        display: block;
    }

    .a4-paper {
        margin: 0;
        padding: 20mm;
        box-shadow: none;
        border-radius: 0;
        width: 100%;
        min-height: 100vh;
    }

    .document-body {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .page-break {
        page-break-before: always;
    }
}

