/* style.css - Luxury CSS Theme for SKP Penyuluh Agama Islam */
@import url('../fonts/plus-jakarta-sans/font.css');

:root {
    --primary: #0f5132;
    --primary-light: #198754;
    --primary-dark: #093420;
    --accent: #d97706;
    --accent-light: #f59e0b;
    --accent-dark: #b45309;
    --bg-main: #f0f4f1;
    --bg-dark: #121814;
    --card-bg: #ffffff;
    --card-bg-dark: #18221c;
    --text-main: #212529;
    --text-muted: #6c757d;
    --text-light: #f8f9fa;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-color-dark: rgba(255, 255, 255, 0.06);
    --shadow: 0 10px 30px rgba(15, 81, 50, 0.05);
    --shadow-hover: 0 15px 40px rgba(15, 81, 50, 0.12);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Overrides */
body.dark-mode {
    --bg-main: #0c100e;
    --card-bg: #151c18;
    --text-main: #e9ecef;
    --text-muted: #adb5bd;
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    transition: var(--transition);
}

/* Scrollbar Style */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* App Layout */
.app-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, var(--primary-dark) 0%, #051a10 100%);
    color: var(--text-light);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: var(--transition);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 40px;
    padding: 0 10px;
}

.sidebar-logo img {
    height: 45px;
    width: auto;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

.sidebar-logo h1 {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #ffffff, var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

/* Custom Scrollbar for Sidebar */
.sidebar-menu::-webkit-scrollbar {
    width: 5px;
}
.sidebar-menu::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}
.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 15px;
    color: rgba(255, 255, 255, 0.7);
    padding: 14px 18px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
}

.sidebar-menu a i {
    font-size: 18px;
}

.sidebar-menu a:hover, .sidebar-menu li.active a {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 3px 0 0 var(--accent-light);
}

.sidebar-menu li.active a {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.02) 100%);
    color: #ffffff;
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px 10px 0 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    object-fit: cover;
}

.user-badge-info h4 {
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.user-badge-info span {
    font-size: 11px;
    color: var(--text-muted);
}

/* Main Content Area */
.main-layout {
    flex: 1;
    margin-left: 280px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

/* Header */
.main-header {
    background: var(--card-bg);
    padding: 20px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 90;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.page-title h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.page-title p {
    font-size: 13px;
    color: var(--text-muted);
}

body.dark-mode .page-title h2 {
    color: var(--accent-light);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Quick Tools Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(25, 135, 84, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(25, 135, 84, 0.3);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(217, 119, 6, 0.2);
}

.btn-accent:hover {
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: var(--text-muted);
}

body.dark-mode .btn-outline:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Theme Toggle Button */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--primary-light);
    color: white;
}

/* Page Content */
.content-body {
    padding: 40px;
    flex: 1;
}

/* Grid Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 25px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 5px;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    background: rgba(25, 135, 84, 0.08);
    color: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    transition: var(--transition);
}

.stat-card:hover .stat-icon {
    background: var(--primary);
    color: white;
}

/* Luxury Form Card */
.card-luxury {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 30px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    margin-bottom: 45px;
}

.card-header-luxury {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 25px;
}

.card-header-luxury h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

body.dark-mode .card-header-luxury h3 {
    color: var(--accent-light);
}

/* Table Style */
.table-responsive {
    overflow-x: auto;
    margin-top: 15px;
}

.table-luxury {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table-luxury th {
    background-color: rgba(15, 81, 50, 0.05);
    color: var(--primary-dark);
    padding: 16px 20px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-color);
}

body.dark-mode .table-luxury th {
    background-color: rgba(217, 119, 6, 0.05);
    color: var(--accent-light);
}

.table-luxury td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-main);
}

.table-luxury tr:last-child td {
    border-bottom: none;
}

.table-luxury tr:hover td {
    background-color: rgba(15, 81, 50, 0.01);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 14px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.15);
}

/* Generator Section */
.generator-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
}

.generator-sidebar {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 25px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    height: fit-content;
}

.generator-preview {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    padding: 28px;
    min-height: 640px;
    color: var(--text-main);
    position: relative;
    overflow: auto;
}

.generator-preview #print-sheet {
    width: 100%;
    background: var(--bg-main);
    border-radius: var(--radius-md);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04);
    padding: 24px;
    min-height: 720px;
    box-sizing: border-box;
}

.generator-preview .doc-sheet {
    margin-bottom: 24px;
}

/* Print/Document Styles inside preview */
.doc-sheet {
    width: auto;
    max-width: 190mm;
    min-height: 297mm;
    margin: 0 auto;
    background: #ffffff;
    color: #000000;
    box-sizing: border-box;
    font-family: 'Times New Roman', Times, serif;
    padding: 20mm 15mm 20mm 20mm; /* standard left margin larger for binding */
}

.doc-header {
    border-bottom: 3px double #000000;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.doc-header h2 {
    font-size: 15px;
    font-weight: 700;
    margin: 2px 0;
}

.doc-header h3 {
    font-size: 13px;
    font-weight: 700;
    margin: 2px 0;
}

.doc-header p {
    font-size: 11px;
    margin: 2px 0;
    font-style: italic;
}

