/* -------------------------------------------------------------
   ORBITA PORTAL - ESTILOS BASE E DESIGN SYSTEM (GLASSMORPHISM)
   ------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --color-primary: #10b981;
    --color-primary-rgb: 16, 185, 129;
    --color-primary-dark: #059669;
    
    --bg-dark: #060913;
    --bg-card: rgba(16, 20, 38, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --color-danger: #ef4444;
    --color-success: #10b981;
    --font-sans: 'Inter', sans-serif;
    --font-title: 'Outfit', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --glow-primary: 0 0 20px rgba(var(--color-primary-rgb), 0.25);
    
    /* Variáveis do Layout */
    --sidebar-width: 260px;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(var(--color-primary-rgb), 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(var(--color-primary-rgb), 0.03) 0%, transparent 40%);
    background-attachment: fixed;
}

/* -------------------------------------------------------------
   TELA DE LOGIN
   ------------------------------------------------------------- */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 100%;
    max-width: 440px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    text-align: center;
    transition: var(--transition);
}

.login-card:hover {
    border-color: rgba(var(--color-primary-rgb), 0.3);
    box-shadow: var(--glow-primary), 0 20px 40px rgba(0,0,0,0.4);
}

.school-logo-container {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: rgba(var(--color-primary-rgb), 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    font-size: 2.5rem;
    color: var(--color-primary);
    border: 1px solid rgba(var(--color-primary-rgb), 0.2);
    box-shadow: var(--glow-primary);
}

.school-logo-img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}

.login-card h2 {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 1.8rem;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 30px;
}

