/* ============================================
   DASHBOARD DISCIPLINAR - ESTILOS GLOBAIS
   ============================================ */

/* ============================================
   RESET E CONFIGURAÇÕES GLOBAIS
============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-body, 'Plus Jakarta Sans'), 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    color: #323130;
    min-height: 100vh;
    overflow-y: auto;   /* permite rolagem vertical */
    overflow-x: hidden; /* evita rolagem horizontal */
}

/* ============================================
   BARRA SUPERIOR
============================================ */
.top-bar {
    background: #ffffff;
    height: 48px;
    border-bottom: 1px solid #e1dfdd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.app-launcher {
    width: 24px;
    height: 24px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
    cursor: pointer;
    padding: 2px;
}

.app-launcher span {
    background: #323130;
    border-radius: 1px;
    display: block;
}

.app-name {
    font-family: var(--font-display, 'Space Grotesk'), 'Segoe UI', sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: #323130;
    letter-spacing: -0.5px;
}

.top-bar-center {
    flex: 1;
    max-width: 500px;
    margin: 0 40px;
}

.search-box {
    width: 100%;
    padding: 8px 40px 8px 16px;
    border: 1px solid #e1dfdd;
    border-radius: 4px;
    background: #ffffff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.search-box:focus {
    border-color: #0078d4;
    box-shadow: 0 0 0 1px #0078d4;
}

.search-box::placeholder {
    color: #a19f9d;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-profile {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0078d4, #106ebe);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.user-profile:hover {
    transform: scale(1.05);
}

/* Botão Logout */
.btn-logout {
    padding: 8px 16px;
    background: linear-gradient(135deg, #d13438, #c13438);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(209, 52, 56, 0.2);
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 70px;
    justify-content: center;
}

.btn-logout:hover {
    background: linear-gradient(135deg, #c13438, #b12832);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(209, 52, 56, 0.3);
}

.btn-logout:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(209, 52, 56, 0.2);
}

.btn-logout:before {
    content: "🚪";
    font-size: 12px;
}

/* ============================================
   LAYOUT PRINCIPAL
============================================ */
.main-layout {
    display: flex;
    height: 100vh;
    /* padding-top removido - margin-top já é definido em modern-layout.css */
}

/* ============================================
   SIDEBAR
============================================ */
.sidebar {
    width: 250px;
    background: #ffffff;
    border-right: 1px solid #e1dfdd;
    overflow-y: auto;
    flex-shrink: 0;
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.05);
}

.sidebar-section {
    padding: 20px 0;
    border-bottom: 1px solid #f3f2f1;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-title {
    font-family: var(--font-display, 'Space Grotesk'), 'Segoe UI', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #605e5c;
    margin: 0 20px 12px 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: #323130;
    position: relative;
    text-decoration: none;
}

.sidebar-item:hover {
    background: #f3f2f1;
    transform: translateX(2px);
}

.sidebar-item.active {
    background: #deecf9;
    color: #0078d4;
    font-weight: 600;
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #0078d4;
}

.sidebar-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Ícones SVG Lucide na sidebar */
.sidebar-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    transition: transform 0.2s ease, stroke 0.2s ease;
}

.sidebar-item:hover .sidebar-icon svg {
    transform: scale(1.1);
}

.sidebar-item.active .sidebar-icon svg {
    stroke-width: 2.5;
}

/* Seta do submenu */
.sidebar-arrow {
    margin-left: auto;
    opacity: 0.5;
    transition: transform 0.3s ease, opacity 0.2s ease;
    display: inline-flex;
    align-items: center;
}

.sidebar-arrow svg {
    width: 16px;
    height: 16px;
}

.sidebar-item-parent:hover .sidebar-arrow {
    opacity: 1;
}

.sidebar-item-parent.active .sidebar-arrow,
.sidebar-submenu.open + .sidebar-item-parent .sidebar-arrow {
    transform: rotate(180deg);
}

