/* ========================================
   VARIÁVEIS E PALETA DE CORES
   ======================================== */
:root {
    /* Paleta base */
    --primary-color: #c15f3c;
    --primary-hover: #a84e2d;
    --secondary-gray: #b1ada1;
    --off-white: #f4f3ee;
    --pure-white: #ffffff;

    /* LIGHT MODE (PADRÃO) */
    /* Backgrounds */
    --bg-main: #ffffff;
    --bg-secondary: #f4f3ee;
    --bg-card: #ffffff;
    --bg-hover: #f4f3ee;

    /* Textos */
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-muted: #b1ada1;

    /* Borders */
    --border-color: #e0e0e0;
    --border-light: #f0f0f0;

    /* Links */
    --link-color: #c15f3c;
    --link-hover: #a84e2d;
    --link-visited: #a84e2d;

    /* Sombras para light mode */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

    /* Raios e transições */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* DARK MODE */
[data-theme="dark"] {
    /* Backgrounds */
    --bg-main: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-card: #252525;
    --bg-hover: #2d2d2d;

    /* Textos */
    --text-primary: #f4f3ee;
    --text-secondary: #b1ada1;
    --text-muted: #898989;

    /* Borders */
    --border-color: #3a3a3a;
    --border-light: #4a4a4a;

    /* Links */
    --link-color: #c15f3c;
    --link-hover: #d97a5a;
    --link-visited: #a84e2d;

    /* Sombras para dark mode */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ========================================
   RESET E BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Emojis - Fix para renderização */
.nav-icon, .feature-icon, .tip-icon, .home-icon, h1, h2, h3 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

/* Proteção contra cópia */
body {
    -webkit-touch-callout: none;
}

::selection {
    background: var(--primary-color);
    color: var(--pure-white);
}

/* ========================================
   LINKS E HYPERLINKS
   ======================================== */
a {
    color: var(--link-color);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

a:visited {
    color: var(--link-visited);
}

a:active {
    color: var(--primary-hover);
}

/* ========================================
   TELA DE LOGIN
   ======================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-main) 0%, var(--bg-secondary) 100%);
    padding: 20px;
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease;
}

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

.logo-container {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.tagline {
    color: var(--text-secondary);
    font-size: 15px;
}

.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    transition: var(--transition-normal);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-main);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: var(--pure-white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.error-message {
    color: #ef4444;
    font-size: 13px;
    margin-top: 12px;
    text-align: center;
    min-height: 20px;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ========================================
   HEADER - COMPLETAMENTE REDESENHADO
   ======================================== */
.platform-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.platform-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1800px;
    margin: 0 auto;
}

/* ========================================
   MENU HAMBÚRGUER - MODERNO E ANIMADO
   ======================================== */
.hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-normal);
    padding: 0;
    gap: 5px;
    flex-shrink: 0;
}

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

.hamburger-line {
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Animação quando o menu está aberto */
.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ========================================
   HEADER LEFT - LOGO E HOME
   ======================================== */
.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0; /* Permite que o flex funcione corretamente */
}

.platform-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    transition: var(--transition-fast);
    cursor: pointer;
    letter-spacing: -0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.platform-logo:hover {
    color: var(--link-hover);
}

.btn-home {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
    white-space: nowrap;
    flex-shrink: 0;
}

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

.home-icon {
    font-size: 16px;
}

/* ========================================
   HEADER ACTIONS - BUSCA E LOGOUT
   ======================================== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.search-container {
    position: relative;
}

.search-container input {
    padding: 9px 36px 9px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    width: 200px;
    transition: var(--transition-normal);
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-main);
    width: 280px;
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    pointer-events: none;
    color: var(--text-muted);
}

/* ========================================
   SEARCH DROPDOWN - NOVO DESIGN
   ======================================== */
.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    max-height: 0;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 150;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.search-dropdown.show {
    max-height: 400px;
    overflow-y: auto;
    opacity: 1;
}

#search-dropdown-content {
    padding: 8px;
}

.search-result-item {
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition-normal);
}

.search-result-item:last-child {
    margin-bottom: 0;
}

.search-result-item:hover {
    border-color: var(--primary-color);
    background: var(--bg-hover);
    transform: translateX(4px);
}

.search-result-title {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}

.search-result-path {
    color: var(--primary-color);
    font-size: 12px;
    margin-bottom: 6px;
}

.search-result-preview {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
}

.search-highlight {
    background: var(--primary-color);
    color: var(--pure-white);
    padding: 1px 3px;
    border-radius: 3px;
}

.no-results {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-muted);
}

.no-results h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.no-results p {
    font-size: 14px;
}

/* ========================================
   BOTÃO LOGOUT
   ======================================== */
.btn-logout {
    padding: 9px 16px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
    white-space: nowrap;
}

.btn-logout:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

/* ========================================
   CONTAINER PRINCIPAL
   ======================================== */
.main-container {
    display: flex;
    flex: 1;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
    position: relative;
}

