/* Modern UI Design System for Form Sekolah & Siswa */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --secondary: #06b6d4;
    --success: #10b981;
    --success-light: #ecfdf5;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fef2f2;
    --warning: #f59e0b;
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --border: #475569;
    --border-focus: #818cf8;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-light: #cbd5e1;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    background: radial-gradient(circle at top right, #1e1b4b, #0f172a 60%);
    color: var(--text-main);
    min-height: 100vh;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}

/* Header & Navbar */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.25rem 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

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

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.brand h1 {
    font-size: 1.35rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand p {
    font-size: 0.825rem;
    color: var(--text-muted);
}

.nav-links {
    display: flex;
    gap: 10px;
}

.nav-btn {
    text-decoration: none;
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-btn:hover, .nav-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Card Styling */
.card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.75rem;
}

.card-title span {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Alert Notification */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    animation: fadeIn 0.3s ease;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.alert-info {
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: #22d3ee;
}

/* Form Controls */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
}

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

.form-control {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
    width: 100%;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    background: #3b4252;
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* Dynamic Student Section */
.student-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.student-counter-badge {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.student-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 6px;
}

/* Custom Scrollbar */
.student-list::-webkit-scrollbar {
    width: 6px;
}
.student-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}
.student-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.student-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    animation: slideDown 0.25s ease;
}

.student-row:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(15, 23, 42, 0.9);
}

.student-index {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.student-row .input-wrapper {
    flex: 1;
    display: flex;
    gap: 10px;
}

.nisn-preview {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    border: 1px dashed rgba(56, 189, 248, 0.3);
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* Buttons */
.btn {
    cursor: pointer;
    border: none;
    outline: none;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.4rem;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #4f46e5);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
}

.btn-danger-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn-danger-icon:hover {
    background: var(--danger);
    color: #fff;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Data Table Styling */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.925rem;
}

.data-table th {
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-light);
    font-weight: 600;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.data-table td {
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.nisn-badge {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    border: 1px solid rgba(56, 189, 248, 0.3);
    font-size: 0.85rem;
}

.footer {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Search bar header */
.table-header-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    gap: 8px;
    max-width: 380px;
    width: 100%;
}

/* Keyframe Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 640px) {
    .app-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    .student-row .input-wrapper {
        flex-direction: column;
    }
    .form-actions {
        flex-direction: column;
        gap: 12px;
    }
    .form-actions .btn {
        width: 100%;
    }
}
