/* ========================================
   Buku Induk Siswa - SLB Negeri 2 Yogyakarta
   ======================================== */

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;
    
    --bg: #f1f5f9;
    --bg-white: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-dark: #cbd5e1;
    
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.header-top h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.school-name {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 2px;
}

/* Navigation */
.main-nav {
    margin-top: 16px;
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.main-nav li {
    margin: 0;
}

.main-nav a {
    display: block;
    padding: 8px 20px;
    color: rgba(255,255,255,0.85);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.main-nav a:hover,
.main-nav a.active {
    background: rgba(255,255,255,0.2);
    color: white;
    text-decoration: none;
}

.main-nav a.active {
    background: rgba(255,255,255,0.25);
}

/* Main Content */
.main-content {
    flex: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}

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

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-filter {
    margin-bottom: 20px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.5;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

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

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

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

.btn-success:hover {
    background: #15803d;
    color: white;
}

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

.btn-secondary:hover {
    background: #475569;
    color: white;
}

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

.btn-info:hover {
    background: #0e7490;
    color: white;
}

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

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

/* Alert */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-light);
    color: #166534;
    border-color: #bbf7d0;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border-color: #fde68a;
}

.alert-error,
.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
    border-color: #fecaca;
}

.alert-info {
    background: var(--info-light);
    color: #155e75;
    border-color: #a5f3fc;
}

/* Filter Form */
.filter-form .filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

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

.filter-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
}

/* Form Controls */
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: var(--font);
    background: var(--bg-white);
    color: var(--text);
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.form-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-actions {
    margin-top: 20px;
}

/* File Input */
.file-input-wrapper {
    position: relative;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-input-label {
    display: block;
    padding: 12px 16px;
    border: 2px dashed var(--border-dark);
    border-radius: var(--radius);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.file-input-wrapper:hover .file-input-label {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-bottom: 16px;
}

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

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

.table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

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

.table-compact th,
.table-compact td {
    padding: 8px 12px;
}

.student-name {
    font-weight: 500;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

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

/* Pagination */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.page-link {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.875rem;
    background: var(--bg-white);
    transition: all 0.2s;
}

.page-link:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    text-decoration: none;
}

.page-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

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

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

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

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Recent List */
.recent-list {
    list-style: none;
}

.recent-item {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.recent-list li:last-child .recent-item {
    border-bottom: none;
}

.recent-name {
    font-weight: 500;
    color: var(--text);
}

.recent-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Student Profile */
.student-profile {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 30px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-bottom: 1px solid var(--border);
}

.avatar-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

.avatar-male {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.avatar-female {
    background: linear-gradient(135deg, #ec4899, #db2777);
}

.profile-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Detail Sections */
.detail-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

@media (max-width: 768px) {
    .detail-sections {
        grid-template-columns: 1fr;
    }
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
}

.detail-section {
    padding: 24px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.detail-section:nth-child(even) {
    border-right: none;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
}

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

.table-detail tr {
    border-bottom: 1px solid #f1f5f9;
}

.table-detail td {
    padding: 6px 8px;
    font-size: 0.875rem;
    vertical-align: top;
}

.table-detail .label {
    font-weight: 600;
    color: var(--text-muted);
    width: 180px;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .table-detail .label {
        width: 120px;
    }
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-info {
    background: var(--info-light);
    color: #155e75;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: white;
    border-radius: var(--radius);
    padding: 48px 32px;
    text-align: center;
    margin-bottom: 32px;
    box-shadow: var(--shadow-lg);
}

.hero h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.hero-sub {
    font-size: 0.95rem;
    opacity: 0.8;
    margin-top: 4px;
}

.hero-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-actions .btn {
    font-size: 1rem;
    padding: 12px 28px;
    border-width: 2px;
}

.hero-actions .btn-primary {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
    color: white;
}

.hero-actions .btn-primary:hover {
    background: rgba(255,255,255,0.3);
}

.hero-actions .btn-success {
    background: white;
    color: var(--primary);
    border-color: white;
}

.hero-actions .btn-success:hover {
    background: #f1f5f9;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 32px;
    border-top: 1px solid var(--border);
}

/* Utilities */
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 24px; }
.ml-3 { margin-left: 12px; }
.mb-2 { margin-bottom: 8px; }

/* Print Styles */
@media print {
    .app-header, .main-nav, .app-footer, .btn, .header-actions,
    .form-actions, .card-filter {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .student-profile {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .detail-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* Upload Form */
.upload-form {
    max-width: 500px;
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .header-top h1 {
        font-size: 1.35rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-form .filter-row {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero h2 {
        font-size: 1.5rem;
    }
    
    .main-nav ul {
        flex-direction: column;
    }
    
    .main-nav a {
        padding: 6px 16px;
    }
}