/* ========================================
   SIDEBAR OVERLAY
   ======================================== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    width: 300px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

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

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.tutorial-tip {
    margin: 16px;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary-color);
    border-radius: var(--radius-sm);
    position: relative;
}

.tip-icon {
    font-size: 20px;
    margin-right: 8px;
}

.tutorial-tip p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.close-tip {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.close-tip:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav {
    padding: 8px;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-normal);
    user-select: none;
}

.nav-link:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.nav-link.active {
    background: var(--bg-secondary);
    color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 600;
}

.nav-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.nav-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.expand-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.nav-link.expanded .expand-icon {
    transform: rotate(90deg);
}

.nav-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-left: 24px;
}

.nav-children.expanded {
    max-height: 2000px;
}

/* ========================================
   ÁREA DE CONTEÚDO
   ======================================== */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background: var(--bg-main);
}

/* Welcome Screen */
.welcome-screen {
    max-width: 900px;
    margin: 0 auto;
}

.welcome-screen h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-align: center;
}

.welcome-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 48px;
}

.quick-start, .support-section, .platform-features {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 32px;
}

.quick-start h2, .support-section h2, .platform-features h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.steps-list {
    list-style-position: inside;
    color: var(--text-secondary);
}

.steps-list li {
    padding: 10px 0;
    line-height: 1.6;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: var(--transition-normal);
}

.feature-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.feature-card h3 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.suggestion-path {
    font-size: 13px;
    color: var(--text-muted);
}

/* Page Content */
.page-content {
    max-width: 900px;
    margin: 0 auto;
}

.page-content h1 {
    font-size: 32px;
    color: var(--text-primary);
    margin-bottom: 24px;
    font-weight: 700;
}

.page-content h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-top: 32px;
    margin-bottom: 16px;
    font-weight: 600;
}

.page-content h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-top: 24px;
    margin-bottom: 12px;
    font-weight: 600;
}

.page-content p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.8;
    font-size: 15px;
}

.page-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.page-content em {
    color: var(--text-secondary);
    font-style: italic;
}

.page-content ul, .page-content ol {
    margin-left: 24px;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.page-content li {
    margin-bottom: 8px;
    line-height: 1.7;
}

.page-content code {
    background: var(--bg-secondary);
    color: var(--primary-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
}

.page-content pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 16px;
}

.page-content pre code {
    background: none;
    padding: 0;
}

.page-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 20px 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* ========================================
   TABELAS
   ======================================== */
.page-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.page-content thead {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
}

.page-content thead th {
    color: var(--pure-white);
    font-weight: 600;
    text-align: left;
    padding: 14px 16px;
    font-size: 14px;
    letter-spacing: 0.3px;
}

.page-content tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.page-content tbody tr:nth-child(odd) {
    background: var(--bg-secondary);
}

.page-content tbody tr:nth-child(even) {
    background: var(--bg-card);
}

.page-content tbody tr:hover {
    background: var(--bg-hover);
}

.page-content tbody tr:last-child {
    border-bottom: none;
}

.page-content td {
    padding: 12px 16px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.page-content td strong {
    color: var(--text-primary);
}

/* ========================================
   RESPONSIVIDADE - TABLET
   ======================================== */
@media (max-width: 1024px) {
    .sidebar {
        width: 260px;
    }
    
    .search-container input {
        width: 180px;
    }
    
    .search-container input:focus {
        width: 240px;
    }
}

/* ========================================
   RESPONSIVIDADE - MOBILE
   ======================================== */
@media (max-width: 768px) {
    .hamburger-btn {
        position: fixed;
        left: 16px;
        top: 16px;
        z-index: 100;
        box-shadow: var(--shadow-md);
    }
    
    .platform-header {
        padding: 10px 16px 10px 70px; 
    }
    
    .header-content {
        gap: 8px;
    }
    
    .platform-logo {
        font-size: 18px;
    }
    
    .home-text {
        display: none;
    }
    
    .btn-home {
        padding: 8px;
    }
    
    .search-container input {
        width: 140px;
        font-size: 13px;
        padding: 8px 32px 8px 12px;
    }
    
    .search-container input:focus {
        width: 180px;
    }
    
    .btn-logout {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    /* Sidebar mobile - esconde por padrão */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 95;
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .content-area {
        padding: 20px 16px;
    }
    
    .welcome-screen h1 {
        font-size: 28px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .page-content {
        padding: 0;
    }
    
    .page-content h1 {
        font-size: 26px;
    }
    
    .page-content h2 {
        font-size: 20px;
    }
    
    .page-content h3 {
        font-size: 17px;
    }
    
    .page-content table {
        font-size: 13px;
    }
    
    .page-content thead th,
    .page-content td {
        padding: 10px 12px;
    }
    
    .login-box {
        padding: 32px 24px;
    }
}

/* ========================================
   RESPONSIVIDADE - MOBILE PEQUENO
   ======================================== */
@media (max-width: 480px) {
    .header-left {
        gap: 6px;
    }
    
    .platform-logo {
        font-size: 16px;
    }
    
    .search-container input {
        width: 100px;
    }
    
    .search-container input:focus {
        width: 140px;
    }
    
    .welcome-screen h1 {
        font-size: 24px;
    }
    
    .quick-start, .support-section, .platform-features {
        padding: 20px;
    }
}

/* ========================================
   SCROLLBAR CUSTOMIZADA
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
    transition: var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-main);
}

/* ========================================
   BOTÃO THEME TOGGLE
   ======================================== */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-normal);
    font-size: 20px;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    transform: scale(1.05);
}
