/* ============================================
   CEIP Armeñime - School Portal Styles
   Modern, friendly, school-themed design
   ============================================ */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --light: #f8fafc;
    --dark: #1e293b;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 12px;
    --radius-lg: 20px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #e0e7ff 0%, #fce7f3 50%, #dbeafe 100%);
    min-height: 100vh;
    margin: 0;
    color: var(--dark);
}

.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

.site-header {
    background: white;
    box-shadow: var(--shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.school-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mascot-icon {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

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

.school-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    line-height: 1.2;
}

.school-grade {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.header-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.header-nav .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-600);
    transition: all 0.2s;
}

.header-nav .nav-link:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.header-nav .nav-logout:hover {
    background: #fef2f2;
    color: var(--danger);
}

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

.main-content {
    flex: 1;
    padding: 2rem 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ============================================
   PAGE HEADERS
   ============================================ */

.page-header {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-header-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: white;
}

.page-header-text {
    flex: 1;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-subtitle {
    color: var(--gray-500);
    margin: 0.25rem 0 0;
}

.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* ============================================
   BREADCRUMBS
   ============================================ */

.breadcrumb-nav {
    margin-bottom: 1.5rem;
}

.breadcrumb {
    background: white;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin: 0;
    font-size: 0.875rem;
}

.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--gray-500);
}

/* ============================================
   SUBJECTS GRID
   ============================================ */

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.subject-card {
    --card-accent: var(--primary);
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-decoration: none;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--card-accent);
}

.subject-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--card-accent);
}

.subject-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.subject-icon i {
    color: var(--card-accent);
}

.subject-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0 0 0.5rem;
}

.subject-topics-count {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* ============================================
   TOPICS LIST
   ============================================ */

.topics-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.topic-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

.topic-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.topic-number {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.topic-info {
    flex: 1;
}

.topic-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0 0 0.25rem;
}

.topic-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.topic-stat {
    font-size: 0.8125rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.topic-arrow {
    color: var(--gray-400);
    font-size: 1.25rem;
}

.topic-card:hover .topic-arrow {
    color: var(--primary);
}

/* ============================================
   TOPIC DETAIL - EXERCISES & VIDEOS
   ============================================ */

.content-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0 0 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-100);
}

.exercises-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.exercise-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--gray-100);
    border-radius: var(--radius);
    flex-wrap: wrap;
}

.exercise-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.exercise-info {
    flex: 1;
    min-width: 200px;
}

.exercise-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0 0 0.25rem;
}

.exercise-description {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin: 0 0 0.25rem;
}

