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

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

:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --accent: #06b6d4;
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --radius: 12px;
}

body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    color: var(--text);
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

/* ─── Header ─── */
.header {
    text-align: center;
    margin-bottom: 28px;
}

.header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 4px;
}

.header p {
    color: rgba(255,255,255,0.45);
    font-size: 0.85rem;
}

/* ─── Drop Zone ─── */
.drop-zone {
    border: 2px dashed rgba(255,255,255,0.12);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    color: rgba(255,255,255,0.35);
    font-size: 0.85rem;
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--primary-light);
    background: rgba(79,70,229,0.05);
    color: rgba(255,255,255,0.6);
}

.drop-zone input { display: none; }

/* ─── Toolbar ─── */
.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-outline {
    background: transparent;
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.15);
}
.btn-outline:hover { background: rgba(255,255,255,0.08); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; border-radius: 8px; }

.spacer { flex: 1; }

.search-box {
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    width: 240px;
    transition: all 0.2s;
}
.search-box::placeholder { color: rgba(255,255,255,0.3); }
.search-box:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}

.counter {
    color: rgba(255,255,255,0.4);
    font-size: 0.8rem;
    padding: 0 4px;
}

/* ─── Table ─── */
.table-wrap {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

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

thead th {
    background: #f8fafc;
    padding: 12px 14px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 2;
}

tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

tbody tr:hover { background: #fafbfd; }

tbody td {
    padding: 12px 14px;
    font-size: 0.85rem;
    vertical-align: middle;
}

/* Photo cell — pasfoto style matching layout */
td.photo-cell { width: 58px; }

td.photo-cell .photo-wrap {
    width: 48px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    background: #e2e8f0;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

td.photo-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

td.photo-cell .no-photo {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

td.name-cell {
    font-weight: 600;
    color: var(--text);
    min-width: 180px;
}

td.title-cell { white-space: nowrap; }

.cat-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    margin: 1px 2px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.cat-badge.professor { background: #fef3c7; color: #92400e; }
.cat-badge.doctor { background: #ede9fe; color: #5b21b6; }
.cat-badge.engineering { background: #ecfdf5; color: #065f46; }
.cat-badge.computer { background: #eff6ff; color: #1e40af; }

.research-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.research-list li {
    background: #f8fafc;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.72rem;
    color: var(--muted);
    border: 1px solid #e2e8f0;
}

td.actions-cell {
    white-space: nowrap;
    width: 150px;
}

td.actions-cell .btn-sm {
    padding: 5px 9px;
}

td.actions-cell .btn-outline {
    color: var(--muted);
    border-color: var(--border);
    background: #fff;
}

td.actions-cell .btn-outline:hover {
    background: #f1f5f9;
    color: var(--text);
    border-color: #cbd5e1;
}

td.actions-cell .btn-danger {
    color: var(--danger);
    background: #fff;
    border: 1px solid #fecaca;
}

td.actions-cell .btn-danger:hover {
    background: #fef2f2;
}

/* ─── Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

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

.modal-header h2 { font-size: 1.1rem; font-weight: 700; }

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f1f5f9;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: all 0.15s;
}
.modal-close:hover { background: #e2e8f0; color: var(--text); }

.modal-body { padding: 20px 24px; }

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

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
    color: var(--text);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-hint {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 4px;
}

.checkbox-group { display: flex; gap: 12px; flex-wrap: wrap; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.15s;
}

.checkbox-label:hover { background: #f8fafc; }
.checkbox-label:has(input:checked) {
    border-color: var(--primary);
    background: #eef2ff;
}

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

/* ─── Preview ─── */
.photo-preview {
    width: 60px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #e2e8f0;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

/* ─── Toast ─── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 10px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 200;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .app { padding: 16px 12px 40px; }
    .header h1 { font-size: 1.3rem; }
    .toolbar { gap: 8px; }
    .search-box { width: 100%; order: -1; }
    .table-wrap { overflow-x: auto; }
    table { min-width: 720px; }
    .modal { max-width: 100%; margin: 10px; }
}

/* ─── Footer ─── */
.footer {
    text-align: center;
    padding: 24px 16px 16px;
    margin-top: 20px;
}

.footer-inner {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    border-radius: 100px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(8px);
}

.footer-crown {
    font-size: 1rem;
    animation: crownBob 2s ease-in-out infinite;
    display: inline-block;
}

.footer-crown:last-child {
    animation-delay: 0.3s;
}

.footer-text {
    font-size: 0.78rem;
    font-weight: 600;
    background: linear-gradient(90deg, #818cf8, #06b6d4, #818cf8);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s linear infinite;
}

@keyframes crownBob {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-2px) rotate(5deg); }
}

@keyframes shimmer {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}
