:root {
    --primary: #1a3c62;
    --secondary: #88bd64;
    --accent: #e78b34;
    --background: #f8fafc;
    --text: #283241;
    --text-muted: #64748b;
    --glass: rgba(255, 255, 255, 0.7);
    --radius-lg: 1rem;
    --radius-sm: 0.5rem;
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --space-xl: 4rem;
    --space-lg: 2rem;
    --space-md: 1rem;
    --space-sm: 0.5rem;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--background);
    width: 100%;
}

.glass {
    box-shadow: var(--shadow);
    border-radius: var(--radius-lg);
    width: 100%;
}

.container {
    max-width: 94%;
    margin: 5px auto;
    padding: 0 var(--space-md);
}

/* ===== HEADER ===== */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all 0.3s ease;
    background-image: url('../img/header.png');
    background-repeat: repeat;
    box-shadow: var(--shadow);
}

header.scrolled {
    padding: 10rem auto;
}


.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
}

.icon {
    margin: var(--space-md);
    font-size: 3.5rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
}

#mainLogo {
    max-width: 280px;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.logo:hover #mainLogo {
    transform: scale(1.05);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* ===== FORMS ===== */
.form-input {
    width: 100%;
    padding: 0.75rem;
    margin-top: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.8rem;
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 137, 164, 0.1);
}

.form-input::placeholder {
    color: #94a3b8;
}

.link-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 0.5rem;
    font-size: 0.7rem;
}

.link-group a {
    color: var(--primary);
    text-decoration: none;
}

.link-group a:hover {
    text-decoration: underline;
}

.register-links {
    margin-top: 1rem;
    font-size: 0.8rem;
    text-align: center;
}

.register-links p {
    margin: 0.25rem 0;
}

.register-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.register-links a:hover {
    text-decoration: underline;
}

/* ===== BUTTONS ===== */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
    font-size: 0.9rem;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 137, 164, 0.3);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #f0f7ff;
}

.btn-danger {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    padding: 0.4rem 0.7rem;
    border-radius: 0.3rem;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #fca5a5;
}

.btn-sm {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
}

.btn-logout {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid #e2e8f0;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}

.btn-support {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid #e2e8f0;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-support:hover {
    background: #d9ffb6;
}

/* ===== HERO ===== */
.hero {
    width: 100%;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    padding: 3rem 2rem;
    margin-top: 3rem;
    margin-bottom: 2rem;
    text-align: center;
    background-image: url('https://www.mistermedios.com/profes/img/hero.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: #fff;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.6) 0%, rgba(26, 60, 98, 0.4) 100%);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 1;
}

.hero>* {
    position: relative;
    z-index: 2;
}

.hero h1,
.hero h2,
.hero h3 {
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: var(--space-md);
}

.hero h2 {
    font-size: 2rem;
    font-weight: 500;
    line-height: 1;
    margin-bottom: var(--space-md);
}

.hero h3 {
    font-size: 1.25rem;
    font-weight: 300;
    color: var(--text-muted);
    margin: 0 auto var(--space-lg);
    text-align: justify;
    padding: 0 20px;
    max-width: 70%;
}

/* ===== PREMIUM ===== */
.premium {
    width: 100%;
    background: linear-gradient(135deg, #d1e1ff, #e8f5e9);
    border-radius: 1rem;
    box-shadow: var(--shadow);
    padding: 3rem;
    text-align: center;
    font-weight: 500;
    line-height: 1.5;
    margin: 20px auto;
    cursor: pointer;
}


/* ===== MODULES GRID ===== */
.faq-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
    margin-top: var(--space-xl);
    margin-bottom: var(--space-xl);
    margin: 20px auto;
    max-width: 90%;
    background-color: #f3f3f3;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    padding: 2rem;
    text-align: center;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 0.9rem;
    max-width: 100%;
    margin: 20px auto;

}

.faq-box .icon {
    font-size: 1rem;
    margin-bottom: var(--space-md);
}

.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-xl);
    margin-bottom: var(--space-xl);
    margin: 20px auto;
    max-width: 90%;
    border-radius: 2rem;
    padding: 2rem;
    margin: 10px auto;
    text-align: center;
    font-weight: 400;
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

.advantages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-xl);
    margin-bottom: var(--space-xl);
    margin: 20px auto;
    background-color: #ebeeff;
    border-radius: 1rem;
    padding: 2rem;
    margin: 20px auto;
    text-align: center;
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 0.9rem;
}