.form-group {
    text-align: left;
    margin-bottom: 20px;
    width: 100%;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.form-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.form-group input:focus {
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: var(--glow-primary);
}

.btn {
    width: 100%;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    color: white;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--glow-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

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

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

.btn-secondary {
    background: rgba(255,255,255,0.06);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: none;
}

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

/* -------------------------------------------------------------
   LAYOUT DO PORTAL COM SIDEBAR RETRÁTIL
   ------------------------------------------------------------- */
.portal-layout {
    display: none; /* Ativado via JS após login */
    min-height: 100vh;
    display: flex;
}

/* Sidebar Estilo Glassmorphism */
.portal-sidebar {
    width: var(--sidebar-width);
    background: rgba(16, 20, 38, 0.65);
    backdrop-filter: blur(25px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.brand-logo {
    width: 42px;
    min-width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(var(--color-primary-rgb), 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--color-primary);
    border: 1px solid rgba(var(--color-primary-rgb), 0.2);
    box-shadow: var(--glow-primary);
}

.brand-info h1 {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-info span {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-toggle-sidebar {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

/* Navegação da Sidebar */
.sidebar-nav {
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    transition: var(--transition);
}

.nav-item i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
}

.nav-item span {
    white-space: nowrap;
    transition: opacity 0.2s ease-in-out;
}

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

.nav-item.active {
    color: var(--color-primary);
    background: rgba(var(--color-primary-rgb), 0.1);
    border: 1px solid rgba(var(--color-primary-rgb), 0.15);
}

.nav-admin-section {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin: 15px 0 5px 16px;
    text-transform: uppercase;
    white-space: nowrap;
    transition: opacity 0.2s ease-in-out;
}

/* Rodapé da Sidebar */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.user-info-sidebar {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.user-avatar-circle {
    width: 38px;
    min-width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(var(--color-primary-rgb), 0.15);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 1px solid rgba(var(--color-primary-rgb), 0.3);
}

.user-details-sidebar {
    overflow: hidden;
}

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

.user-details-sidebar .user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout-sidebar {
    background: transparent;
    border: 1px solid var(--border-color);
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-logout-sidebar:hover {
    color: var(--color-danger);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

/* -------------------------------------------------------------
   ESTILOS MENU LATERAL COLAPSADO (RETRÁTIL)
   ------------------------------------------------------------- */
.portal-sidebar.collapsed {
    width: 78px;
}

.portal-sidebar.collapsed .brand-info,
.portal-sidebar.collapsed .btn-toggle-sidebar i,
.portal-sidebar.collapsed .sidebar-nav span,
.portal-sidebar.collapsed .nav-section-title,
.portal-sidebar.collapsed .user-details-sidebar {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.portal-sidebar.collapsed .btn-toggle-sidebar {
    margin: 0 auto;
}

.portal-sidebar.collapsed .btn-toggle-sidebar::before {
    content: "\f054"; /* chevron-right */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.8rem;
}

.portal-sidebar.collapsed .sidebar-footer {
    justify-content: center;
}

.portal-sidebar.collapsed .btn-logout-sidebar {
    margin: 0 auto;
}

/* -------------------------------------------------------------
   CONTEÚDO PRINCIPAL (ÁREA DA DIREITA)
   ------------------------------------------------------------- */
.portal-main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.portal-sidebar.collapsed + .portal-main-wrapper {
    margin-left: 78px;
}

.portal-main {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 30px 40px;
}

.mobile-header {
    display: none; /* Apenas no celular */
}

/* -------------------------------------------------------------
   MURAL DE RECADOS
   ------------------------------------------------------------- */
.feed-grid {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 30px;
}

.feed-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.announcement-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: var(--transition);
    position: relative;
}

.announcement-card:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--color-primary-rgb), 0.2);
}

.announcement-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(var(--color-primary-rgb), 0.1);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 1px solid rgba(var(--color-primary-rgb), 0.2);
}

.author-details h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.author-details span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.announcement-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.announcement-body h3 {
    font-family: var(--font-title);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.announcement-body p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* -------------------------------------------------------------
   BOLETIM E DISCIPLINAS
   ------------------------------------------------------------- */
.grades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.subject-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    transition: var(--transition);
}

.subject-card:hover {
    border-color: rgba(var(--color-primary-rgb), 0.2);
}

.subject-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.subject-header h3 {
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 700;
}

.subject-average {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary);
    background: rgba(var(--color-primary-rgb), 0.1);
    padding: 4px 8px;
    border-radius: 6px;
}

.grades-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.grade-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.grade-row span:last-child {
    font-weight: 600;
}

/* -------------------------------------------------------------
   FORMULÁRIOS E CONFIGURAÇÕES
   ------------------------------------------------------------- */
.welcome-banner {
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.15) 0%, rgba(16, 20, 38, 0.8) 100%);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.welcome-text h2 {
    font-family: var(--font-title);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
}

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

.contact-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    width: 100%;
}

.contact-card h3 {
    font-family: var(--font-title);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Níveis de Acesso e Tabelas */
.role-badge-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.role-badge-item:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(var(--color-primary-rgb), 0.2);
}

.role-badge-item.selected {
    border-color: var(--color-primary);
    background: rgba(var(--color-primary-rgb), 0.08);
    color: var(--color-primary);
}

table th {
    font-weight: 700;
    padding: 14px 10px;
    border-bottom: 1px solid var(--border-color);
}

table td {
    padding: 14px 10px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

table tr:hover td {
    background: rgba(255,255,255,0.01);
}

/* -------------------------------------------------------------
   MODAIS PREMIUM
   ------------------------------------------------------------- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 5, 12, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 20px;
}

.modal.open {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: #0f1322;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 30px;
    width: 100%;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.modal-header h3 {
    font-family: var(--font-title);
    font-size: 1.3rem;
    font-weight: 700;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

.btn-close:hover {
    color: var(--color-danger);
}

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

/* -------------------------------------------------------------
   TELA DE ERRO / SUSPENSÃO
   ------------------------------------------------------------- */
.error-container {
    display: none;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.error-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 100%;
    max-width: 480px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.error-card i {
    font-size: 4rem;
    color: var(--color-danger);
    margin-bottom: 25px;
}

.error-card h2 {
    font-family: var(--font-title);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.error-card p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

/* -------------------------------------------------------------
   RESPONSIVIDADE (MOBILE & TABLET)
   ------------------------------------------------------------- */
@media (max-width: 900px) {
    .portal-layout {
        flex-direction: column;
    }
    
    .portal-sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
        transform: translateX(-100%);
    }
    
    .portal-sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .portal-sidebar.collapsed {
        width: 100%;
        transform: translateX(-100%);
    }

    .portal-main-wrapper {
        margin-left: 0 !important;
        padding-top: 60px; /* Espaço para o mobile header */
    }

    .mobile-header {
        background: rgba(16, 20, 38, 0.8);
        backdrop-filter: blur(15px);
        border-bottom: 1px solid var(--border-color);
        height: 60px;
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        display: flex;
        align-items: center;
        padding: 0 20px;
        gap: 15px;
        z-index: 90;
    }

    .btn-menu-mobile {
        background: transparent;
        border: none;
        color: var(--text-main);
        font-size: 1.3rem;
        cursor: pointer;
    }

    .mobile-school-name {
        font-family: var(--font-title);
        font-weight: 700;
        font-size: 1.1rem;
    }

    .portal-main {
        padding: 20px;
    }

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