/* ==========================================================================
   STYLE CSS: SISTEM KTA SMP NEGERI 1 KEPOHBARU (CPANEL HOSTING READY)
   Clean, Modern, Responsive, Typography & Dashboard UI
   ========================================================================== */

:root {
    --primary: #0b2545;
    --primary-light: #134074;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --sidebar-width: 250px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--accent-hover);
}

/* App Container Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
}

.sidebar-toggle:hover {
    background: #f1f5f9;
}

.school-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.school-logo-frame {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-contain: contain;
}

.brand-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
    letter-spacing: -0.2px;
}

.brand-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 4px 12px 4px 6px;
    border-radius: 30px;
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3a68, #2563eb);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.user-role {
    font-size: 10px;
    font-weight: 600;
}

.badge-super_admin { color: #1d4ed8; }
.badge-operator { color: #047857; }
.badge-kepala_sekolah { color: #7e22ce; }

.btn-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    color: var(--danger);
    background: #fef2f2;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #fee2e2;
    transition: background 0.15s ease;
}

.btn-logout:hover {
    background: #fee2e2;
}

/* App Body Layout */
.app-body {
    display: flex;
    flex: 1;
}

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px 12px;
    flex-shrink: 0;
}

.sidebar-section-title {
    font-size: 10px;
    font-weight: 800;
    color: #94a3b8;
    letter-spacing: 0.8px;
    padding: 8px 12px 4px 12px;
    margin-top: 10px;
}

.sidebar-section-title:first-child {
    margin-top: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.15s ease;
}

.nav-item:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.nav-item.active {
    background: #eff6ff;
    color: var(--accent);
}

.badge-ext {
    margin-left: auto;
    font-size: 9px;
    font-weight: 700;
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 6px;
    border-radius: 4px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px 8px 0 8px;
    border-top: 1px solid #f1f5f9;
}

.cpanel-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #64748b;
    background: #f8fafc;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.dot-online {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Main Content */
.app-content {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    overflow-x: hidden;
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 500;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

/* Page Header */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.3px;
}

.page-description {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
}

.btn-secondary {
    background: #fff;
    border-color: var(--border-color);
    color: #334155;
}

.btn-secondary:hover {
    background: #f8fafc;
}

.btn-success {
    background: #059669;
    color: #fff;
}

.btn-success:hover {
    background: #047857;
    color: #fff;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
    color: #fff;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* Cards & Surfaces */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

.card-body {
    padding: 20px;
}

/* Dashboard Banner */
.dash-banner {
    background: linear-gradient(135deg, #0b2545 0%, #134074 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.banner-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.banner-logo-wrap {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid rgba(255, 255, 255, 0.9);
    padding: 4px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.banner-logo {
    width: 100%;
    height: 100%;
    object-contain: contain;
}

.banner-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #93c5fd;
}

.banner-school-name {
    font-size: 22px;
    font-weight: 800;
    margin-top: 2px;
    line-height: 1.2;
}

.banner-meta {
    font-size: 12px;
    color: #cbd5e1;
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Stats KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.kpi-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-main);
    margin: 8px 0 4px 0;
    font-feature-settings: "tnum";
}

.kpi-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-neutral { background: #f1f5f9; color: #475569; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* Filter Bar */
.filter-bar {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.filter-input {
    padding: 7px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    transition: border 0.15s ease;
}

.filter-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-search {
    flex: 1;
    min-width: 200px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-main);
    background: #fff;
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Student Photo Preview */
.photo-avatar {
    width: 40px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
}

.photo-placeholder {
    width: 40px;
    height: 50px;
    border-radius: 4px;
    background: #f1f5f9;
    border: 1px dashed #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 10px;
    text-align: center;
}

/* KTA Card Preview (Sesuai Referensi Gambar) */
.kta-card-preview {
    width: 340px;
    height: 215px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #cbd5e1;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.kta-header {
    background: #122647;
    color: #fff;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.kta-emblem-wrap {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.kta-emblem-wrap img {
    width: 100%;
    height: 100%;
    object-contain: contain;
}

.kta-header-text {
    flex: 1;
    text-align: center;
}

.kta-school-name {
    font-family: 'Cinzel', serif;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1.1;
}

.kta-school-addr {
    font-size: 7.5px;
    color: #e2e8f0;
    margin-top: 2px;
}

.kta-body {
    flex: 1;
    display: flex;
    padding: 8px 12px;
    gap: 12px;
    position: relative;
    z-index: 2;
}

.kta-left {
    width: 75px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.kta-photo-box {
    width: 70px;
    height: 90px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    overflow: hidden;
    background: #f8fafc;
}

.kta-photo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kta-barcode-box {
    margin-top: 6px;
    width: 100%;
}

.kta-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.kta-title {
    font-size: 11px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 2px solid #2563eb;
    padding-bottom: 2px;
    margin-bottom: 4px;
}

.kta-bio-row {
    display: flex;
    font-size: 9px;
    line-height: 1.35;
    margin-bottom: 2px;
}

.kta-bio-label {
    width: 60px;
    color: #475569;
    font-weight: 600;
}

.kta-bio-val {
    flex: 1;
    color: #0f172a;
    font-weight: 700;
}

.kta-footer-sign {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-top: auto;
}

.kta-qr-box {
    width: 42px;
    height: 42px;
    background: #fff;
    padding: 2px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}

.kta-sign-block {
    text-align: center;
    font-size: 7.5px;
    line-height: 1.2;
}

.kta-sign-title {
    color: #475569;
}

.kta-sign-name {
    font-weight: 800;
    color: #0f172a;
    text-decoration: underline;
    margin-top: 16px;
}

.kta-sign-nip {
    font-size: 6.5px;
    color: #64748b;
}

/* Public Verification Portal */
.verify-container {
    max-width: 680px;
    margin: 40px auto;
    padding: 0 16px;
}

.verify-card {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 32px;
    text-align: center;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 99;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.open {
    display: flex;
}

.modal-dialog {
    background: #fff;
    border-radius: var(--radius-md);
    max-width: 550px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 15px;
    font-weight: 700;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: #f8fafc;
}

/* Responsive */
@media (max-width: 900px) {
    .sidebar-toggle {
        display: block;
    }

    .app-sidebar {
        position: fixed;
        left: -100%;
        top: var(--header-height);
        bottom: 0;
        z-index: 50;
        box-shadow: var(--shadow-lg);
        transition: left 0.25s ease;
    }

    .app-sidebar.open {
        left: 0;
    }

    .hide-mobile {
        display: none;
    }
}