.premium-box {
    padding: 2rem;
    text-align: center;
    font-weight: 500;
    line-height: 1.5;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 0.9rem;
    max-width: 100%;
    margin: 20px auto;
    cursor: pointer;

}

.premium-box:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 12px 40px rgba(74, 137, 164, 0.2);
    cursor: pointer;
}

.advantage-box {
    padding: var(--space-lg);
    text-align: center;
    transition: all 0.3s ease;
    background-color: #ffffff;
    border-radius: 1rem;
    font-weight: 500;
    line-height: 1.5;
    margin: 10px auto;
    cursor: pointer;
}

.advantage-box:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 12px 40px rgba(74, 137, 164, 0.2);
}

.advantage-box .icon {
    font-size: 3.5rem;
    margin-bottom: var(--space-md);
}

.advantage-box h4 {
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
    color: var(--primary);
}

.advantage-box p {
    font-size: 1rem;
    color: #475569;
}

.feature-list {
    list-style: none;
    text-align: left;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.feature-list li {
    padding: 0.35rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.feature-list li:last-child {
    border-bottom: none;
}

/* ===== FOOTER ===== */
.footer {
    border: none;
    font-weight: 600;
    padding: 0;
    font-size: 0.8rem;
    font-weight: 400;
    font-family: inherit;
    text-align: center !important;
    margin: 0 auto;
    display: block;
    width: 100%;
    text-decoration: none;

}

/* ===== DASHBOARD ===== */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-welcome h2 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.dashboard-welcome p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.plan-badge {
    display: inline-block;
    padding: 0.2rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.plan-badge.free {
    background: #fef3c7;
    color: #92400e;
}

.plan-badge.premium {
    background: #d1fae5;
    color: #065f46;
}

/* === LANDING SECTION TOGGLE === */
.landing-section.hidden,
body.user-logged-in .hero,
body.user-logged-in .advantages-grid,
body.user-logged-in .premium-section,
body.user-logged-in #authContainer,
body.user-logged-in .register-btn {
    display: none !important;
}

/* === TABS REDESIGN (10 TOOLS) === */
.dashboard-tabs-wrapper {
    margin-bottom: 1.5rem;
}

.dashboard-tabs-group {
    margin-bottom: 1rem;
}

.dashboard-tabs-group h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.mobile-tabs-dropdown {
    display: none;
}

.mobile-tabs-bar {
    display: none;
}

.tab-selectors {
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    .dashboard-tabs {
        grid-template-columns: repeat(2, 1fr);
    }

    .mobile-tabs-bar {
        display: block;
        width: 100%;
        background: white;
        padding: 0.5rem;
        margin-bottom: 0.75rem;
        box-sizing: border-box;
    }

    .mobile-tabs-section {
        margin-bottom: 0.25rem;
    }

    .mobile-tabs-section:last-child {
        margin-bottom: 0;
    }

    .mobile-tabs-row {
        display: flex;
        gap: 0.35rem;
        flex-wrap: wrap;
    }

    .mobile-tab-btn {
        flex: 1 1 calc(33.33% - 0.25rem);
        min-width: 80px;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 0.5rem;
        padding: 0.5rem 0.25rem;
        font-size: 0.65rem;
        color: var(--text);
        cursor: pointer;
        text-align: center;
        transition: all 0.2s;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.2rem;
    }

    .mobile-tab-btn:active {
        transform: scale(0.95);
    }

    .mobile-tab-btn.active {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
    }

    .mobile-tab-btn span {
        font-size: 1.1rem;
    }

    .tab-selectors {
        display: none !important;
    }

    .desktop-text {
        display: none;
    }

    .mobile-tabs-dropdown {
        display: none !important;
    }

    #teacherTabsContainer {
        width: 100%;
    }
}

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

.tab-btn {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.tab-btn:hover {
    color: var(--primary);
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.tab-btn.active {
    color: white;
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(74, 137, 164, 0.2);
}

/* === MOBILE OPTIMIZATIONS === */
@media (max-width: 768px) {
    * {
        max-width: 100%;
        overflow-x: hidden;
    }

    html,
    body {
        overflow-x: hidden;
    }

    .container {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }

    #content-viewer.glass {
        padding: 10px !important;
        border-radius: 0 !important;
    }

    .tab-content {
        overflow-x: hidden;
        padding: 0.5rem;
        width: 100%;
        max-width: 100%;
    }

    .add-form {
        overflow-x: hidden;
        max-width: 100%;
        width: 100%;
    }

    .glass {
        overflow-x: hidden;
        max-width: 100%;
        width: 100%;
    }

    .plan-grid>* {
        overflow-x: hidden;
        max-width: 100%;
        width: 100%;
    }

    .add-form,
    form {
        max-width: 100%;
        overflow-x: hidden;
        width: 100%;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .dashboard-welcome h2 {
        font-size: 1.1rem;
    }

    .dashboard-actions {
        width: 100%;
        flex-wrap: nowrap;
        gap: 0.35rem;
        justify-content: space-between;
        max-width: 100%;
        overflow-x: hidden;
    }

    .dashboard-actions .btn-primary,
    .dashboard-actions .btn-secondary {
        flex: 1;
        min-height: 44px;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .dashboard-actions .btn-logout,
    .dashboard-actions .btn-support {
        min-height: 44px;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .section-header h3 {
        font-size: 1.1rem;
    }

    /* Tabs as vertical list/dropdown */
    .dashboard-tabs {
        display: none !important;
        /* Controlled by JS active class or group toggle */
    }

    .dashboard-tabs.active,
    .dashboard-tabs[style*="display: grid"] {
        display: grid !important;
        grid-template-columns: 1fr !important;
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 0.5rem;
        padding: 5px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .tab-selectors {
        display: none !important;
    }

    .tab-selectors.active {
        display: flex !important;
        flex-direction: column;
        gap: 2px;
        background: white;
        border: 1px solid #e2e8f0;
        padding: 0.5rem;
        border-radius: 0.5rem;
    }

    .mobile-tabs-header {
        display: flex !important;
    }

    .dashboard-tabs-wrapper {
        margin-top: 1rem;
    }

    .dashboard-tabs-group h4 {
        background: #f1f5f9;
        padding: 0.75rem;
        border-radius: 0.5rem;
        justify-content: space-between;
        display: flex;
        font-size: 0.9rem;
    }

    .tab-btn {
        width: 100%;
        flex-direction: row;
        justify-content: flex-start;
        padding: 0.75rem 1rem;
        border: none;
        border-bottom: 1px solid #f1f5f9;
        text-align: left;
    }

    .tab-btn:last-child {
        border-bottom: none;
    }

    #mainLogo {
        max-width: 180px;
    }

    .student-card,
    .message-item,
    .announcement-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .mobile-tabs-dropdown {
        display: block !important;
        position: relative;
        margin-bottom: 1rem;
        width: 100%;
    }

    .mobile-tabs-toggle {
        width: 100%;
        background: var(--primary);
        color: white;
        border: none;
        border-radius: 0.5rem;
        padding: 1rem 1rem;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
        box-shadow: 0 2px 8px rgba(74, 137, 164, 0.3);
        min-height: 48px;
    }

    .tab-selectors {
        display: none !important;
    }

    .mobile-tabs-dropdown {
        display: none !important;
    }

    #tab-p-messages {
        position: relative !important;
        width: 100vw !important;
        max-width: 100vw !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        left: 0 !important;
        right: 0 !important;
        overflow: visible !important;
    }

    #parentNewMsgForm {
        position: relative !important;
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        padding: 1rem !important;
        left: 0 !important;
        right: 0 !important;
        box-sizing: border-box !important;
        background: white !important;
    }

    #parentConversation {
        position: relative !important;
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        padding: 1rem !important;
        left: 0 !important;
        right: 0 !important;
        box-sizing: border-box !important;
    }

    #parentConversation .chat-input-area {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.5rem;
    }

    #parentConversation .chat-input-area textarea {
        width: 100% !important;
        min-height: 80px !important;
    }

    #parentConversation .chat-input-area .btn-primary {
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .dashboard-tabs {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .container {
        max-width: 100%;
        padding: 0 8px;
    }

    .hero h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }

    .hero h2 {
        font-size: 1.25rem;
    }

    .hero h3 {
        max-width: 100%;
        padding: 0 8px;
    }

    #mainLogo {
        max-width: 150px;
    }

    .dashboard-welcome h2 {
        font-size: 1.25rem;
    }

    .tab-btn {
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
    }

    .modal-content {
        width: 95% !important;
        max-width: none;
        margin: 1rem;
    }

    .grade-table {
        font-size: 0.75rem;
    }

    .grade-table th,
    .grade-table td {
        padding: 0.4rem 0.25rem;
    }

    .chat-bubble {
        max-width: 90%;
    }

    .tab-content {
        padding: 0.5rem;
        width: 100%;
        max-width: 100%;
    }

    .dashboard-tabs {
        display: none !important;
    }

    .tab-selectors {
        display: none !important;
    }

    .mobile-tabs-dropdown {
        display: block !important;
        width: 100%;
    }

    .plan-grid {
        gap: 0.75rem;
        grid-template-columns: 1fr !important;
        width: 100%;
        max-width: 100%;
    }

    .plan-grid>* {
        width: 100%;
        max-width: 100%;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        padding: 0.875rem;
    }

    .form-group {
        max-width: 100%;
        overflow-x: hidden;
    }

    input.form-input,
    select.form-input,
    textarea.form-input {
        max-width: 100%;
        box-sizing: border-box;
    }

    .mobile-messages {
        padding: 0;
    }

    .mobile-messages .section-header {
        padding: 0.5rem;
    }

    .mobile-messages .message-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.75rem;
    }

    .mobile-messages .message-bubble {
        max-width: 100%;
        width: 100%;
    }

    .mobile-messages .conversation-container {
        width: 100%;
        max-width: 100%;
    }

    .mobile-messages #teacherConversation {
        width: 100%;
        max-width: 100%;
        padding: 0;
    }

    .mobile-messages #teacherContacts {
        width: 100%;
        max-width: 100%;
    }
}

