/* CSS Variables for Premium Dark Glassmorphic Design System */
:root {
    --bg-gradient: linear-gradient(135deg, #0f0c20 0%, #15102a 50%, #06040c 100%);
    --panel-bg: rgba(25, 20, 45, 0.45);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #a29db8;
    --text-muted: #6f6b85;
    
    --primary: #8a2be2;
    --primary-hover: #9d4edd;
    --primary-glow: rgba(138, 43, 226, 0.35);
    
    --accent-teal: #00f5d4;
    --accent-orange: #ff9f43;
    --danger: #ff5470;
    --danger-hover: #ff7088;
    --success: #2ecc71;
    
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global resets and body styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.glass-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Buttons */
.btn {
    font-family: var(--font-family);
    font-weight: 500;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(138, 43, 226, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: rgba(255, 84, 112, 0.15);
    color: var(--danger);
    border: 1px solid rgba(255, 84, 112, 0.25);
}
.btn-danger:hover {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 84, 112, 0.3);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: #fff;
    font-family: var(--font-family);
    font-size: 14px;
    outline: none;
    transition: var(--transition-smooth);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(138, 43, 226, 0.15);
    background: rgba(255, 255, 255, 0.07);
}

/* Form switch toggle styling */
.form-group-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.switch-container {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}
.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 34px;
    transition: .3s;
}
.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .3s;
}
input:checked + .switch-slider {
    background-color: var(--primary);
}
input:checked + .switch-slider:before {
    transform: translateX(20px);
}

.form-group-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}
.form-group-toggle input[type="radio"] {
    display: none;
}
.form-group-toggle label {
    flex: 1;
    text-align: center;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
    user-select: none;
}
.form-group-toggle input[type="radio"]:checked + label {
    background: var(--primary);
    color: #fff;
}

/* LOGIN VIEW */
.login-view-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 35px;
}

.login-header {
    text-align: center;
    margin-bottom: 25px;
}
.login-header h2 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #a29db8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 5px;
}

.error-text {
    color: var(--danger);
    font-size: 13px;
    margin-top: 5px;
    background: rgba(255, 84, 112, 0.1);
    padding: 10px;
    border-radius: 8px;
    border-left: 3px solid var(--danger);
}

/* DASHBOARD LAYOUT */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(15, 10, 30, 0.8);
    border-right: 1px solid var(--panel-border);
    backdrop-filter: blur(25px);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    height: 100vh;
    left: 0; top: 0;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}
.admin-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: #fff;
    box-shadow: 0 4px 10px rgba(138, 43, 226, 0.3);
}
.admin-info h4 {
    font-size: 15px;
    font-weight: 600;
}
.admin-role-badge {
    font-size: 11px;
    color: var(--accent-orange);
    background: rgba(255, 159, 67, 0.1);
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
    display: inline-block;
    margin-top: 3px;
}

.sidebar-nav {
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-btn {
    width: 100%;
    padding: 12px 15px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-weight: 500;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-smooth);
}
.nav-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}
.nav-btn.active {
    color: #fff;
    background: rgba(138, 43, 226, 0.15);
    border-left: 3px solid var(--primary);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-logout-sidebar {
    width: 100%;
    background: transparent;
    border: none;
    padding: 10px;
    color: var(--text-muted);
    font-family: var(--font-family);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-smooth);
}
.btn-logout-sidebar:hover {
    color: var(--danger);
}

/* Main Content Area */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 40px;
    max-width: 1200px;
    width: calc(100% - 260px);
}

.tab-header {
    margin-bottom: 30px;
}
.tab-header h1 {
    font-size: 26px;
    font-weight: 700;
}
.tab-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* TAB 1: PAYMENTS (Receipts Grid) */
.receipts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.receipt-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.receipt-card-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.receipt-card-header h3 {
    font-size: 16px;
    font-weight: 600;
}
.receipt-card-header span {
    font-size: 13px;
    color: var(--text-secondary);
}

.receipt-image-preview {
    height: 180px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
}
.receipt-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}
.receipt-image-preview:hover img {
    transform: scale(1.03);
}
.receipt-image-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #fff;
    font-weight: 500;
    transition: var(--transition-smooth);
}
.receipt-image-preview:hover .receipt-image-overlay {
    opacity: 1;
}

.receipt-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.no-receipts {
    grid-column: 1/-1;
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}
.no-receipts span {
    font-size: 48px;
    display: block;
    margin-bottom: 10px;
}

/* TAB 2: CONTENT (Split Layout) */
.content-split-layout {
    display: flex;
    gap: 25px;
    min-height: 500px;
}

.content-pane-left {
    width: 320px;
    flex-shrink: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.subjects-tree {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
}

.subject-tree-item {
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-smooth);
}
.subject-tree-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.subject-tree-item.active {
    background: rgba(138, 43, 226, 0.15);
    border-color: rgba(138, 43, 226, 0.3);
    color: #fff;
}