.doc-title {
    text-align: center;
    font-weight: 700;
    text-decoration: underline;
    font-size: 14px;
    margin-top: 15px;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.doc-subtitle {
    text-align: center;
    font-size: 12px;
    margin-bottom: 25px;
    font-weight: 700;
}

.doc-meta {
    font-size: 12px;
    margin-bottom: 15px;
    line-height: 1.5;
}

.doc-meta {
    width: 90%;
    margin: 10px 0 20px 20px;
    border-collapse: collapse;
}

.doc-meta td {
    padding: 4px 8px;
    font-size: 13px;
    vertical-align: top;
}

.doc-meta td.label-cell {
    width: 25%;
    font-weight: 700;
}

.doc-meta td.colon-cell {
    width: 3%;
}

.doc-meta td.val-cell {
    width: auto;
}

.section-title {
    font-size: 14px;
    font-weight: 700;
    margin: 18px 0 8px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 4px;
    color: #333;
}

.desc-text {
    font-size: 13px;
    text-align: justify;
    line-height: 1.6;
    margin: 5px 0 15px 20px;
}

.solution-box {
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 13.5px;
    text-align: justify;
    line-height: 1.6;
    color: #2c3e50;
    background: #fcfbf7;
    border-left: 3px solid #d97706;
    padding: 12px 18px;
    margin: 8px 0 20px 20px;
}

.doc-table-print {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.doc-table-print th, .doc-table-print td {
    border: 1px solid #000000 !important;
    padding: 6px 8px;
    font-size: 11px;
    color: #000000 !important;
}

.doc-table-print th {
    text-align: center;
    font-weight: 700;
    background-color: #f2f2f2 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.doc-signatures {
    margin-top: 40px;
    width: 100% !important;
    border-collapse: collapse;
    font-size: 12px;
    page-break-inside: avoid;
}

.doc-signatures td {
    vertical-align: top;
}

.sig-left {
    text-align: left;
}

.sig-right {
    text-align: right;
}

.doc-signatures .sig-space {
    height: 80px;
    position: relative;
    width: 150px;
}

.sig-left .sig-space {
    margin: 5px auto 5px 0;
}

.sig-right .sig-space {
    margin: 5px 0 5px auto;
    transform: translate(var(--sig-left-x, 0px), var(--sig-left-y, 0px));
}

.doc-signatures .sig-right .sig-space {
    margin: 5px 0 5px auto;
    transform: translate(var(--sig-right-x, 0px), var(--sig-right-y, 0px));
}

.doc-signatures .sig-space img.ttd-img {
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
}

.doc-signatures .sig-space img.cap-img {
    height: 70px;
    position: absolute;
    top: 5px;
    opacity: 0.85;
    mix-blend-mode: multiply;
    transform: translate(var(--cap-x, 0px), var(--cap-y, 0px));
}

.sig-left img.ttd-img {
    left: 0;
}

.sig-right img.ttd-img {
    right: 0;
}

.sig-left img.cap-img {
    left: -15px;
}

.sig-right img.cap-img {
    right: -15px;
}

/* SKP Specific Print Formats */
.skp-title-box {
    border: 1px solid #000;
    text-align: center;
    padding: 10px;
    font-weight: 700;
    margin-bottom: 20px;
    font-size: 14px;
}

.skp-meta-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.skp-meta-table td {
    border: 1px solid #000;
    padding: 6px;
    font-size: 11px;
}

.skp-meta-table td.header-sec {
    background-color: #e6e6e6;
    font-weight: 700;
    text-align: center;
    width: 50%;
}

/* Responsive adjust */
@media (max-width: 992px) {
    .sidebar {
        width: 80px;
        padding: 20px 10px;
    }
    .sidebar-logo h1, .user-badge-info {
        display: none;
    }
    .sidebar-menu a span {
        display: none;
    }
    .main-layout {
        margin-left: 80px;
    }
    .generator-grid {
        grid-template-columns: 1fr;
    }
}

/* Page Break Divider in Browser */
.page-break-divider {
    text-align: center;
    margin: 20px auto 40px auto;
    width: 210mm;
    border-top: 1px dashed #d97706;
    color: #b45309;
    font-size: 12px;
    font-weight: bold;
    position: relative;
}
.page-break-divider::after {
    content: 'Batas Halaman Kertas A4';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-main);
    padding: 0 15px;
}

/* Print Overrides */
@media print {
    @page {
        size: A4;
        margin: 0;
    }
    html, body {
        margin: 0;
        padding: 0;
        background: #ffffff !important;
        color: #000000 !important;
    }
    .no-print {
        display: none !important;
    }
    .generator-sidebar,
    .sidebar,
    .main-header,
    .content-body,
    .main-layout {
        display: none !important;
    }
    .generator-preview {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: #ffffff !important;
    }
    .doc-sheet {
        box-shadow: none !important;
        border: none !important;
        padding: 20mm 15mm 20mm 20mm !important;
        margin: 0 auto !important;
        width: auto !important;
        max-width: 190mm !important;
        min-height: 297mm !important;
        box-sizing: border-box !important;
        page-break-after: auto !important;
        page-break-inside: avoid !important;
        page-break-before: avoid !important;
    }
    .doc-sheet:not(:last-of-type) {
        page-break-after: always !important;
    }
    .doc-table-print th,
    .doc-table-print td {
        border: 1px solid #000 !important;
    }
    .doc-table-print th {
        background: #f2f2f2 !important;
    }
    .doc-meta td {
        padding: 2px 5px !important;
    }
}