/* AI Tools specific colors */
.tab-ai-planner {
    border-color: #a5f3fc;
    background: #ecfeff;
    color: #0e7490;
}

.tab-ai-planner:hover {
    background: #cffafe;
}

.tab-ai-planner.active {
    background: #0891b2;
    color: white;
    border-color: transparent;
}

.tab-piar {
    border-color: #e9d5ff;
    background: #faf5ff;
    color: #7e22ce;
}

.tab-piar:hover {
    background: #f3e8ff;
}

.tab-piar.active {
    background: #9333ea;
    color: white;
    border-color: transparent;
}

.tab-proyectos {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #15803d;
}

.tab-proyectos:hover {
    background: #dcfce7;
}

.tab-proyectos.active {
    background: #16a34a;
    color: white;
    border-color: transparent;
}

.tab-observador {
    border-color: #fef08a;
    background: #fefce8;
    color: #a16207;
}

.tab-observador:hover {
    background: #fef9c3;
}

.tab-observador.active {
    background: #ca8a04;
    color: white;
    border-color: transparent;
}

.tab-boletines {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.tab-boletines:hover {
    background: #fee2e2;
}

.tab-boletines.active {
    background: #dc2626;
    color: white;
    border-color: transparent;
}

/* Management tools (All using the Blue theme) */
.tab-students,
.tab-messages,
.tab-announcements,
.tab-calendar,
.tab-resources {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
}

.tab-students:hover,
.tab-messages:hover,
.tab-announcements:hover,
.tab-calendar:hover,
.tab-resources:hover {
    background: #dbeafe;
}

.tab-students.active,
.tab-messages.active,
.tab-announcements.active,
.tab-calendar.active,
.tab-resources.active {
    background: #4a89a4;
    color: white;
    border-color: transparent;
}

.tab-icon {
    font-size: 1.25rem;
}

.tab-content {
    min-height: 200px;
}

/* === SECTION HEADER === */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.section-header h3 {
    font-size: 1.2rem;
    color: var(--text);
}

/* === ADD FORM === */
.add-form {
    background: rgba(74, 137, 164, 0.05);
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--primary);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* === AI PLANNER === */
.ai-planner-box {
    background: linear-gradient(135deg, #eff6ff, #f0fdf4);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid #bfdbfe;
}

.ai-planner-box h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.ai-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.ai-textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.3s;
}

.ai-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 137, 164, 0.1);
}

