/* ============================================
   Foto Ijazah - Design System
   SMK Negeri 1 Cipeundeuy
   ============================================ */

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

:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #38bdf8;
    --primary-50: #f0f9ff;
    --primary-100: #e0f2fe;
    --primary-200: #bae6fd;
    --sidebar-dark: #0f172a;
    --sidebar-mid: #1e293b;
    --sidebar-light: #334155;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --surface-hover: #f1f5f9;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --info: #3b82f6;
    --info-bg: #eff6ff;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 270px;
    --header-height: 65px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--surface-alt);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; }

/* ---- Sidebar ---- */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-dark) 0%, var(--sidebar-mid) 100%);
    z-index: 1000;
    transition: transform 0.3s ease;
    display: flex; flex-direction: column;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    display: flex; align-items: center; gap: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand img { width: 44px; height: 44px; border-radius: 12px; object-fit: contain; background: rgba(255,255,255,0.1); padding: 4px; }

.sidebar-brand-text h4 { color: #fff; font-size: 14px; font-weight: 700; letter-spacing: 0.3px; line-height: 1.3; }
.sidebar-brand-text span { color: var(--primary-light); font-size: 11px; font-weight: 500; }

.sidebar-menu { padding: 12px 0; flex: 1; }
.sidebar-menu-label {
    padding: 16px 24px 8px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.5px;
    color: rgba(255,255,255,0.35);
}

.sidebar-menu a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px; margin: 2px 10px;
    color: rgba(255,255,255,0.65);
    font-size: 13.5px; font-weight: 500;
    border-radius: var(--radius);
    transition: var(--transition);
}

.sidebar-menu a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-menu a.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(14,165,233,0.4); }
.sidebar-menu a .icon { width: 20px; text-align: center; font-size: 16px; opacity: 0.85; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius);
    background: rgba(255,255,255,0.05);
}

.sidebar-user-avatar {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 14px;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info .name { color: #fff; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info .role { color: var(--primary-light); font-size: 11px; font-weight: 500; }

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ---- Header ---- */
.top-header {
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px;
    position: sticky; top: 0; z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.9);
}

.header-left { display: flex; align-items: center; gap: 16px; }
.header-left h1 { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.header-left .breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.header-left .breadcrumb a { color: var(--primary); }
.header-left .breadcrumb a:hover { text-decoration: underline; }

.hamburger {
    display: none; background: none; border: none;
    font-size: 22px; cursor: pointer; padding: 8px;
    color: var(--text-secondary); border-radius: var(--radius-sm);
}
.hamburger:hover { background: var(--surface-hover); }

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

.btn-logout {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius);
    background: var(--danger-bg); color: var(--danger);
    font-size: 13px; font-weight: 600; border: none;
    cursor: pointer; transition: var(--transition);
}
.btn-logout:hover { background: var(--danger); color: #fff; }

/* ---- Content Area ---- */
.content-area { padding: 28px; }

/* ---- Cards ---- */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
}

.card-header h3 { font-size: 16px; font-weight: 700; }
.card-body { padding: 24px; }

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

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    display: flex; align-items: center; gap: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    border-radius: 3px 3px 0 0;
}

