:root {
    --primary: #2563eb; /* Blue 600 */
    --primary-hover: #1d4ed8;
    --secondary: #0ea5e9; /* Sky 500 */
    --secondary-hover: #0284c7;
    --success: #10b981; /* Emerald 500 */
    --danger: #ef4444; /* Red 500 */
    --danger-hover: #dc2626;
    --warning: #f59e0b; /* Amber 500 */
    --bg-main: #f1f5f9; /* Slate 100 */
    --bg-card: #ffffff;
    --text-main: #0f172a; /* Slate 900 */
    --text-muted: #475569; /* Slate 600 */
    --border-color: #e2e8f0; /* Slate 200 */
    --sidebar-width: 280px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--primary);
    font-size: 1.5rem;
}

.logo i {
    font-size: 2rem;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.user-profile-widget {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.profile-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.user-info h3 {
    font-size: 1rem;
    font-weight: 600;
}

.user-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.nav-menu {
    padding: 1.5rem 1rem;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: var(--transition);
    font-weight: 500;
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 0;
    width: 4px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    transition: var(--transition);
}

.nav-item:hover, .nav-item.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.08) 0%, rgba(37, 99, 235, 0.02) 100%);
    color: var(--primary);
    font-weight: 600;
}

.nav-item.active::before {
    height: 70%;
}

.nav-item i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.top-header {
    height: 70px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
    display: none;
}

