/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --font-outfit: 'Outfit', sans-serif;
    --font-sans: 'Plus Jakarta Sans', sans-serif;
    
    --bg-darker: #080b11;
    --bg-dark: #0f1422;
    --panel-bg: rgba(20, 27, 45, 0.65);
    --panel-bg-hover: rgba(30, 41, 67, 0.8);
    --border-glow: rgba(99, 102, 241, 0.15);
    --border-color: rgba(255, 255, 255, 0.08);
    
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --primary-hover: #4f46e5;
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.2);
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.2);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --sidebar-width: 260px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-darker);
    background-image: 
        radial-gradient(at 10% 10%, rgba(99, 102, 241, 0.1) 0px, transparent 40%),
        radial-gradient(at 90% 85%, rgba(16, 185, 129, 0.08) 0px, transparent 40%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Auth / Login Page Layout */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 10;
}

.auth-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.05);
    position: relative;
    overflow: hidden;
    animation: scaleIn 0.5s ease-out;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 60%);
    pointer-events: none;
    z-index: 1;
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
    z-index: 2;
}

.auth-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.2rem;
    color: white;
    font-size: 1.8rem;
    box-shadow: 0 8px 20px var(--primary-glow);
    animation: float 4s ease-in-out infinite;
}

.auth-title {
    font-family: var(--font-outfit);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #d1d5db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 2;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    transition: var(--transition-smooth);
}

.form-control {
    width: 100%;
    background-color: rgba(8, 11, 17, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 0.9rem 1rem 0.9rem 2.8rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    background-color: var(--bg-darker);
}

.form-control:focus + .input-icon {
    color: var(--primary);
}

/* Button & Alert */
.btn {
    width: 100%;
    font-family: var(--font-outfit);
    font-weight: 600;
    font-size: 1rem;
    padding: 0.9rem 1.5rem;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
    position: relative;
    z-index: 2;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
    color: white;
    box-shadow: 0 4px 15px var(--danger-glow);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.alert {
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.88rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid transparent;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.alert-success {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.25);
    color: #34d399;
}

.alert-info {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.25);
    color: #60a5fa;
}

/* Outer layout Dashboard/Admin */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(12, 17, 30, 0.95);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px var(--primary-glow);
}

.sidebar-brand {
    font-family: var(--font-outfit);
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-user {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.user-badge {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: var(--bg-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    border: 1px solid var(--primary-glow);
    font-weight: bold;
}

.user-info {
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

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

.sidebar-menu {
    list-style: none;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.menu-item a, .menu-item button {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 500;
    transition: var(--transition-smooth);
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.menu-item.active a, .menu-item a:hover, .menu-item button:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.12);
    border-left: 3px solid var(--primary);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Main Content Wrapper */
.main-wrapper {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem 2.5rem;
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .main-wrapper {
        margin-left: 0;
        padding: 1.5rem 1rem;
    }
}

.page-header {
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-family: var(--font-outfit);
    font-weight: 700;
    font-size: 2rem;
}

.page-subtitle {
    font-size: 0.92rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

/* Admin Tabs */
.tabs-navigation {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-secondary);
    font-family: var(--font-outfit);
    font-weight: 600;
    font-size: 1rem;
    padding: 1rem 1.5rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

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

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

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

/* Grid layout for Dashboard apps */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.app-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.app-card::after {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    background: var(--primary-glow);
    filter: blur(40px);
    top: -20px;
    right: -20px;
    border-radius: 50%;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.app-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px var(--border-glow);
    background: var(--panel-bg-hover);
}

.app-card:hover::after {
    width: 120px;
    height: 120px;
}

.app-card-title {
    font-family: var(--font-outfit);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    color: white;
}

.app-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 1.5rem;
}

.app-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-html {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-external {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Stat Panel Cards */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary-glow);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-icon.success {
    background: var(--success-glow);
    color: var(--success);
}

.stat-number {
    font-family: var(--font-outfit);
    font-size: 1.8rem;
    font-weight: 800;
    color: white;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Table Style */
.table-container {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    margin-bottom: 2rem;
}

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

.data-table th {
    background: rgba(8, 11, 17, 0.4);
    padding: 1rem 1.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 1.2rem 1.5rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

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

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

/* Form Styles for Admin App Creation */
.form-panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 800px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

.code-textarea {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.88rem;
    line-height: 1.5;
    background-color: #05070a !important;
    color: #34d399 !important;
    border: 1px solid var(--border-color);
    min-height: 250px;
    resize: vertical;
}

/* Multi-select check lists for teachers */
.teacher-select-box {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(8, 11, 17, 0.8);
    max-height: 180px;
    overflow-y: auto;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.teacher-option {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.4rem;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.teacher-option:hover {
    background: rgba(255, 255, 255, 0.04);
}

.teacher-option input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

.teacher-option span {
    font-size: 0.88rem;
    color: var(--text-primary);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* App View / Frame Layout */
.app-view-container {
    height: calc(100vh - 120px);
    width: 100%;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    background: white;
}

.app-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Animations */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

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