.stat-card.blue::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stat-card.green::before { background: linear-gradient(90deg, var(--success), #34d399); }
.stat-card.orange::before { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.stat-card.red::before { background: linear-gradient(90deg, var(--danger), #f87171); }
.stat-card.purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

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

.stat-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-100); color: var(--primary); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.purple { background: #f3e8ff; color: #8b5cf6; }

.stat-info h3 { font-size: 26px; font-weight: 800; line-height: 1.2; }
.stat-info p { font-size: 12.5px; color: var(--text-muted); font-weight: 500; margin-top: 2px; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border-radius: var(--radius);
    font-size: 13px; font-weight: 600;
    border: none; cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(14,165,233,0.35); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: var(--surface-hover); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }

.form-control {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px; font-family: inherit;
    transition: var(--transition);
    background: var(--surface);
    color: var(--text-primary);
}

.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,165,233,0.12); }

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---- Tables ---- */
.table-responsive { overflow-x: auto; }

.table {
    width: 100%; border-collapse: collapse;
    font-size: 13.5px;
}

.table thead th {
    padding: 12px 16px; text-align: left;
    font-weight: 600; font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--surface-alt);
    border-bottom: 2px solid var(--border);
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: var(--primary-50); }

/* Responsive Table Stacking */
@media (max-width: 768px) {
    .table-responsive { overflow-x: hidden; }
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { margin-bottom: 15px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
    .table tbody td { 
        display: flex; justify-content: space-between; align-items: center; 
        text-align: right; padding: 12px 16px; border-bottom: 1px solid var(--border-light); 
        border-top: none;
    }
    .table tbody td:last-child { border-bottom: none; }
    .table tbody td::before { 
        content: attr(data-label); 
        font-weight: 700; font-size: 11px; text-transform: uppercase; 
        color: var(--text-secondary); text-align: left; margin-right: 15px; 
    }
    .table tbody td.actions, .table tbody td:last-child { justify-content: flex-end; gap: 8px; }
    .table tbody td.actions::before, .table tbody td:last-child::before { display: none; }
}

/* ---- Badges ---- */
.badge {
    display: inline-flex; align-items: center;
    padding: 4px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-primary { background: var(--primary-100); color: var(--primary); }

/* ---- Progress Bar ---- */
.progress-bar-wrap {
    width: 100%; height: 8px;
    background: var(--border-light);
    border-radius: 4px; overflow: hidden;
}

.progress-bar-fill {
    height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: width 0.6s ease;
}

.progress-bar-fill.complete { background: linear-gradient(90deg, var(--success), #34d399); }

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

.modal-overlay.active { display: flex; }

.modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    width: 95%; max-width: 560px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

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

.modal-header h3 { font-size: 17px; font-weight: 700; }

.modal-close {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    font-size: 18px; color: var(--text-muted);
    transition: var(--transition);
}

.modal-close:hover { background: var(--surface-hover); color: var(--text-primary); }

.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 10px; }

/* ---- Photo Grid ---- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; }

.photo-card {
    border-radius: var(--radius-lg); overflow: hidden;
    border: 2px solid var(--border);
    background: var(--surface);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.photo-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary-200); }
.photo-card.assigned { border-color: var(--success); }
.photo-card.assigned::after {
    content: '✓'; position: absolute; top: 8px; right: 8px;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--success); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
}

.photo-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }

.photo-card-info {
    padding: 10px 12px;
    border-top: 1px solid var(--border-light);
}

.photo-card-info .filename { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-card-info .student-name { font-size: 13px; font-weight: 600; color: var(--primary-dark); margin-top: 2px; }

/* ---- Alerts ---- */
.alert {
    padding: 14px 18px; border-radius: var(--radius);
    font-size: 13.5px; font-weight: 500;
    margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
    animation: slideDown 0.3s ease;
}

.alert-success { background: var(--success-bg); color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-bg); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--info-bg); color: #1e40af; border: 1px solid #bfdbfe; }

/* ---- Search & Filter ---- */
.filter-bar {
    display: flex; align-items: center; gap: 12px;
    flex-wrap: wrap; margin-bottom: 20px;
}

.search-input {
    position: relative; flex: 1; min-width: 200px;
}

.search-input input {
    width: 100%; padding: 10px 14px 10px 38px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 13.5px; font-family: inherit;
    transition: var(--transition);
}

.search-input input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,165,233,0.12); }

.search-input::before {
    content: '🔍'; position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%); font-size: 14px;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center; padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h4 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 13.5px; }

/* ---- Login Page ---- */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--sidebar-dark) 0%, #1e3a5f 50%, var(--primary-dark) 100%);
    padding: 20px;
    position: relative; overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute; width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(14,165,233,0.15) 0%, transparent 70%);
    top: -100px; right: -100px;
    border-radius: 50%;
}

.login-page::after {
    content: '';
    position: absolute; width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(56,189,248,0.1) 0%, transparent 70%);
    bottom: -80px; left: -80px;
    border-radius: 50%;
}

.login-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    width: 100%; max-width: 420px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    position: relative; z-index: 1;
    animation: slideUp 0.5s ease;
}

.login-card .logo-wrap { text-align: center; margin-bottom: 28px; }
.login-card .logo-wrap img { width: 80px; height: 80px; object-fit: contain; margin-bottom: 14px; }
.login-card .logo-wrap h2 { font-size: 20px; font-weight: 800; color: var(--text-primary); }
.login-card .logo-wrap p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.login-card .form-group label { font-size: 12.5px; }
.login-card .form-control { padding: 12px 14px; }

.login-card .btn-primary {
    width: 100%; padding: 13px;
    font-size: 14.5px; font-weight: 700;
    border-radius: var(--radius);
    margin-top: 8px;
}

/* ---- Animations ---- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Pagination ---- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; }
.pagination a, .pagination span {
    padding: 8px 14px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: var(--transition);
}
.pagination a:hover { background: var(--primary-50); border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- Responsive ---- */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 999;
}

@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.active { display: block; }
    .main-content { margin-left: 0; }
    .hamburger { display: block; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
    .content-area { padding: 20px 16px; }
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
    .form-row { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
}

@media (max-width: 576px) {
    .stats-grid { grid-template-columns: 1fr; }
    .top-header { padding: 0 16px; }
    .table-responsive { font-size: 12px; }
    .card-header { padding: 14px 16px; }
    .card-body { padding: 16px; }
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
    .hide-mobile { display: none; }
}

/* ---- Assign Modal Layout ---- */
.assign-layout { display: flex; gap: 20px; }
.assign-preview { flex: 0 0 160px; }
.assign-preview img { width: 100%; border-radius: 10px; box-shadow: var(--shadow-md); display: block; }
.assign-form { flex: 1; min-width: 0; }

@media (max-width: 576px) {
    .assign-layout { flex-direction: column; align-items: center; }
    .assign-preview { flex: 0 0 auto; width: 130px; }
}

/* ---- Utilities ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }

/* ---- Upload Zone ---- */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--surface-alt);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-50);
}

.upload-zone .icon { font-size: 40px; margin-bottom: 12px; }
.upload-zone h4 { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.upload-zone p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }
