/**
 * Edu-AI Shared Styles
 * CSS compartido entre index.html y notebooklm.html
 *
 * Secciones:
 * 1. CSS Variables (:root)
 * 2. Base Styles (body, fonts)
 * 3. Layout (sidebar, main, header)
 * 4. Navigation
 * 5. Cards
 * 6. Buttons
 * 7. Forms
 * 8. Empty States
 * 9. Animations
 */

/* ==========================================================================
   1. CSS VARIABLES
   ========================================================================== */

:root {
    /* Primary Colors */
    --primary: #00d2ff;
    --primary-soft: rgba(0, 210, 255, 0.15);
    --secondary: #3a7bd5;

    /* Accent Colors */
    --accent: #10b981;
    --accent-soft: rgba(16, 185, 129, 0.15);
    --accent-purple: #a855f7;
    --accent-purple-soft: rgba(168, 85, 247, 0.15);

    /* Status Colors */
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.15);

    /* Background Colors */
    --bg: #0f172a;
    --bg-elevated: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.8);
    --card-border: rgba(255, 255, 255, 0.08);

    /* Text Colors */
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
}

/* ==========================================================================
   2. BASE STYLES
   ========================================================================== */

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at top right, rgba(0, 210, 255, 0.08), transparent 50%),
        radial-gradient(ellipse at bottom left, rgba(59, 130, 246, 0.05), transparent 50%);
    color: var(--text);
    margin: 0;
    display: flex;
    min-height: 100vh;
}

/* ==========================================================================
   3. LAYOUT - Sidebar, Main, Header
   ========================================================================== */

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--card-border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 70px;
    padding: 1rem 0.75rem;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.logo::before {
    content: "🎓";
    -webkit-text-fill-color: initial;
    flex-shrink: 0;
}

.sidebar.collapsed .logo {
    opacity: 0;
    width: 0;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 0.375rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.sidebar.collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

/* Main Content Area */
.main {
    flex: 1;
    padding: 2rem 2.5rem;
    overflow-y: auto;
    max-height: 100vh;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0;
}

.user-info {
    font-size: 0.875rem;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border-radius: 2rem;
    border: 1px solid var(--card-border);
}

/* ==========================================================================
   4. NAVIGATION
   ========================================================================== */

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.nav-item {
    padding: 0.875rem 1rem;
    border-radius: 0.625rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.925rem;
    white-space: nowrap;
    overflow: hidden;
}

.nav-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 1.5rem;
    text-align: center;
}

.nav-text {
    transition: opacity 0.3s ease, width 0.3s ease;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-item {
    padding: 0.875rem 0;
    justify-content: center;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 500;
}

.nav-item.highlight {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(59, 130, 246, 0.15));
    border: 1px solid rgba(168, 85, 247, 0.25);
    color: var(--accent-purple);
}

/* ==========================================================================
   5. CARDS
   ========================================================================== */

.card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    transition: border-color 0.2s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Grid Layout for Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
}

.card-span-12 { grid-column: span 12; }
.card-span-8 { grid-column: span 8; }
.card-span-7 { grid-column: span 7; }
.card-span-6 { grid-column: span 6; }
.card-span-5 { grid-column: span 5; }
.card-span-4 { grid-column: span 4; }
.card-span-3 { grid-column: span 3; }

@media (max-width: 1200px) {
    .card-span-8,
    .card-span-7,
    .card-span-6,
    .card-span-5,
    .card-span-4,
    .card-span-3 {
        grid-column: span 12;
    }
}

/* ==========================================================================
   6. BUTTONS
   ========================================================================== */

/* Primary Button */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    padding: 0.875rem 1.75rem;
    border-radius: 0.625rem;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 210, 255, 0.25);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 210, 255, 0.35);
}

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

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Secondary Button */
.btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.75rem 1.5rem;
    border-radius: 0.625rem;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.925rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text);
}

/* Preview Button (Green) */
.btn-preview {
    background: linear-gradient(135deg, var(--accent), #059669);
    border: none;
    padding: 0.5rem 0.875rem;
    border-radius: 0.5rem;
    color: white;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.2s ease;
}

.btn-preview:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

/* Download Button */
.btn-download {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.5rem 0.875rem;
    border-radius: 0.5rem;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.2s ease;
}

.btn-download:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text);
}

/* Delete Button */
.btn-delete {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.25);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    color: var(--danger);
    font-weight: 500;
    cursor: pointer;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: var(--danger-soft);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Refresh Button */
.btn-refresh {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.825rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.2s ease;
}

.btn-refresh:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text);
}

/* ==========================================================================
   7. FORMS
   ========================================================================== */

