/* ========================================
   MODERN UI STYLES - Teacher's Helper
   Clean, card-based design with gradient stats
   ======================================== */

/* CSS Variables for theming */
:root {
    --sidebar-bg: #ffffff;
    --sidebar-border: #e5e7eb;
    --sidebar-text: #374151;
    --sidebar-text-muted: #6b7280;
    --sidebar-hover: #f3f4f6;
    --sidebar-active-bg: #eff6ff;
    --sidebar-active-text: #2563eb;
    
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --card-border: #e5e7eb;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.1);
    
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    
    /* Gradient colors for stat cards */
    --gradient-blue: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    --gradient-purple: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    --gradient-pink: linear-gradient(135deg, #f472b6 0%, #ec4899 100%);
    --gradient-green: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    --gradient-orange: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
}

/* ========================================
   RESET & BASE STYLES
   ======================================== */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    background: var(--body-bg);
    min-height: 100vh;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

html {
    scroll-behavior: smooth;
}

/* ========================================
   APP SHELL LAYOUT
   ======================================== */

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ========================================
   SIDEBAR - Modern White Style
   ======================================== */

.sidebar {
    width: 240px;
    flex: 0 0 240px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar__brand {
    padding: 20px 20px;
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar__nav {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow-y: auto;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.sidebar__link:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

.sidebar__link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

/* Sidebar icons (using emoji as placeholder) */
.sidebar__link::before {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* ========================================
   MAIN CONTENT AREA
   ======================================== */

.main-col {
    margin-left: 240px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    padding: 24px 32px;
    background: var(--body-bg);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Hide the old app header */
.app-header {
    display: none;
}

/* ========================================
   TOP BAR
   ======================================== */

.topbar {
    height: 60px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 24px;
    gap: 12px;
}

.topbar .btn {
    padding: 8px 16px;
    font-size: 13px;
}

/* ========================================
   CARDS - Modern Style
   ======================================== */

.card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
}

.card:hover {
    transform: none;
    box-shadow: var(--card-shadow);
}

.card h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    padding-bottom: 0;
    border-bottom: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card h2::before {
    font-size: 24px;
}

/* ========================================
   BUTTONS - Modern Style
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary, 
button[type="submit"],
.generate-btn {
    background: var(--text-primary);
    color: white;
    border: none;
}

.btn-primary:hover,
button[type="submit"]:hover,
.generate-btn:hover {
    background: #374151;
}

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

.btn-secondary:hover {
    background: var(--sidebar-hover);
}

/* Analyze All button - keep it prominent */
#analyze-all-btn {
    background: var(--text-primary);
    color: white;
}

/* ========================================
   STAT CARDS - Gradient Style
   ======================================== */

.submissions-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 20px;
    border-radius: var(--border-radius);
    color: white;
    text-align: left;
}

.stat-card:nth-child(1) { background: var(--gradient-blue); }
.stat-card:nth-child(2) { background: var(--gradient-blue); }
.stat-card:nth-child(3) { background: var(--gradient-purple); }
.stat-card:nth-child(4) { background: var(--gradient-purple); }
.stat-card:nth-child(5) { background: var(--gradient-pink); }

.stat-value {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.9;
}

/* ========================================
   SUBMISSIONS LIST - Card Style
   ======================================== */

#submissions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.submission-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    transition: all 0.15s ease;
}

.submission-row:hover {
    border-color: #d1d5db;
    box-shadow: var(--card-shadow-hover);
}

.submission-info {
    flex: 1;
    min-width: 0;
}

.submission-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.submission-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.submission-date {
    color: var(--text-muted);
}

.submission-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--text-primary);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.submission-feedback {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 8px;
}

.submission-feedback::before {
    content: "✓";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #dcfce7;
    color: #16a34a;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
}

.submission-actions {
    display: flex;
    gap: 8px;
}

.submission-actions .btn,
.submission-actions button {
    padding: 8px 16px;
    background: var(--text-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.submission-actions .btn:hover,
.submission-actions button:hover {
    background: #374151;
}

/* ========================================
   FILTER TOOLBAR
   ======================================== */

.filter-toolbar,
.submissions-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
}

.filter-toolbar input[type="text"],
.filter-toolbar input[type="search"],
#submissions-search {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    background: var(--card-bg);
}

.filter-toolbar input:focus,
#submissions-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-toolbar select,
.submissions-filters select {
    padding: 10px 32px 10px 14px;
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    background: var(--card-bg) 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='%236b7280' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E") no-repeat right 12px center;
    appearance: none;
    cursor: pointer;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    transition: all 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ========================================
   PAGE HEADER
   ======================================== */

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

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* ========================================
   DASHBOARD WORKSPACE CARDS
   ======================================== */

.workspace-card {
    background: var(--card-bg) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: var(--border-radius) !important;
    padding: 20px !important;
    transition: all 0.15s ease !important;
}

.workspace-card:hover {
    border-color: var(--primary) !important;
    box-shadow: var(--card-shadow-hover) !important;
    background: var(--card-bg) !important;
}

/* ========================================
   EXPORT DROPDOWN
   ======================================== */

.export-dropdown {
    position: relative;
}

.export-dropdown-content {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-sm);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    z-index: 1000;
    padding: 8px;
}

.export-dropdown-content button {
    width: 100%;
    padding: 10px 14px;
    text-align: left;
    background: none;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-primary);
}

.export-dropdown-content button:hover {
    background: var(--sidebar-hover);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .submissions-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-col {
        margin-left: 0;
    }
    
    .submissions-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .content {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .submissions-stats {
        grid-template-columns: 1fr;
    }
    
    .filter-toolbar {
        flex-direction: column;
    }
    
    .filter-toolbar input {
        width: 100%;
    }
}

/* ========================================
   HIDE DEBUG ELEMENTS
   ======================================== */

/* Hide any debug text */
p[style*="color: red"][style*="font-weight: bold"] {
    display: none !important;
}

/* ========================================
   VIEW SECTIONS
   ======================================== */

.view {
    display: none;
}

/* Override the inline display:block from JS */
section[style*="display: block"],
section.view[style*="display: block"] {
    display: block;
}

/* ========================================
   LOADING STATES
   ======================================== */

#workspaces-loading,
#submissions-loading {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* ========================================
   AUTH CONTAINER
   ======================================== */

#auth-container {
    max-width: 400px;
    margin: 60px auto;
    padding: 32px;
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
}

#auth-container h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

/* Guest banner */
#guest-banner {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 13px;
}
