:root {
    --primary-color: #059669;
    /* Emerald 600 */
    --primary-light: #10b981;
    /* Emerald 500 */
    --primary-op: rgba(5, 150, 105, 0.1);
    --secondary-color: #047857;
    /* Emerald 700 */
    --bg-color: #f8fafc;
    /* Slate 50 */
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    /* Slate 800 */
    --text-muted: #64748b;
    /* Slate 500 */
    --border-color: #e2e8f0;
    /* Slate 200 */
    --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);
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    touch-action: manipulation;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    color: var(--text-main);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.logo i {
    font-size: 28px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    background-clip: padding-box;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar.collapsed .logo span {
    display: none;
}

.toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 20px;
    transition: color 0.2s;
}

.toggle-btn:hover {
    color: var(--primary-color);
}

.d-mobile-only {
    display: none;
}

.nav-links {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-links li {
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.nav-links a i {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.nav-links li:hover a {
    background-color: var(--primary-op);
    color: var(--primary-color);
}

.nav-links li.active a {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.sidebar.collapsed .nav-links span {
    display: none;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    object-fit: cover;
}

.user-details h4 {
    font-size: 14px;
    margin: 0;
}

.user-details p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

.sidebar.collapsed .user-details {
    display: none;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background-color: var(--bg-color);
}

/* Auth Overlay & Card */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.auth-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.auth-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.top-header {
    height: 72px;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 32px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    padding: 10px 16px;
    border-radius: 24px;
    width: 350px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.search-bar:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-op);
}

.search-bar i {
    color: var(--text-muted);
    margin-right: 12px;
}

.search-bar input {
    border: none;
    background: none;
    outline: none;
    width: 100%;
    color: var(--text-main);
    font-size: 14px;
    font-family: 'Outfit', sans-serif;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Header Profile */
.header-profile {
    position: relative;
}

.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    width: 200px;
    padding: 8px 0;
    margin-top: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 100;
}

.profile-dropdown.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.profile-dropdown ul li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-main);
    transition: background 0.2s;
}

.profile-dropdown ul li a:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.profile-dropdown ul li.divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

/* Notification Dropdown */
.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-top: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.notification-dropdown.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.notification-header h4 {
    margin: 0;
    font-size: 16px;
}

.notification-header small {
    background: var(--primary-op);
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-list li {
    display: flex;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
    cursor: pointer;
}

.notification-list li:hover {
    background: var(--bg-color);
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.notification-text p {
    margin: 0;
    font-size: 13px;
    color: var(--text-main);
    line-height: 1.4;
}

.notification-text small {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 4px;
    display: block;
}

.notification-footer {
    padding: 12px;
    text-align: center;
}

.notification-footer a {
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 500;
}

.notification-footer a:hover {
    text-decoration: underline;
}

.text-danger {
    color: var(--danger) !important;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    position: relative;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.icon-btn:hover {
    background-color: var(--bg-color);
    color: var(--text-main);
}

.badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: bold;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--card-bg);
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-family: inherit;
    border: none;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: var(--primary-op);
}

.w-100 {
    width: 100%;
    justify-content: center;
}

/* Tabs */
.tab-content {
    display: none;
    padding: 32px;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 28px;
    margin-bottom: 4px;
}

.page-header p {
    color: var(--text-muted);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-op);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.revenue-icon {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--primary-color);
}

.students-icon {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.courses-icon {
    background-color: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.pending-icon {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-details h3 {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-details h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.trend {
    font-size: 13px;
    font-weight: 500;
}

.trend.positive {
    color: var(--success);
}

.trend.negative {
    color: var(--danger);
}

.trend.neutral {
    color: var(--text-muted);
}

/* Charts Area */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.chart-container {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.chart-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Tables */
.table-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 16px 24px;
    text-align: left;
}

.data-table th {
    background-color: var(--bg-color);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background-color: var(--bg-color);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-active {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-inactive {
    background-color: rgba(100, 116, 139, 0.1);
    color: var(--text-muted);
}

/* AI Predictor Config */
.ai-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
    height: 600px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.ai-sidebar {
    background-color: var(--bg-color);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.ai-prompt-card h3 {
    margin-bottom: 8px;
    color: var(--primary-color);
}

.ai-prompt-card p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.prompt-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.prompt-btn {
    background: white;
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: var(--radius-md);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}

.prompt-btn i {
    color: var(--primary-color);
    font-size: 18px;
}

.prompt-btn:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px rgba(5, 150, 105, 0.1);
    transform: translateY(-2px);
}

.custom-prompt {
    margin-top: auto;
}

.custom-prompt textarea {
    width: 100%;
    height: 100px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    resize: none;
    font-family: inherit;
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.2s;
}

.custom-prompt textarea:focus {
    border-color: var(--primary-color);
}

.ai-results-area {
    padding: 32px;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

.ai-status {
    margin: auto;
    text-align: center;
    color: var(--text-muted);
}

.ai-status i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--border-color);
}

.ai-loading {
    margin: auto;
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(5, 150, 105, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.ai-response-content {
    line-height: 1.6;
}

.ai-response-content h3 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--text-main);
}

.ai-response-content ul {
    list-style-type: disc;
    margin-left: 20px;
    margin-bottom: 16px;
}

.ai-response-content p {
    margin-bottom: 16px;
}

.hidden {
    display: none !important;
}

/* API Settings */
.settings-card {
    background: var(--card-bg);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    max-width: 600px;
}

.settings-card h3 {
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-op);
}

.form-group small {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-modal {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 24px;
    text-align: center;
}

.api-setup-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-op);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 16px;
}

.modal-body p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.modal-body input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    text-align: center;
    margin-bottom: 12px;
}

.modal-body input:focus {
    border-color: var(--primary-color);
}

.help-text {
    font-size: 13px !important;
}

.help-text a {
    color: var(--primary-color);
    text-decoration: underline;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* App Toast Notification */
.app-toast {
    position: fixed;
    bottom: -100px;
    right: 32px;
    background: var(--card-bg);
    color: var(--text-main);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid var(--primary-color);
}

.app-toast.show {
    bottom: 32px;
}

.app-toast.error {
    border-left-color: var(--danger);
}

.app-toast i {
    font-size: 20px;
}

.app-toast.success i {
    color: var(--primary-color);
}

.app-toast.error i {
    color: var(--danger);
}

.app-toast-text {
    font-size: 14px;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
}

/* Responsive */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .ai-container {
        grid-template-columns: 1fr;
        height: auto;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        height: 100%;
        transform: translateX(-100%);
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .top-header {
        padding: 0 16px;
        height: auto;
        min-height: 72px;
        flex-wrap: wrap;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .header-greeting {
        flex: 1;
    }

    .search-bar {
        width: 100%;
        margin-top: 12px;
        order: 3;
    }

    .header-actions {
        order: 2;
    }

    .tab-content {
        padding: 16px;
    }

    .d-none-mobile {
        display: none !important;
    }

    .d-mobile-only {
        display: block;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}