.sidebar-text {
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================
   ÁREA DE CONTEÚDO
============================================ */
.content-area {
    flex: 1;
    background: #faf9f8;
    overflow-y: auto;
    overflow-x: hidden;
}

.main-content {
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================
   TÍTULOS DOS MÓDULOS
============================================ */
.module-title {
    font-family: var(--font-display, 'Space Grotesk'), 'Segoe UI', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #323130;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.02em;
    animation: typewriter 0.5s steps(20) 1s both;
}

.modulo-content {
    animation: fadeIn 0.3s ease;
}

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

@keyframes typewriter {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: auto;
        opacity: 1;
    }
}

/* ============================================
   MENSAGENS E NOTIFICAÇÕES
============================================ */
.message {
    position: fixed;
    top: 60px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 1100;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 400px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.message:hover {
    transform: translateX(-5px);
    transition: transform 0.2s ease;
}

.message.success {
    background: #107c10;
}

.message.error {
    background: #dc3545;
}

.message.info {
    background: #0078d4;
}

.message.loading {
    background: #323130;
}

.loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVIDADE
============================================ */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    
    .main-content {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e1dfdd;
        overflow-x: auto;
    }
    
    .sidebar-section {
        padding: 12px 0;
    }
    
    .sidebar-item {
        padding: 8px 16px;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .top-bar-center {
        margin: 0 16px;
    }
    
    .module-title {
        font-size: 24px;
    }
    
    .message {
        right: 12px;
        left: 12px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 0 12px;
    }
    
    .top-bar-center {
        margin: 0 8px;
    }
    
    .main-content {
        padding: 12px;
    }
}

/* ============================================
   LAYOUT RESPONSIVO COM SIDEBAR
============================================ */

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

.sidebar {
    flex: 0 0 260px;       /* largura fixa */
    position: sticky;
    top: 0;
    height: 100vh;         /* sidebar altura total da viewport */
    overflow-y: auto;      /* sidebar rolável independente */
    background: #ffffff;
    border-right: 1px solid #e1dfdd;
    z-index: 100;
}

.content-area {
    flex: 1 1 auto;
    min-height: 100vh;
    overflow-y: auto;      /* conteúdo rola */
    -webkit-overflow-scrolling: touch; /* smooth scrolling no iOS */
    padding: 0;
}

/* ============================================
   MOBILE RESPONSIVO
============================================ */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 200;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .content-area {
        margin-left: 0;
        width: 100%;
    }

    .app-shell {
        flex-direction: column;
    }
}

/* ============================================
   DARK MODE OVERRIDES
   Session 18 - 07/12/2025
============================================ */

/* Usar variáveis CSS para cores principais */
body {
    background: var(--bg-body, #f5f5f5);
    color: var(--text-body, #323130);
}

/* Dark mode específico para style.css */
[data-theme="dark"] .top-bar {
    background: var(--bg-card, #1f2937);
    border-bottom-color: var(--border-light, #374151);
}

[data-theme="dark"] .app-launcher span {
    background: var(--text-body, #e8e8e8);
}

[data-theme="dark"] .app-name {
    color: var(--text-body, #e8e8e8);
}

[data-theme="dark"] .search-box {
    background: var(--bg-input, rgba(255,255,255,0.08));
    border-color: var(--border-light, #374151);
    color: var(--text-body, #e8e8e8);
}

[data-theme="dark"] .search-box::placeholder {
    color: var(--text-placeholder, #6b7280);
}

[data-theme="dark"] .sidebar {
    background: var(--bg-sidebar, rgba(31, 41, 55, 0.98));
    border-right-color: var(--border-light, #374151);
}

[data-theme="dark"] .sidebar-section {
    border-bottom-color: var(--border-light, #374151);
}

[data-theme="dark"] .sidebar-title {
    color: var(--text-muted, #9ca3af);
}

[data-theme="dark"] .sidebar-item {
    color: var(--text-sidebar, #e8e8e8);
}

[data-theme="dark"] .sidebar-item:hover {
    background: var(--bg-hover, rgba(0, 191, 165, 0.15));
}

[data-theme="dark"] .sidebar-item.active {
    background: var(--bg-active, rgba(0, 191, 165, 0.25));
    color: var(--text-primary, #e0e6f8);
}

[data-theme="dark"] .sidebar-item.active::before {
    background: var(--border-primary, #00bfa5);
}

[data-theme="dark"] .content-area {
    background: transparent;
}

[data-theme="dark"] .main-content {
    background: var(--glass-bg, rgba(0, 0, 0, 0.4));
}

[data-theme="dark"] .module-title {
    color: var(--text-primary, #e0e6f8);
}

[data-theme="dark"] .message.loading {
    background: var(--bg-tertiary, #0f3460);
}

/* ============================================
   Select Options Dark Mode (Global Fix)
   Corrige contraste de texto nos dropdowns
   ============================================ */
[data-theme="dark"] select option {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] select option:hover,
[data-theme="dark"] select option:focus,
[data-theme="dark"] select option:checked {
    background-color: #00897B !important;
    color: #ffffff !important;
}

[data-theme="dark"] select optgroup {
    background-color: #111827 !important;
    color: #94a3b8 !important;
    font-weight: 600;
}