.exercise-filename {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.exercise-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Videos Grid */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.video-card {
    background: var(--gray-100);
    border-radius: var(--radius);
    overflow: hidden;
}

.video-title {
    font-size: 1rem;
    font-weight: 600;
    padding: 1rem 1rem 0.5rem;
    margin: 0;
    color: var(--dark);
}

.video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-preview {
    max-width: 400px;
    border-radius: var(--radius);
    overflow: hidden;
}

.video-preview iframe {
    width: 100%;
    aspect-ratio: 16/9;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.empty-state i {
    font-size: 4rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.empty-mascot {
    width: 120px;
    height: 120px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    color: var(--gray-600);
    margin: 0 0 0.5rem;
}

.empty-state p {
    color: var(--gray-500);
    margin: 0 0 1rem;
}

.empty-state-small {
    text-align: center;
    padding: 2rem;
    color: var(--gray-500);
}

.empty-state-small i {
    font-size: 2.5rem;
    color: var(--gray-300);
    display: block;
    margin-bottom: 0.5rem;
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 2rem 1rem;
    position: relative;
}

.login-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-header {
    margin-bottom: 2rem;
}

.login-mascot {
    width: 100px;
    height: 100px;
    margin-bottom: 1rem;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0 0 0.5rem;
}

.login-subtitle {
    color: var(--gray-500);
    margin: 0;
}

.login-form .form-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 600;
    color: var(--gray-600);
}

.login-btn {
    margin-top: 0.5rem;
    border-radius: var(--radius);
    font-weight: 600;
}

.session-notice {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.login-decorations {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    top: 0;
    left: 0;
}

.floating-sticker {
    position: absolute;
    width: 50px;
    height: 50px;
    opacity: 0.3;
    animation: float 6s ease-in-out infinite;
}

.sticker-1 {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.sticker-2 {
    top: 20%;
    right: 15%;
    animation-delay: 2s;
}

.sticker-3 {
    bottom: 15%;
    left: 20%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

/* ============================================
   ADMIN STYLES
   ============================================ */

.admin-header {
    margin-bottom: 2rem;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.bg-primary { background: var(--primary); }
.stat-icon.bg-success { background: var(--success); }
.stat-icon.bg-warning { background: var(--warning); }
.stat-icon.bg-danger { background: var(--danger); }

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

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.admin-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.admin-menu-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.admin-menu-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.admin-menu-card i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.admin-menu-card span {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
}

.admin-menu-card small {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.admin-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Admin Tables */
.admin-table-container {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.admin-table {
    margin: 0;
}

.admin-table th {
    background: var(--gray-100);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-600);
    border: none;
    padding: 1rem;
}

.admin-table td {
    padding: 1rem;
    vertical-align: middle;
    border-color: var(--gray-100);
}

.admin-table .icon-cell {
    font-size: 1.5rem;
}

.admin-table .actions-cell {
    white-space: nowrap;
}

.admin-table .actions-cell form {
    display: inline;
}

.color-preview {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    vertical-align: middle;
    margin-right: 0.5rem;
    border: 1px solid var(--gray-200);
}

/* Admin Sections */
.admin-section {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-100);
}

.section-header .section-title {
    margin: 0;
    padding: 0;
    border: none;
}

/* Forms */
.form-container {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    max-width: 600px;
}

.admin-form .form-label {
    font-weight: 600;
    color: var(--gray-700);
}

.admin-form .form-control {
    border-radius: 8px;
    border: 2px solid var(--gray-200);
    padding: 0.625rem 0.875rem;
}

.admin-form .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.current-file {
    background: var(--gray-100);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.settings-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.settings-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0 0 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-card-description {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0 0 1rem;
}

.settings-form .input-group {
    flex-wrap: nowrap;
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
    background: white;
    padding: 1.5rem 0;
    margin-top: auto;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
}

.footer-text {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.roxi-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    text-decoration: none;
    transition: transform 0.2s;
}

.roxi-link:hover {
    transform: scale(1.05);
}

.roxi-text {
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
}

.roxi-logo {
    height: 45px;
    width: auto;
}

.footer-decorations {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.sticker {
    position: absolute;
    width: 30px;
    height: 30px;
    opacity: 0.15;
}

.sticker-book {
    left: 10%;
    top: 50%;
    transform: translateY(-50%) rotate(-15deg);
}

.sticker-pencil {
    right: 15%;
    top: 50%;
    transform: translateY(-50%) rotate(15deg);
}

.sticker-star {
    right: 8%;
    top: 30%;
    transform: rotate(10deg);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.0625rem;
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
    border-radius: var(--radius);
    border: none;
    box-shadow: var(--shadow-sm);
}

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

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .school-brand {
        flex-direction: column;
    }
    
    .header-nav {
        justify-content: center;
    }
    
    .page-header {
        flex-direction: column;
        text-align: center;
    }
    
    .page-header-row {
        flex-direction: column;
        text-align: center;
    }
    
    .subjects-grid {
        grid-template-columns: 1fr;
    }
    
    .exercise-card {
        flex-direction: column;
        text-align: center;
    }
    
    .exercise-actions {
        width: 100%;
        justify-content: center;
    }
    
    .videos-grid {
        grid-template-columns: 1fr;
    }
    
    .form-container {
        padding: 1.5rem;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .admin-stats {
        grid-template-columns: 1fr;
    }
    
    .login-card {
        padding: 1.5rem;
    }
    
    .section-header {
        flex-direction: column;
        text-align: center;
    }
}
