:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #64748b;
    --bg-main: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass: rgba(255, 255, 255, 0.05);
    --success: #10b981;
    --error: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: width 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    min-width: 0;
}

.sidebar-header > img {
    flex-shrink: 0;
}

.logo-icon {
    color: var(--primary);
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.sidebar-header h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    text-align: left;
    min-width: 0;
}

.nav-btn span {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.nav-btn:hover {
    background: var(--glass);
    color: var(--text-main);
}

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

.nav-btn i {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    padding: 2rem;
    overflow-y: auto;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.1), transparent);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.header-title h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

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

.stats-card {
    background: var(--glass);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: 1rem;
    text-align: center;
}

.stats-card .label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.stats-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Glass UI Elements */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
}

/* Dashboard View */
.content-view {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.content-view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.info-card {
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    text-align: center;
}

.info-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
}

.info-card i {
    width: 48px;
    height: 48px;
    color: var(--primary);
    margin-bottom: 1rem;
}

.info-card h3 {
    margin-bottom: 0.5rem;
}

.info-card p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.recent-activity h3 {
    margin-bottom: 1.5rem;
}

/* Upload View */
.upload-container {
    max-width: 800px;
    margin: 0 auto;
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 1rem;
    padding: 4rem 2rem;
    text-align: center;
    transition: border-color 0.2s;
}

.drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.drop-zone i {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.drop-zone p {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

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

.btn-secondary {
    background: var(--glass);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
}

/* Forms */
.form-container {
    max-width: 900px;
    margin: 0 auto;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

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

.full-width {
    grid-column: span 2;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

input, select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    color: white;
    outline: none;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    border-color: var(--primary);
}

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

/* Tables */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.search-box {
    position: relative;
    flex-grow: 1;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
}

.search-box input {
    width: 100%;
    padding-left: 3rem;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
}

.table-scroll {
    overflow-x: auto;
}

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

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

th:hover {
    color: var(--text-main);
}

th i {
    width: 14px;
    height: 14px;
    vertical-align: middle;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.btn-icon:hover {
    color: var(--text-main);
}

.btn-icon.edit:hover { color: var(--primary); }
.btn-icon.delete:hover { color: var(--error); }

/* Group View */
.group-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    height: calc(100vh - 200px);
}

.selectable-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    max-height: 100%;
    overflow-y: auto;
}

.list-item {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    background: var(--glass);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.list-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.list-item.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.list-item h4 {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.list-item span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.test-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    overflow-y: auto;
}

.test-card {
    background: var(--glass);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 0.75rem;
    position: relative;
}

.test-card-no {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.test-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
}

.badge-ders { background: rgba(99, 102, 241, 0.2); color: #818cf8; }
.badge-zorluk { background: rgba(0, 0, 0, 0.3); color: var(--text-muted); }

/* Toasts */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
}

.toast {
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    animation: slideIn 0.3s forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.success i { color: var(--success); }
.toast.error i { color: var(--error); }

/* Stats Group */
.stats-group {
    display: flex;
    gap: 1rem;
}

.stats-card {
    min-width: 100px;
}

/* Loader Overlay */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loader-overlay.hidden {
    display: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--glass);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { width: 80px; padding: 1rem; }
    .sidebar h1, .sidebar-footer, .nav-btn span, .logo-icon + h1 { display: none; }
    .nav-btn { justify-content: center; padding: 1rem; }
    .group-layout { grid-template-columns: 1fr; }
    .stats-group { display: none; }
}

/* Pagination */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0 0 1rem 1rem;
    margin-top: -1px;
}

.pagination-controls button:disabled {
    opacity: 0.3;
    cursor:not-allowed;
}

.selection-details {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.test-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
    padding: 1rem;
    overflow-y: auto;
    flex-grow: 1;
}

/* Export dropdown (Öğrenci Kütüphanesi → İndir butonu) */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 280px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.export-dropdown-menu.open {
    display: block;
}

.export-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: white;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

.export-dropdown-item + .export-dropdown-item {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.export-dropdown-item:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.15);
}

.export-dropdown-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.export-dropdown-item-icon {
    width: 18px;
    height: 18px;
    color: var(--primary);
    flex-shrink: 0;
}

.export-dropdown-item-meta {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
}