.content-pane-right {
    flex: 1;
    padding: 30px;
}

.empty-state-detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: var(--text-muted);
}
.empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 15px;
}
.detail-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 25px;
}

.detail-section {
    margin-top: 25px;
}
.section-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}
.section-title-bar h3 {
    font-size: 16px;
    font-weight: 600;
}

.btn-back-link {
    background: transparent;
    border: none;
    color: var(--primary-hover);
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 500;
    outline: none;
}
.btn-back-link:hover {
    text-decoration: underline;
}

/* Content Tree Lists */
.lessons-list-group, .quizzes-list-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lesson-list-item, .quiz-list-item {
    padding: 15px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-smooth);
}
.lesson-list-item:hover {
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

.lesson-item-info, .quiz-item-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.lesson-item-info h4 {
    font-size: 14px;
    font-weight: 500;
}
.lesson-item-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.quiz-item-info h4 {
    font-size: 14px;
    font-weight: 500;
}
.quiz-item-options {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.quiz-option-pill {
    background: rgba(255, 255, 255, 0.04);
    padding: 2px 8px;
    border-radius: 4px;
}
.quiz-option-pill.correct {
    background: rgba(46, 204, 113, 0.15);
    color: var(--success);
    border: 1px solid rgba(46, 204, 113, 0.2);
}

.media-urls-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.02);
    padding: 15px;
    border-radius: 10px;
}
.media-url-badge {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    word-break: break-all;
}

/* TAB 3: SETTINGS */
.settings-card-form {
    max-width: 600px;
    padding: 35px;
}

.super-settings-section {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 25px;
    padding-top: 20px;
}
.super-settings-section h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent-orange);
    margin-bottom: 15px;
}

.feedback-msg {
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 15px;
}
.feedback-msg.success {
    background: rgba(46, 204, 113, 0.1);
    color: var(--success);
    border-left: 3px solid var(--success);
}
.feedback-msg.error {
    background: rgba(255, 84, 112, 0.1);
    color: var(--danger);
    border-left: 3px solid var(--danger);
}

/* TAB 4: RESULTS (Stats Grid & Table) */
.stats-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stats-overview-item {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}
.stats-icon {
    font-size: 32px;
}
.stats-data h3 {
    font-size: 24px;
    font-weight: 700;
}
.stats-data p {
    font-size: 12px;
    color: var(--text-secondary);
}

.results-filtering-card {
    padding: 25px;
    margin-bottom: 25px;
}
.results-filtering-card h3 {
    font-size: 16px;
    margin-bottom: 15px;
}
.filter-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.results-list-card {
    padding: 25px;
}
.table-title-bar {
    margin-bottom: 15px;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}
.data-table th, .data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.data-table th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
}
.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* TAB 5: ADMINS (Admins Tab Split Layout) */
.admins-split-layout {
    display: grid;
    grid-template-columns: 4fr 5fr;
    gap: 25px;
}

.admins-form-card {
    padding: 30px;
}
.admins-form-card h3 {
    margin-bottom: 20px;
}

.admins-list-card {
    padding: 30px;
}
.admins-list-card h3 {
    margin-bottom: 20px;
}

.admins-list-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-list-item {
    padding: 15px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-item-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.admin-item-title {
    font-size: 14px;
    font-weight: 500;
}
.admin-item-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 10px;
}

.admin-item-right {
    display: flex;
    gap: 8px;
}

/* MODAL DIALOGS */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    transition: var(--transition-smooth);
}

.modal-content {
    width: 100%;
    max-width: 500px;
    padding: 30px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 15px;
}
.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    outline: none;
}
.btn-close:hover {
    color: #fff;
}

/* Zoomed image viewer specific */
.zoomable-receipt {
    max-width: 90vh;
    padding: 10px;
}
.receipt-modal-body {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}
.image-zoom-container {
    max-height: 70vh;
    max-width: 100%;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
.image-zoom-container img {
    max-height: 70vh;
    max-width: 100%;
    object-fit: contain;
    border-radius: 8px;
}

/* File Upload tabs inside modal */
.media-upload-tabs {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 15px;
}
.media-upload-section {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 15px;
}
.media-upload-section h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

/* Responsive queries */
@media (max-width: 992px) {
    .content-split-layout {
        flex-direction: column;
    }
    .content-pane-left {
        width: 100%;
        min-height: 200px;
    }
    .admins-split-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .admin-info, .sidebar h4, .sidebar .nav-btn span:not(.nav-icon), .sidebar-footer button span:not(.nav-icon) {
        display: none;
    }
    .main-content {
        margin-left: 60px;
        width: calc(100% - 60px);
        padding: 20px;
    }
    .filter-controls {
        grid-template-columns: 1fr;
    }
}
