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

:root {
    /* Colors */
    --primary-color: #0d63a5; /* Blue */
    --primary-hover: #0a4f85;
    --sidebar-active-bg: #e8f0fe;
    --sidebar-active-text: #0d63a5;
    
    --dashboard-header-bg-start: #046582;
    --dashboard-header-bg-end: #1e8470;
    
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    
    --success-color: #10b981;
    --success-bg: #d1fae5;
    --warning-color: #f59e0b;
    --warning-bg: #fef3c7;
    --info-color: #3b82f6;
    --info-bg: #dbeafe;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Typography */
    --font-family: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* App-like feel */
}

/* --- UTILITIES --- */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    gap: 0.5rem;
}

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

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.btn-outline:hover {
    background-color: #f1f5f9;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.form-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: border-color 0.2s;
    background-color: #fcfcfc;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 99, 165, 0.1);
}
.form-control::placeholder {
    color: var(--text-muted);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon .material-symbols-outlined {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 20px;
}

.input-with-icon .form-control {
    padding-left: 2.75rem;
}

/* Select */
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394a3b8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat, repeat;
    background-position: right .7em top 50%, 0 0;
    background-size: .65em auto, 100%;
}

/* --- LOGIN SCREEN --- */
#login-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-card {
    background: var(--surface-color);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-bottom: 4px solid #33d1b8; /* Gradient-like bottom border from design */
}

.login-logo {
    width: 64px;
    height: 64px;
    background-color: #e2e8f0;
    border-radius: 8px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}
.login-logo img {
    width: 100%;
    height: auto;
}

.login-card h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.login-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}


/* --- APP LAYOUT --- */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 50;
}

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

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-title h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}
.sidebar-title p {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.sidebar-nav {
    padding: 1.5rem 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
    cursor: pointer;
}

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

.nav-item.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-right: 3px solid var(--primary-color);
    border-radius: 8px 0 0 8px; /* Flat right side for active state */
}

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

/* Header */
.app-header {
    height: 70px;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--dashboard-header-bg-start); /* Dark teal */
}

.semester-badge {
    background-color: var(--info-bg);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-icon {
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 24px;
    transition: color 0.2s;
}
.header-icon:hover {
    color: var(--text-primary);
}

.user-profile img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

/* Content Area */
.content-area {
    flex-grow: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* --- DASHBOARD VIEW --- */
.welcome-banner {
    background: linear-gradient(135deg, var(--dashboard-header-bg-start), var(--dashboard-header-bg-end));
    border-radius: 12px;
    padding: 2.5rem 2rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.welcome-text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.welcome-text p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.date-badge {
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}
.stat-icon.blue { background-color: #3b82f6; color: white; }
.stat-icon.green { background-color: #34d399; color: white; }
.stat-icon.light-blue { background-color: #bfdbfe; color: var(--primary-color); }

.stat-info h3 {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}
.stat-info p {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

/* --- INPUT NILAI VIEW --- */
.view-header {
    margin-bottom: 1.5rem;
}
.view-header h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.view-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.filter-section {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}
.filter-section .form-group {
    margin-bottom: 0;
}

.scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.score-card {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.score-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.score-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}
.score-title .material-symbols-outlined {
    color: var(--dashboard-header-bg-start);
}

.score-badge {
    background-color: var(--info-bg);
    color: var(--info-color);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.score-input-container {
    text-align: center;
}
.score-input-container .form-label {
    justify-content: center;
}
.score-input-container input {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    padding: 1rem;
    color: var(--text-primary);
}

.notes-section {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}
.notes-section textarea {
    min-height: 120px;
    resize: vertical;
}

.actions-container {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* --- RAPOR VIEW (PRINT) --- */
#rapor-view {
    background: white; /* Print should be white */
    min-height: 100%;
}

.print-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background: white;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    /* Attempt to simulate the scanned paper background slightly, but keeping it clean */
    background-image: radial-gradient(#f1f5f9 1px, transparent 1px);
    background-size: 20px 20px;
}

.rapor-header {
    text-align: center;
    border-bottom: 2px solid #333;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.school-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e3a8a; /* Deep blue from original */
    text-transform: uppercase;
    letter-spacing: 1px;
}

.school-subtitle {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.school-address {
    font-size: 0.75rem;
    color: #4b5563;
}

.report-title {
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
    margin: 1.5rem 0;
    text-transform: uppercase;
}

.student-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}
.info-row {
    display: flex;
}
.info-label {
    width: 100px;
}
.info-colon {
    width: 20px;
}
.info-value {
    font-weight: 600;
}

.rapor-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}
.rapor-table th, .rapor-table td {
    border: 1px solid #000;
    padding: 0.5rem;
    text-align: center;
    vertical-align: middle;
}
.rapor-table th {
    background-color: #93c5fd; /* Light blue header */
    font-weight: bold;
}
.rapor-table td.text-left {
    text-align: left;
}

.keterangan-skor {
    font-size: 0.75rem;
    margin-bottom: 1rem;
}
.keterangan-skor span {
    margin-right: 1rem;
}

.catatan-box {
    border: 1px solid #000;
    min-height: 60px;
    padding: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.85rem;
}

.signature-section {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-top: 2rem;
    text-align: center;
}

.signature-box {
    width: 200px;
}
.signature-space {
    height: 80px;
    margin: 0.5rem 0;
    position: relative;
}
/* Placeholder for fake signatures for visual flair */
.fake-sig {
    font-family: 'Brush Script MT', cursive;
    font-size: 1.5rem;
    color: #1e3a8a;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) rotate(-5deg);
}
.fake-stamp {
    width: 80px;
    height: 80px;
    border: 2px dashed #1e3a8a;
    border-radius: 50%;
    position: absolute;
    left: -20px;
    top: 0;
    opacity: 0.5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    text-align: center;
    color: #1e3a8a;
    transform: rotate(-15deg);
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    #rapor-print-view, #rapor-print-view * {
        visibility: visible;
    }
    #rapor-print-view {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 0;
    }
    .print-container {
        border: none;
        box-shadow: none;
        padding: 0;
        background: white;
    }
    .actions-container {
        display: none !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .welcome-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .header-title {
        font-size: 1rem;
    }
    .student-info-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}