.header-title h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: scale(0.98);
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
    background: var(--secondary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-danger:hover {
    background: var(--danger-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-success:hover {
    background: #059669;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-main);
    border-color: var(--text-muted);
}

.w-full {
    width: 100%;
    justify-content: center;
}

/* Alarm Notification */
.alarm-notification {
    background: var(--danger);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    animation: slideIn 0.3s ease;
}

.alarm-notification.hidden {
    display: none;
}

.alarm-notification button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    margin-left: 0.5rem;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Page Sections */
.content-wrapper {
    padding: 2rem;
    flex: 1;
}

.page-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.section-header .actions {
    display: flex;
    gap: 0.5rem;
}

/* Cards & Tables */
.card {
    background: var(--bg-card);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.table-responsive {
    overflow-x: auto;
    max-height: 60vh;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

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

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.data-table tbody tr {
    transition: background-color 0.2s;
}

.data-table tbody tr:nth-child(even) {
    background: var(--bg-main);
}

.data-table tbody tr:hover {
    background: #e2e8f0;
}

.data-table td {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 0.875rem;
}

/* Forms */
.form-control {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid #cbd5e1; /* slightly darker border */
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: var(--transition);
    background: #f8fafc;
    color: var(--text-main);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.filter-bar .form-control {
    width: auto;
    min-width: 200px;
}

/* Dashboard Specifics */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-radius: 1rem;
    padding: 2rem 3rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    blur: 40px;
}

.banner-text h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.banner-text p {
    opacity: 0.9;
    font-size: 1rem;
}

.banner-img {
    height: 150px;
    z-index: 1;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-info p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 0.25rem;
}

/* Schedule Grid */
.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.schedule-day {
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.schedule-day h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(79, 70, 229, 0.2);
    color: var(--primary);
}

.schedule-item {
    padding: 1rem;
    border-radius: 0.5rem;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.schedule-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
}

.schedule-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary);
}

.schedule-item .time {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.schedule-item .subject {
    font-weight: 600;
    font-size: 1rem;
}

.schedule-item .class-name {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.schedule-item .delete-btn {
    position: absolute;
    right: 1rem;
    top: 1rem;
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.schedule-item:hover .delete-btn {
    opacity: 1;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-card);
    width: 100%;
    max-width: 500px;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Badges & Toasts */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.badge-blue { background: rgba(37, 99, 235, 0.1); color: #2563eb; }
.badge-pink { background: rgba(236, 72, 153, 0.1); color: #db2777; }
.badge-red { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.badge-green { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.badge-gray { background: rgba(100, 116, 139, 0.1); color: #475569; }

.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--bg-card);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-left: 4px solid var(--primary);
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    min-width: 300px;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }

.toast i { font-size: 1.25rem; }
.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }

.toast-content { flex: 1; }
.toast-title { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.125rem; }
.toast-message { font-size: 0.875rem; color: var(--text-muted); }

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.toast.fade-out {
    animation: fadeOutRight 0.3s forwards;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Settings */
.settings-card {
    max-width: 600px;
    padding: 2rem;
}

.print-footer, .print-header {
    display: none;
}

.profile-upload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.profile-upload-container img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    border: 3px solid var(--primary);
    box-shadow: var(--shadow-sm);
}

.upload-btn {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

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

@media screen {
    .print-only { display: none !important; }
}

/* Professional Table Inputs */
.table-input {
    width: 100%;
    min-width: 50px;
    border: 1px solid transparent;
    background: transparent;
    padding: 6px 4px;
    text-align: center;
    border-radius: 4px;
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
    font-size: 0.95em;
    color: var(--text);
}
.table-input:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}
.table-input:focus {
    border-color: var(--primary);
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}
.table-input-text {
    text-align: left;
}
/* Hide number spinners for cleaner look */
.table-input[type=number]::-webkit-inner-spin-button, 
.table-input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
.table-input[type=number] {
  -moz-appearance: textfield;
}

.data-table tbody tr {
    transition: background-color 0.2s;
}
.data-table tbody tr:hover {
    background-color: #f8fafc;
}

.table-responsive {
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* =========================================================
   PRINT STYLES
   ========================================================= */
@media print {
    @page {
        size: A4 portrait;
        margin: 1.5cm;
    }

    .sidebar, .top-header .menu-toggle, .header-actions, .actions, .filter-bar, .no-print, .welcome-banner {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .content-wrapper {
        padding: 0 !important;
    }

    .card {
        border: none;
        box-shadow: none;
        margin-bottom: 0;
    }

    .page-section:not(.active) {
        display: none !important;
    }
    
    .page-section.active {
        display: block !important;
    }
    
    body {
        background: white;
        color: black;
        font-family: 'Times New Roman', Times, serif !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .data-table th, .data-table td {
        border-color: black !important;
        font-family: 'Times New Roman', Times, serif !important;
        font-size: 11pt !important;
    }

    .print-only { display: block !important; }
    .lap-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; page-break-inside: auto; font-family: 'Times New Roman', Times, serif !important; font-size: 12pt !important; }
    .lap-table tr { page-break-inside: avoid; page-break-after: auto; }
    .lap-table th, .lap-table td { border: 1px solid #000 !important; padding: 7px 10px; font-family: 'Times New Roman', Times, serif !important; font-size: 12pt !important; color: black; line-height: 1.4; }
    .lap-table th { text-align: center; font-weight: bold; background-color: transparent !important; }

    /* Print Header (Kop Surat) */
    .print-header {
        display: flex;
        align-items: center;
        border-bottom: 1px solid black;
        padding-bottom: 2px;
        margin-bottom: 20px;
    }
    
    .print-logo {
        width: 80px;
        height: auto;
        margin-right: 20px;
    }
    
    .print-header-text {
        flex: 1;
        text-align: center;
        border-bottom: 3px solid black;
        padding-bottom: 10px;
    }
    
    .print-header-text h3 {
        font-size: 14pt;
        margin: 0;
        font-weight: normal;
    }
    
    .print-header-text h2 {
        font-size: 18pt;
        margin: 5px 0;
        font-weight: bold;
        text-transform: uppercase;
    }
    
    .print-header-text p {
        font-size: 10pt;
        margin: 0;
    }

    /* Print Footer Signature */
    .print-footer {
        display: flex;
        justify-content: space-between;
        margin-top: 40px;
        page-break-inside: avoid;
        flex-wrap: wrap;
    }
    
    .lap-nb-text {
        display: none;
    }
    
    #laporan-bulanan.active ~ #print-signature .lap-nb-text {
        display: block;
    }
    
    #laporan-sarpras-lab.active ~ #print-signature,
    #laporan-sarpras-kelas.active ~ #print-signature {
        display: none !important;
    }
    
    .signature-box {
        text-align: center;
        width: 250px;
    }
    
    .signature-box p {
        margin: 0;
        line-height: 1.5;
        font-size: 11pt;
    }

    /* Section Title Layout */
    .top-header {
        display: none !important; /* Hide original top header */
    }

    .section-header {
        display: block;
        text-align: center;
        margin-bottom: 20px;
    }

    .section-header h2 {
        font-size: 16pt;
        text-transform: uppercase;
        font-weight: bold;
        width: 100%;
        margin-top: 10px;
    }

    /* Print Tables */
    table {
        page-break-inside: auto;
    }
    
    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    
    thead {
        display: table-header-group;
    }
    
    tfoot {
        display: table-footer-group;
    }

    .data-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 20px;
    }
    
    .data-table th, .data-table td {
        border: 1px solid black !important;
        padding: 6px 8px !important;
        font-size: 11pt !important;
        color: black !important;
        font-family: 'Times New Roman', Times, serif !important;
    }
    
    #print-laporan-bulanan, #print-laporan-bulanan * {
        font-family: 'Times New Roman', Times, serif !important;
        font-size: 12pt !important;
    }
    
    .lap-table th, .lap-table td {
        font-size: 12pt !important;
        padding: 6px 8px !important;
    }
    
    .data-table th {
        background-color: #e2e8f0 !important;
        -webkit-print-color-adjust: exact; 
        font-weight: bold;
        text-align: center;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .welcome-banner {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }

    .welcome-banner img {
        margin-top: 1rem;
    }
    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .section-header .actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .table-responsive {
        max-height: 70vh;
    }
}