/* Form Section Groups */
.form-section {
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

.form-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.form-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.625rem;
    color: var(--text);
    font-family: inherit;
    font-size: 0.925rem;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.form-group input:hover,
.form-group textarea:hover,
.form-group select:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

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

.form-group input::placeholder {
    color: var(--text-dim);
}

.form-group textarea {
    min-height: 70px;
    resize: vertical;
}

.form-group select option {
    background: var(--bg-elevated);
    color: var(--text);
}

.form-group small {
    display: block;
    margin-top: 0.375rem;
    color: var(--text-dim);
    font-size: 0.775rem;
    line-height: 1.4;
}

/* Form Row (Multiple columns) */
.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.form-row .form-field {
    display: flex;
    flex-direction: column;
}

.form-row .form-field input {
    padding: 0.625rem 0.75rem;
}

.form-row .form-field small {
    font-size: 0.7rem;
    margin-top: 0.25rem;
}

/* Toggle Groups */
.toggle-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0.625rem;
    border: 1px solid transparent;
    margin-bottom: 0.625rem;
    transition: all 0.2s ease;
}

.toggle-group:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--card-border);
}

.toggle-group.active {
    background: var(--primary-soft);
    border-color: rgba(0, 210, 255, 0.2);
}

.toggle-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-group .toggle-content {
    flex: 1;
}

.toggle-group .toggle-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    display: block;
}

.toggle-group .toggle-desc {
    font-size: 0.775rem;
    color: var(--text-dim);
    margin-top: 0.125rem;
}

/* Checkbox Groups */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    accent-color: var(--primary);
}

/* ==========================================================================
   8. EMPTY STATES
   ========================================================================== */

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-dim);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 0.9rem;
}

/* ==========================================================================
   9. TAGS & BADGES
   ========================================================================== */

.tag {
    font-size: 0.7rem;
    padding: 0.25rem 0.625rem;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 1rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.tag-scorm {
    background: var(--accent-soft);
    color: var(--accent);
}

.tag-success {
    background: var(--accent-soft);
    color: var(--accent);
}

.tag-failed {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-new {
    background: linear-gradient(135deg, var(--accent-purple), #6366f1);
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 600;
}

/* ==========================================================================
   10. ANIMATIONS
   ========================================================================== */

/* Pulse Animation (for status indicators) */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(0, 210, 255, 0.4);
    }
    50% {
        opacity: 0.8;
        box-shadow: 0 0 0 6px rgba(0, 210, 255, 0);
    }
}

/* Progress Pulse */
@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Success Pulse (for highlighting new items) */
@keyframes successPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.success-pulse {
    animation: successPulse 1s ease-out 3;
    border-color: var(--accent) !important;
}

/* Spin Animation (for loading spinners) */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

/* ==========================================================================
   11. MODAL STYLES
   ========================================================================== */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg) 100%);
    border: 1px solid var(--card-border);
    border-radius: 1.25rem;
    padding: 0;
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    background: var(--bg-elevated);
    z-index: 1;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-body {
    padding: 1.5rem 2rem;
}

.modal-footer {
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--card-border);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    background: rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   12. PROGRESS BARS
   ========================================================================== */

.status-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.4s ease;
    border-radius: 3px;
}

.progress.active {
    animation: progressPulse 1.5s ease-in-out infinite;
}

.progress-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--accent-purple));
    width: 0%;
    transition: width 0.5s;
}

/* ==========================================================================
   13. STATUS INDICATORS
   ========================================================================== */

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-dim);
}

.status-indicator.idle {
    background: var(--text-dim);
}

.status-indicator.active {
    background: var(--primary);
    animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator.success {
    background: var(--accent);
}

.status-indicator.error {
    background: var(--danger);
}

/* ==========================================================================
   14. UPLOAD AREA
   ========================================================================== */

.upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    padding: 2.5rem 2rem;
    text-align: center;
    border-radius: 0.875rem;
    margin-bottom: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(0, 210, 255, 0.02);
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.upload-area p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.upload-area .upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

/* ==========================================================================
   15. CONNECTION STATUS (NotebookLM)
   ========================================================================== */

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.connection-status.connected {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--accent);
}

.connection-status.disconnected {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.connection-status.checking {
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

.connection-status .status-icon {
    font-size: 1.2rem;
}

.connection-status .status-text {
    flex: 1;
}

.connection-status .status-text strong {
    display: block;
    margin-bottom: 0.25rem;
}

.connection-status .status-text small {
    opacity: 0.8;
    font-size: 0.8rem;
}

.connection-status .retry-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid currentColor;
    color: inherit;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.connection-status .retry-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.features-disabled {
    opacity: 0.5;
    pointer-events: none;
}
