/* =========================================================
   Generator Absensi dan Berita Acara Ujian - SMK Negeri 1 Klungkung
   Stylesheet Terpadu (Mobile-First, Modern & Formal)
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #0f4c81;
    --primary-hover: #0c3b64;
    --primary-light: #e8f1f8;
    --accent: #d97706;
    --accent-light: #fef3c7;
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #ca8a04;
    --warning-light: #fef9c3;
    --info: #0284c7;
    --info-light: #e0f2fe;
    
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--slate-900);
    font-weight: 700;
    line-height: 1.25;
}

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

/* Top Navbar */
.navbar {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.65rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    display: flex;
    align-items: center;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.navbar-logo {
    height: 42px;
    width: 42px;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--slate-900);
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: normal;
}

.mobile-nav-toggle {
    display: none;
    background: var(--slate-100);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.65rem;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: var(--slate-700);
    transition: background 0.15s;
}

.mobile-nav-toggle:hover {
    background: var(--slate-200);
}

.admin-mobile-toggle {
    display: none;
    background: var(--slate-100);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.65rem;
    font-size: 1.15rem;
    cursor: pointer;
    color: var(--slate-700);
    margin-right: 0.5rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    font-size: 0.925rem;
    font-weight: 500;
    color: var(--slate-600);
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    text-decoration: none;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
    background-color: var(--primary-light);
}

/* Responsif Mobile untuk HP */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 1rem;
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    /* Hilangkan nama aplikasi di HP, cukup pasang logo saja */
    .brand-text {
        display: none !important;
    }

    .navbar-logo {
        height: 38px;
        width: 38px;
    }

    .mobile-nav-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 1.4rem;
        line-height: 1;
        padding: 0.45rem 0.75rem;
        background: #f8fafc;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        cursor: pointer;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #ffffff;
        border-bottom: 2px solid var(--primary);
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem 1rem 1rem 1rem;
        gap: 0.5rem;
        display: none;
        z-index: 99999;
    }

    .nav-links.show {
        display: flex !important;
        animation: slideDownNav 0.2s ease-out;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        font-weight: 600;
        border-radius: var(--radius-sm);
        display: block;
        text-align: left;
        background: #f8fafc;
        border: 1px solid var(--border);
    }

    .nav-link:hover, .nav-link.active {
        background-color: var(--primary-light);
        color: var(--primary);
        border-color: #bfdbfe;
    }

    .nav-links li {
        width: 100%;
        list-style: none;
    }

    .nav-links .btn {
        width: 100%;
        text-align: center;
        padding: 0.75rem;
        margin-top: 0.25rem;
        display: block;
    }

    .admin-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .admin-welcome-text {
        display: none !important;
    }

    .admin-sidebar {
        display: none;
        width: 100%;
    }

    .admin-sidebar.show {
        display: flex;
        animation: slideDownNav 0.2s ease-out;
    }
}

@keyframes slideDownNav {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Layout Containers */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.container-narrow {
    max-width: 900px;
}

/* Split View Desktop */
.split-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .split-layout {
        flex-direction: row;
        align-items: flex-start;
        height: calc(100vh - 80px);
    }
    
    .panel-form {
        flex: 0 0 45%;
        max-width: 45%;
        height: 100%;
        overflow-y: auto;
        padding-right: 0.75rem;
    }
    
    .panel-preview {
        flex: 1;
        height: 100%;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        background-color: #cbd5e1;
        border-radius: var(--radius-md);
        padding: 1.5rem;
    }
}

/* Mobile Tabs Switcher */
.mobile-tabs {
    display: flex;
    background: var(--slate-200);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.mobile-tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--slate-700);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-tab-btn.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

@media (min-width: 1024px) {
    .mobile-tabs {
        display: none;
    }
}

/* Card Component */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--slate-900);
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 0.85rem 1.25rem;
    background: var(--slate-50);
    border-top: 1px solid var(--border);
}

/* Form Controls */
.form-group {
    margin-bottom: 1.1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--slate-700);
    margin-bottom: 0.35rem;
}

.form-label .required {
    color: var(--danger);
}

.form-control, .form-select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    font-size: 0.925rem;
    font-family: inherit;
    color: var(--text-main);
    background-color: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.15);
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

.form-hint {
    font-size: 0.775rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.6rem 1.15rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
}

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

.btn-secondary {
    background-color: var(--slate-100);
    color: var(--slate-700);
    border-color: var(--slate-300);
}
.btn-secondary:hover {
    background-color: var(--slate-200);
    color: var(--slate-900);
}

.btn-success {
    background-color: var(--success);
    color: #ffffff;
}
.btn-success:hover {
    background-color: #15803d;
    color: #ffffff;
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}
.btn-danger:hover {
    background-color: #b91c1c;
    color: #ffffff;
}

.btn-drive {
    background-color: #1a73e8;
    color: #ffffff;
}
.btn-drive:hover {
    background-color: #1557b0;
    color: #ffffff;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

/* Alerts / Flash Messages */
.alert {
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.alert-success { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #854d0e; border: 1px solid #fef08a; }
.alert-info { background: var(--info-light); color: #075985; border: 1px solid #bae6fd; }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}
.badge-success { background: var(--success-light); color: #166534; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-warning { background: var(--warning-light); color: #854d0e; }
.badge-info { background: var(--info-light); color: #075985; }

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th, .table td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.table th {
    background-color: var(--slate-50);
    font-weight: 600;
    color: var(--slate-700);
}

.table tbody tr:hover {
    background-color: var(--slate-50);
}

/* Signature Canvas Area */
.signature-box {
    border: 2px dashed var(--slate-300);
    border-radius: var(--radius-sm);
    background: #ffffff;
    position: relative;
    margin-bottom: 0.5rem;
    touch-action: none;
}

.signature-box canvas {
    display: block;
    width: 100%;
    height: 140px;
    background: #ffffff;
    cursor: crosshair;
}

.signature-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.35rem;
}

/* Admin Dashboard Specific */
.admin-sidebar-layout {
    display: flex;
    min-height: calc(100vh - 65px);
}

.admin-sidebar {
    width: 250px;
    background: #ffffff;
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-main {
    flex: 1;
    background: var(--bg-body);
    padding: 1.5rem;
    overflow-x: hidden;
}

@media (max-width: 900px) {
    .admin-sidebar-layout {
        flex-direction: column;
    }
    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}

.admin-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    color: var(--slate-700);
    font-weight: 500;
    border-radius: var(--radius-sm);
    font-size: 0.925rem;
    transition: all 0.15s;
}

.admin-menu-item:hover, .admin-menu-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--primary-light);
    color: var(--primary);
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--slate-900);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}
