/* =========================================================================
   VARIABLES & THEMING
   ========================================================================= */
:root {
    /* Dark Theme Colors */
    --bg-base: #0f0f13;
    --bg-surface: rgba(26, 26, 36, 0.7);
    --bg-surface-hover: rgba(36, 36, 48, 0.8);
    --bg-surface-solid: #1a1a24;

    --primary: #6c5ce7;
    --primary-hover: #5f27cd;
    --primary-light: rgba(108, 92, 231, 0.15);

    --accent: #00d2d3;
    --accent-light: rgba(0, 210, 211, 0.15);

    --success: #10ac84;
    --success-light: rgba(16, 172, 132, 0.15);

    --warning: #ffb142;
    --warning-light: rgba(255, 177, 66, 0.15);

    --error: #ff5252;
    --error-light: rgba(255, 82, 82, 0.15);

    --text-main: #f5f6fa;
    --text-muted: #a4b0be;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(108, 92, 231, 0.4);

    /* Spacing & Sizes */
    --sidebar-width: 260px;
    --header-height: 70px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    /* Animation */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* =========================================================================
   RESET & BASE STYLES
   ========================================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    background-image:
        radial-gradient(at 0% 0%, rgba(108, 92, 231, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(0, 210, 211, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

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

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

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

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

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

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

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

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

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

.bg-success-light {
    background-color: var(--success-light);
}

.bg-warning-light {
    background-color: var(--warning-light);
}

.bg-accent-light {
    background-color: var(--accent-light);
}

.bg-error-light {
    background-color: var(--error-light);
}

/* =========================================================================
   UI COMPONENTS
   ========================================================================= */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    outline: none;
    color: white;
}

.btn:focus-visible {
    box-shadow: 0 0 0 3px var(--border-glow);
}

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

.btn-block {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.btn-primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

.btn-primary:not(:disabled):active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
}

.btn-secondary:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: var(--error);
    background: linear-gradient(135deg, var(--error), #d63031);
}

.btn-danger:hover {
    background: #d63031;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.btn-icon.danger:hover {
    color: var(--error);
    background: var(--error-light);
}

/* Forms & Inputs */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
}

.input-wrapper input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.input-wrapper input:focus,
input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
    background: rgba(0, 0, 0, 0.3);
}

input[type="text"],
input[type="number"],
input[type="datetime-local"],
textarea,
select.custom-select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

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

select.custom-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a4b0be' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
}

select.custom-select option {
    background: var(--bg-surface-solid);
    color: var(--text-main);
}

/* Form Arrays (JSON inputs) */
.array-container {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 12px;
}

.array-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
    position: relative;
}

.array-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.array-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* =========================================================================
   LOGIN SCREEN
   ========================================================================= */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 400px;
    padding: 40px 30px;
    border-radius: var(--radius-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo-circle {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 16px;
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4);
}

.login-header h2 {
    font-weight: 600;
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* =========================================================================
   APP LAYOUT
   ========================================================================= */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: none;
    z-index: 10;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.logo-box {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.sidebar-nav {
    padding: 24px 16px;
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 12px 8px;
}

.nav-group-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1px;
    padding: 8px;
    margin-top: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: white;
    background: var(--primary);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.user-info .avatar {
    width: 36px;
    height: 36px;
    background: var(--bg-surface-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}

.user-info .details {
    display: flex;
    flex-direction: column;
}

.user-info .name {
    font-size: 0.85rem;
    font-weight: 600;
}

.user-info .role {
    font-size: 0.75rem;
    color: var(--accent);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    padding: 30px 40px;
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
}

.header-titles h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.header-titles p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* --- Expandable Panels (Dashboard) --- */
.expandable-panel {
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    background: rgba(30, 41, 59, 0.6);
}

.panel-header:hover {
    background: rgba(30, 41, 59, 0.9);
}

.toggle-icon {
    transition: transform 0.3s ease;
    color: var(--text-muted);
}

.expandable-panel.expanded .toggle-icon {
    transform: rotate(180deg);
}

.panel-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    background: rgba(15, 23, 42, 0.5);
}

.expandable-panel.expanded .panel-content {
    max-height: 800px;
    overflow-y: auto;
}

.student-status-list {
    padding: 16px 20px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.status-row:last-child {
    border-bottom: none;
}

.status-row.has-item {
    background: rgba(34, 197, 94, 0.05);
    /* Yeşil transparan vurgu */
}

.status-row.no-item {
    background: rgba(239, 68, 68, 0.05);
    /* Kırmızı transparan vurgu */
}

.stat-details h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Data Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
}

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

.data-table th,
.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 0.95rem;
    vertical-align: middle;
}

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

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

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.actions-col {
    width: 120px;
    text-align: right;
}

.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-surface-hover);
}

/* =========================================================================
   MODALS
   ========================================================================= */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
}

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

/* =========================================================================
   TOASTS & LOADING
   ========================================================================= */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: toastSlideIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--error);
}

.toast-warning {
    background: var(--warning);
}

.toast-info {
    background: var(--primary);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastFadeOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 19, 0.8);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(108, 92, 231, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
    }

    .sidebar-nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        padding: 12px;
    }

    .nav-divider,
    .nav-group-title,
    .user-info .details {
        display: none;
    }

    .main-content {
        padding: 16px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

/* =========================================================================
   STUDENT RESULTS & ANALYSIS
   ========================================================================= */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-fast);
}

.result-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

.result-info h4 {
    margin: 0 0 4px 0;
    color: var(--text-main);
    font-size: 1rem;
}

.result-info p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

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

.score-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: 700;
}

.score-badge.high {
    background: var(--success-light);
    color: var(--success);
}

.score-badge.medium {
    background: var(--warning-light);
    color: var(--warning);
}

.score-badge.low {
    background: var(--error-light);
    color: var(--error);
}

.result-stats {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
    margin-top: 6px;
    color: var(--text-muted);
}

.result-stats span.correct {
    color: var(--success);
}

.result-stats span.wrong {
    color: var(--error);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    margin-top: 8px;
    text-decoration: underline;
}

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

.answers-list {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.answer-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    font-size: 0.85rem;
}

.answer-item.correct {
    border-left: 3px solid var(--success);
}

.answer-item.wrong {
    border-left: 3px solid var(--error);
}

.answer-item.unanswered {
    border-left: 3px solid var(--text-muted);
}

.answer-info strong {
    color: var(--text-main);
    display: block;
    margin-bottom: 2px;
}

.answer-info span {
    color: var(--text-muted);
    font-size: 0.8rem;
}