/* =========================================
   Mars Academy LMS - Admin Panel Styles
   Professional Design - No emojis
   Color palette derived from logo
   ========================================= */

/* CSS Custom Properties */
:root[data-theme="light"] {
    --bg-primary: #f8f9fc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1a0a3e;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --accent: #6c3ce0;
    --accent-hover: #5a2dcf;
    --accent-light: rgba(108, 60, 224, 0.08);
    --gradient-start: #8b5cf6;
    --gradient-end: #f97316;
    --border: #e2e8f0;
    --card-bg: #ffffff;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --card-shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.08);
    --nav-bg: #1a0a3e;
    --nav-text: #c4b5fd;
    --nav-text-active: #ffffff;
    --nav-hover: rgba(255, 255, 255, 0.06);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --sidebar-width: 260px;
}

:root[data-theme="dark"] {
    --bg-primary: #0f0a1e;
    --bg-secondary: #1a1230;
    --bg-tertiary: #241a3d;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-light: rgba(139, 92, 246, 0.12);
    --gradient-start: #8b5cf6;
    --gradient-end: #f97316;
    --border: #2d2548;
    --card-bg: #1a1230;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    --card-shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.3);
    --nav-bg: #0a0618;
    --nav-text: #7c6fb0;
    --nav-text-active: #e2e8f0;
    --nav-hover: rgba(255, 255, 255, 0.04);
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;
    --sidebar-width: 260px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a { text-decoration: none; color: inherit; }

/* =========================================
   Admin Wrapper
   ========================================= */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* =========================================
   Sidebar
   ========================================= */
.sidebar {
    width: var(--sidebar-width);
    background: var(--nav-bg);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: contain;
}

.logo-text-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: -0.5px;
}

.logo-name {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.3px;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--nav-text);
    font-size: 18px;
    cursor: pointer;
}

.sidebar-nav {
    padding: 12px 0;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    display: block;
    padding: 12px 20px 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--nav-text);
    opacity: 0.5;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--nav-text);
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: var(--nav-hover);
    color: var(--nav-text-active);
}

.nav-link.active {
    background: var(--nav-hover);
    color: var(--nav-text-active);
    border-left-color: var(--accent);
}

.nav-link i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

/* =========================================
   Main Content Area
   ========================================= */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

/* =========================================
   Top Navbar
   ========================================= */
.top-navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--card-shadow);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 16px;
    border-left: 1px solid var(--border);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar span {
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

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

.user-name {
    font-size: 13px;
    font-weight: 600;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}

.logout-form { display: inline; }

.btn-logout {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    font-size: 14px;
    transition: color 0.2s;
}

.btn-logout:hover { color: var(--danger); }

/* =========================================
   Page Content
   ========================================= */
.page-content {
    padding: 24px;
}

/* =========================================
   Cards & Stats
   ========================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
}

.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #6c3ce0); }
.stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-icon.green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.orange { background: linear-gradient(135deg, #f97316, #ea580c); }
.stat-icon.pink { background: linear-gradient(135deg, #ec4899, #db2777); }
.stat-icon.amber { background: linear-gradient(135deg, #f59e0b, #d97706); }

.stat-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* =========================================
   Tables
   ========================================= */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.card-body {
    padding: 22px;
}

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

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

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.data-table tbody tr {
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: var(--accent-light);
}

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

/* =========================================
   Badges
   ========================================= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-info { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.badge-purple { background: var(--accent-light); color: var(--accent); }

/* =========================================
   Alerts
   ========================================= */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* =========================================
   Buttons
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gradient-start), var(--accent));
    color: #fff;
    box-shadow: 0 2px 8px rgba(108, 60, 224, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(108, 60, 224, 0.35);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--accent-light);
    border-color: var(--accent);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

/* =========================================
   Forms
   ========================================= */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13.5px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

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

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-color {
    height: 42px;
    padding: 4px;
    cursor: pointer;
}

/* =========================================
   Settings Tabs
   ========================================= */
.settings-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.settings-tab {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: capitalize;
    transition: all 0.2s ease;
}

.settings-tab:hover {
    background: var(--card-bg);
    color: var(--text-primary);
}

.settings-tab.active {
    background: var(--accent);
    color: #fff;
}

/* =========================================
   Grid Layouts
   ========================================= */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* =========================================
   Login Page
   ========================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    background: var(--nav-bg);
}

.login-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: linear-gradient(135deg, #1a0a3e 0%, #2d1670 50%, #1a0a3e 100%);
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15), transparent 70%);
    top: -100px;
    right: -100px;
}

.login-left::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.1), transparent 70%);
    bottom: -80px;
    left: -80px;
}

.login-brand {
    position: relative;
    z-index: 1;
    text-align: center;
}

.login-brand .logo-text-icon {
    width: 72px;
    height: 72px;
    font-size: 26px;
    margin: 0 auto 20px;
    border-radius: 18px;
}

.login-brand h1 {
    color: #fff;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.login-brand p {
    color: #c4b5fd;
    font-size: 15px;
    font-weight: 400;
}

.login-right {
    width: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--card-bg);
}

.login-form-wrapper {
    width: 100%;
    max-width: 380px;
}

.login-form-wrapper h2 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-form-wrapper p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 32px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .btn-primary {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    justify-content: center;
}

.login-error {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 13px;
    color: var(--text-secondary);
}

.remember-row input[type="checkbox"] {
    accent-color: var(--accent);
}

/* =========================================
   Dashboard Activity
   ========================================= */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-text {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

.activity-text strong { font-weight: 600; }

.activity-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }
    .sidebar-close { display: block; }
    .sidebar-toggle { display: block; }
    .main-content { margin-left: 0; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .login-page { flex-direction: column; }
    .login-left { padding: 32px 20px; min-height: auto; }
    .login-right { width: 100%; padding: 32px 20px; }
    .login-brand h1 { font-size: 24px; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 22px; }
    .page-content { padding: 16px; }
    .top-navbar { padding: 0 16px; }
    .navbar-user .user-info { display: none; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* =========================================
   Pagination (Laravel Default)
   ========================================= */
nav[role="navigation"] {
    width: 100%;
}

nav[role="navigation"] .flex.justify-between,
nav[role="navigation"] > div:first-child {
    display: none !important;
}

nav[role="navigation"] > div:last-child {
    display: flex;
    justify-content: center;
}

nav[role="navigation"] span[aria-current="page"] span,
nav[role="navigation"] a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    margin: 0 2px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-primary);
}

nav[role="navigation"] span[aria-current="page"] span {
    background: linear-gradient(135deg, var(--gradient-start), var(--accent));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(108, 60, 224, 0.25);
}

nav[role="navigation"] a:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

nav[role="navigation"] a[rel="prev"],
nav[role="navigation"] a[rel="next"] {
    font-size: 0;
}

nav[role="navigation"] a[rel="prev"]::before {
    content: '\f053';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 12px;
}

nav[role="navigation"] a[rel="next"]::before {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 12px;
}

nav[role="navigation"] svg {
    width: 16px;
    height: 16px;
}

nav[role="navigation"] .hidden {
    display: none !important;
}

/* Disabled pagination links */
nav[role="navigation"] span[aria-disabled="true"] span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    margin: 0 2px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

nav[role="navigation"] span[aria-disabled="true"] svg {
    width: 16px;
    height: 16px;
}
