/* Design System & CSS Variables */
:root {
    /* Fonts */
    --font-family: 'Plus Jakarta Sans', sans-serif;
    
    /* Common Light Theme Colors */
    --bg-app: #f4f6fc;
    --bg-sidebar: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-card-hover: rgba(255, 255, 255, 0.85);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-inverse: #ffffff;
    
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --primary-dark: #1d4ed8;
    --secondary: #4f46e5;
    
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --neutral-light: #f8fafc;
    
    --border-color: rgba(226, 232, 240, 0.8);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --glass-blur: 16px;
    --glass-border: rgba(255, 255, 255, 0.4);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Overrides */
.theme-dark {
    --bg-app: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-inverse: #0f172a;
    
    --primary: #3b82f6;
    --primary-light: rgba(59, 130, 246, 0.1);
    --primary-dark: #60a5fa;
    --secondary: #6366f1;
    
    --success: #34d399;
    --success-light: rgba(52, 211, 153, 0.1);
    --warning: #fbbf24;
    --warning-light: rgba(251, 191, 36, 0.1);
    --danger: #f87171;
    --danger-light: rgba(248, 113, 113, 0.1);
    --neutral-light: #1e293b;
    
    --border-color: rgba(51, 65, 85, 0.8);
    --glass-border: rgba(255, 255, 255, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: var(--transition);
    position: relative;
}

/* Ambient Blobs */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
    transition: var(--transition);
}
.theme-dark .blob {
    opacity: 0.1;
}
.blob-1 {
    top: 5%;
    right: 10%;
    width: 350px;
    height: 350px;
    background: var(--primary);
}
.blob-2 {
    bottom: 10%;
    left: 5%;
    width: 400px;
    height: 400px;
    background: var(--secondary);
}
.blob-3 {
    top: 45%;
    left: 45%;
    width: 250px;
    height: 250px;
    background: var(--success);
}

/* Layout Framework */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.app-sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 10;
    transition: var(--transition);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}
.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}
.logo-text h1 {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    line-height: 1;
}
.logo-text span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

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

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
}
.menu-item i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}
.menu-item:hover {
    color: var(--primary);
    background-color: var(--primary-light);
}
.menu-item.active {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}
.btn-theme {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background-color: transparent;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.btn-theme:hover {
    background-color: var(--neutral-light);
}

/* Main Dashboard Framework */
.app-main {
    flex-grow: 1;
    margin-left: 280px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}
.header-info h2 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
}
.header-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Preset cases loader */
.preset-loader {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--bg-sidebar);
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}
.preset-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 0 0.5rem;
    text-transform: uppercase;
}

/* Button UI */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
}
.btn-preset {
    background-color: var(--neutral-light);
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-preset:hover {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}
.btn-preset.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-reset {
    background-color: var(--danger-light);
    color: var(--danger);
    border: 1px solid transparent;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.btn-reset:hover {
    background-color: var(--danger);
    color: white;
    transform: rotate(-45deg);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.3);
}

.btn-neutral {
    background-color: var(--neutral-light);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.btn-neutral:hover {
    background-color: var(--border-color);
}

/* Card Styling (Glassmorphism) */
.card {
    background-color: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    overflow: hidden;
}
.card:hover {
    background-color: var(--bg-card-hover);
    box-shadow: var(--shadow-lg);
}

.card-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}
.card-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}
.card-header h3 i {
    color: var(--primary);
}

/* Grid helper */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.d-none { display: none !important; }
.w-full { width: 100%; }
.flex-1 { flex: 1; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.d-flex { display: flex; }
.gap-4 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.text-secondary { color: var(--text-secondary); }
.text-xs { font-size: 0.75rem; }

/* Form Controls */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}
.form-group label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-sidebar);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
    transition: var(--transition);
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.help-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Custom Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 32px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    user-select: none;
}
.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}
.checkmark {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    height: 22px;
    width: 22px;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: var(--transition);
}
.checkbox-container:hover input ~ .checkmark {
    background-color: var(--neutral-light);
}
.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}
.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}
.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}
.checkbox-container .checkmark:after {
    left: 7px;
    top: 3px;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

/* Table Design */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}
.table th, .table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    color: var(--text-primary);
}
.table th {
    background-color: var(--neutral-light);
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.table tbody tr:hover td {
    background-color: var(--neutral-light);
}
.table-bordered th, .table-bordered td {
    border: 1px solid var(--border-color);
}
.table-striped tbody tr:nth-of-type(odd) td {
    background-color: rgba(248, 250, 252, 0.4);
}
.theme-dark .table-striped tbody tr:nth-of-type(odd) td {
    background-color: rgba(30, 41, 59, 0.2);
}

/* Table Rapor Inputs specifics */
.table input[type="number"] {
    width: 80px;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-sidebar);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: var(--transition);
}
.table input[type="number"]:focus {
    border-color: var(--primary);
}
.table .subject-name {
    font-weight: 700;
}
.table .avg-cell {
    font-weight: 800;
    color: var(--primary);
    text-align: center;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}
.badge-info {
    background-color: var(--primary-light);
    color: var(--primary);
}
.badge-success {
    background-color: var(--success-light);
    color: var(--success);
}
.badge-warning {
    background-color: var(--warning-light);
    color: var(--warning);
}
.badge-danger {
    background-color: var(--danger-light);
    color: var(--danger);
}

/* Alert UI */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.4;
}
.alert-neutral {
    background-color: var(--neutral-light);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.alert-neutral i {
    color: var(--primary);
    font-size: 1.1rem;
}

/* Tabs Display */
.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}
.tab-pane.active {
    display: block;
}

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

/* Final Score Board */
.result-score-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}
.score-card {
    border-radius: 20px;
    padding: 2.25rem;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.score-card::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    top: -50px;
    right: -50px;
    pointer-events: none;
}
.card-akad {
    background: linear-gradient(135deg, #1d4ed8, #4f46e5);
}
.card-non-akad {
    background: linear-gradient(135deg, #0d9488, #0f766e);
}
.score-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.85;
}
.score-card h4 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
}
.score-value {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.75rem;
}
.score-desc {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 500;
}

/* Chart Styles */
.chart-segment {
    transition: var(--transition);
    cursor: pointer;
}
.chart-segment:hover {
    stroke-width: 26;
    opacity: 0.9;
}
.chart-center-text {
    font-family: var(--font-family);
}

/* Toast styling */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--text-primary);
    color: var(--bg-app);
    padding: 0.85rem 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    transform: translateY(0);
    opacity: 1;
}
.toast.hidden {
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
}

/* Responsive configurations */
@media (max-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .app-sidebar {
        width: 80px;
        padding: 1.5rem 0.5rem;
    }
    .logo-text, .menu-item span, .btn-theme span {
        display: none;
    }
    .sidebar-header {
        justify-content: center;
        margin-bottom: 2rem;
    }
    .menu-item {
        justify-content: center;
        padding: 0.85rem 0;
    }
    .app-main {
        margin-left: 80px;
        padding: 1.5rem;
    }
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .preset-loader {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
    .result-score-grid {
        grid-template-columns: 1fr;
    }
}