.btn-ai {
    background: linear-gradient(135deg, var(--primary), #2d6a85);
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

.ai-status {
    font-size: 0.85rem;
    font-weight: 500;
}

.ai-status.loading {
    color: var(--accent);
}

.ai-status.success {
    color: var(--secondary);
}

.ai-status.error {
    color: #dc2626;
}

.ai-result {
    margin-top: 1.5rem;
}

.ai-result-content {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.ai-result-content table {
    font-size: 0.85rem;
}

.ai-note {
    background: #fffbeb;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid var(--accent);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* === STUDENT LIST === */
.student-list {
    margin-top: 1rem;
}

.student-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e2e8f0;
    transition: box-shadow 0.2s;
}

.student-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.student-info strong {
    display: block;
    font-size: 0.95rem;
}

.student-info .text-muted {
    font-size: 0.8rem;
}

/* === GRADES === */
.grade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.grade-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.grade-row label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
}

.grade-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.grade-table th,
.grade-table td {
    padding: 0.6rem 0.5rem;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.grade-table th {
    background: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
}

.grade-table tr:nth-child(even) {
    background: #f8fafc;
}

.grade-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
}

/* === MESSAGES === */
.message-list {
    margin-top: 1rem;
}

.message-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: background 0.2s;
}

.message-item:hover {
    background: #f0f7ff;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.message-preview {
    flex: 1;
    min-width: 0;
}

.message-preview strong {
    display: block;
    font-size: 0.9rem;
}

.message-preview p {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 0.1rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 0.5rem;
}

/* Chat bubbles */
.conversation-messages {
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem 0;
}

.chat-bubble {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-bubble.sent {
    background: var(--primary);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 0.2rem;
}

.chat-bubble.received {
    background: #f1f5f9;
    color: var(--text);
    margin-right: auto;
    border-bottom-left-radius: 0.2rem;
}

.chat-time {
    display: block;
    font-size: 0.65rem;
    margin-top: 0.25rem;
    opacity: 0.7;
}

.chat-input-area {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    margin-top: 1rem;
    width: 100%;
}

.chat-input-area textarea {
    flex: 1;
    min-height: 60px;
}

/* === ANNOUNCEMENTS === */
.announcement-card {
    background: white;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--secondary);
    transition: box-shadow 0.2s;
}

.announcement-card.pinned {
    border-left-color: var(--accent);
    background: #fffbeb;
}

.announcement-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.announcement-card h4 {
    color: var(--text);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.announcement-card p {
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.5;
}

.announcement-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pin-badge {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* === CALENDAR === */
.calendar-event {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e2e8f0;
}

.event-date {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary);
    min-width: 80px;
    text-align: center;
}

.event-info {
    flex: 1;
}

.event-info strong {
    display: block;
    font-size: 0.9rem;
}

.event-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* === RESOURCES === */
.resource-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.resource-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}

.resource-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.resource-card.predefined {
    border-color: #bfdbfe;
    background: #f0f9ff;
}

.resource-info h4 {
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.resource-notes {
    font-size: 0.9rem;
    color: #475569;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.resource-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.resource-meta {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.badge-predefined {
    background: #dcfce7;
    color: #15803d;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
}

/* === FREEMIUM BANNER === */
.freemium-banner {
    margin-top: 1.5rem;
    padding: 1rem 1.5rem;
    border: 2px dashed var(--secondary);
    border-radius: 0.75rem;
    text-align: center;
    background: #f0fdf4;
}

.freemium-banner p {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

/* === UTILITY === */
.text-muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
    background: #f8fafc;
    border-radius: 0.5rem;
}

.error {
    text-align: center;
    padding: 1rem;
    color: #dc2626;
    background: #fee2e2;
    border-radius: 0.5rem;
}

/* === UPGRADE MODAL === */
.upgrade-option-card {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    padding: 1.5rem;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
}

.upgrade-option-card:hover {
    border-color: var(--primary);
    background: #f0f9ff;
    transform: translateY(-2px);
}

.upgrade-option-card.featured {
    border-color: var(--primary);
    background: #ecfeff;
}

.upgrade-option-card .option-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.upgrade-option-card .option-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.upgrade-option-card .option-period {
    font-size: 0.8rem;
    color: #64748b;
}

.upgrade-option-card .badge-discount {
    position: absolute;
    top: -12px;
    background: var(--accent);
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.2rem 0.6rem;
    border-radius: 2rem;
    text-transform: uppercase;
}

.btn-text {
    background: none;
    border: none;
    color: #64748b;
    font-size: 0.9rem;
    text-decoration: underline;
    cursor: pointer;
}

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

/* ===== MOBILE RESPONSIVENESS ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-sm);
    }

    .hero {
        overflow: hidden;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero h2 {
        max-width: 90%;
        font-size: 1rem;
        font-weight: 300;
        padding: 0 10px;
        font-size: 1rem;
    }

    .hero h3 {
        font-size: 0.85rem;
        font-weight: 200;
        color: var(--text-muted);
        margin: 0 auto var(--space-lg);
        text-align: justify;
        padding: 0 10px;
        max-width: 90%;
    }

    .premium {
        padding: 2rem;
        max-width: 95%;
    }

    .nav-links {
        display: none;
    }

    .nav-content {
        padding: var(--space-sm);
        gap: 0.5rem;
        justify-content: center;
        text-align: center;
    }

    .nav-content .link-group {
        gap: 0.25rem;
        justify-content: center;
        width: 100%;
    }

    .nav-content .btn-primary,
    .nav-content .btn-secondary {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }

    #mainLogo {
        max-width: 200px;
        width: 100%;
        margin: 0 auto;
    }

    .logo {
        justify-content: center;
        width: 100%;
    }

    .btn-primary {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .dashboard-tabs {
        gap: 0;
    }

    .tab-btn {
        padding: 0.6rem 0.25rem;
        font-size: 0.65rem;
        white-space: normal;
        text-align: center;
        word-wrap: break-word;
    }

    .mobile-tab-btn {
        padding: 0.5rem 0.25rem;
        font-size: 0.7rem;
        white-space: normal;
        word-wrap: break-word;
    }

    .grade-grid {
        grid-template-columns: 1fr;
    }

    .gallery-grid,
    .faq-grid,
    .testimonials-grid,
    .advantages-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .chat-bubble {
        max-width: 90%;
    }

    .calendar-event {
        flex-direction: column;
        align-items: flex-start;
    }

    .grade-table {
        font-size: 0.7rem;
    }

    .grade-table th,
    .grade-table td {
        padding: 0.4rem 0.3rem;
    }
}


/* Mobile tightening overrides */
@media (max-width: 768px) {

    .admin-table-wrapper table th,
    .admin-table-wrapper table td {
        padding: 0.6rem 0.4rem;
        font-size: 0.75rem;
    }

    .resource-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .resource-meta {
        width: 100%;
        justify-content: space-between;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .hero {
        overflow-x: hidden;
    }

    .hero h1 {
        font-size: 1.75rem;
        word-wrap: break-word;
    }

    .hero h2 {
        font-size: 0.85rem;
    }

    .hero h3 {
        font-size: 0.8rem;
        word-wrap: break-word;
    }

    #mainLogo {
        max-width: 150px;
        align-content: center;
    }

    .advantages-grid,
    .faq-grid,
    .testimonials-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .modal-content.glass {
        padding: 1.5rem !important;
        width: 95% !important;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .tab-btn {
        padding: 0.5rem 0.2rem;
        font-size: 0.6rem;
        white-space: normal;
        word-wrap: break-word;
    }
}

/* === PRINT === */
@media print {

    header,
    footer,
    .dashboard-tabs,
    .btn-primary,
    .btn-secondary,
    .btn-danger,
    .btn-logout,
    .section-header button,
    .freemium-banner,
    .ai-planner-box,
    .add-form {
        display: none !important;
    }

    .ai-result-content {
        box-shadow: none;
        padding: 0;
    }
}