:root {
    --bg-dark: #06050a;
    --bg-card: #110f18;
    --bg-input: #171522;
    --primary-purple: #7c3aed;
    --primary-gold: #cfa86b;
    --accent-purple: #a78bfa;
    --text-light: #f3f4f6;
    --text-muted: #9ca3af;
    --border-color: rgba(124, 58, 237, 0.15);
    --border-color-active: rgba(124, 58, 237, 0.4);
    --success-green: #10b981;
    --warning-orange: #f59e0b;
    --danger-red: #ef4444;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Outfit', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: var(--font-body);
    line-height: 1.5;
    overflow-x: hidden;
}

/* ==========================================
   TELA DE LOGIN
   ========================================== */

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
    background: radial-gradient(circle at center, #18112c 0%, var(--bg-dark) 100%);
}

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

.login-logo {
    font-family: 'Cinzel Decorative', serif;
    font-weight: 900;
    font-size: 2.2rem;
    letter-spacing: 2px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffffff 40%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    margin-bottom: 20px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    height: 48px;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 0 16px;
    color: #ffffff;
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-purple);
    background: rgba(124, 58, 237, 0.02);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.15);
}

.btn-admin-submit {
    width: 100%;
    height: 48px;
    background: var(--primary-purple);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.25);
}

.btn-admin-submit:hover {
    background: #ffffff;
    color: var(--primary-purple);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
}

.error-message {
    color: var(--danger-red);
    font-size: 0.85rem;
    margin-top: 16px;
    display: none;
}

/* ==========================================
   LAYOUT DO DASHBOARD
   ========================================== */

.dashboard-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: #090711;
    border-right: 1px solid rgba(124, 58, 237, 0.05);
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

/* Custom Scrollbars */
.admin-sidebar::-webkit-scrollbar,
.admin-main::-webkit-scrollbar {
    width: 6px;
}

.admin-sidebar::-webkit-scrollbar-track,
.admin-main::-webkit-scrollbar-track {
    background: transparent;
}

.admin-sidebar::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.15);
    border-radius: 4px;
}

.admin-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 58, 237, 0.3);
}

.admin-main::-webkit-scrollbar-thumb {
    background: rgba(207, 168, 107, 0.15);
    border-radius: 4px;
}

.admin-main::-webkit-scrollbar-thumb:hover {
    background: rgba(207, 168, 107, 0.3);
}

.admin-brand {
    font-family: 'Cinzel Decorative', serif;
    font-weight: 900;
    font-size: 1.8rem;
    letter-spacing: 2px;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #ffffff 40%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.admin-tag {
    font-size: 0.7rem;
    color: var(--accent-purple);
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 40px;
}

.admin-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.admin-menu-item button {
    width: 100%;
    height: 48px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    padding: 0 16px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-smooth);
}

.admin-menu-item button:hover,
.admin-menu-item.active button {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.03);
}

.admin-menu-item.active button {
    color: var(--accent-purple);
    background: rgba(124, 58, 237, 0.06);
    border-left: 3px solid var(--primary-purple);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.btn-logout {
    width: 100%;
    height: 44px;
    background: none;
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger-red);
    font-family: var(--font-heading);
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition-smooth);
}

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

/* Área Principal */
.admin-main {
    flex-grow: 1;
    padding: 48px;
    overflow-y: auto;
}

.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 36px;
}

.admin-section-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
}

.btn-accent {
    background: var(--primary-gold);
    color: #08090c;
    border: none;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.btn-accent:hover {
    background: #ffffff;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.15);
}

/* Tabela de Artigos */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th, 
.admin-table td {
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.admin-table th {
    background: rgba(255, 255, 255, 0.01);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent-purple);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table td {
    font-size: 0.95rem;
}

.status-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 40px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.publicado {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success-green);
}

.status-badge.rascunho {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning-orange);
}

.status-badge.agendado {
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #c084fc;
}

.status-badge.ativo {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success-green);
}

.status-badge.pendente {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning-orange);
}

.status-badge.cancelado {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.btn-icon-action {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    width: 34px;
    height: 34px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-icon-action:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.03);
}

.btn-icon-action.edit:hover {
    border-color: rgba(124, 58, 237, 0.4);
    color: var(--accent-purple);
}

.btn-icon-action.delete:hover {
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--danger-red);
}

.btn-icon-action.toggle-pub:hover {
    border-color: rgba(124, 58, 237, 0.4);
    color: var(--primary-purple);
}

/* ==========================================
   EDITOR DE ARTIGOS (MODAL/TELA CHEIA)
   ========================================== */

.editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    z-index: 1000;
    display: none;
    flex-direction: column;
}

.editor-header {
    height: 70px;
    background: #090711;
    border-bottom: 1px solid rgba(124, 58, 237, 0.05);
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.editor-header h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
}

.editor-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-outline {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Layout de Duas Colunas do Editor */
.editor-workspace {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}

.editor-main-panel {
    flex-grow: 1;
    padding: 40px 60px;
    overflow-y: auto;
    background: var(--bg-dark);
}

.editor-meta-panel {
    width: 360px;
    background: #090711;
    border-left: 1px solid rgba(124, 58, 237, 0.05);
    padding: 40px 24px;
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.meta-panel-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-purple);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(124, 58, 237, 0.05);
    padding-bottom: 10px;
}

/* Editor Visual (Notion/Medium Style) */
.visual-editor-container {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 100px;
    position: relative;
}

/* Toolbar Flutuante */
.editor-toolbar {
    background: #151221;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px;
    display: flex;
    gap: 4px;
    position: sticky;
    top: 0;
    z-index: 10;
    margin-bottom: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    flex-wrap: wrap;
}

.toolbar-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.toolbar-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.04);
}

.toolbar-btn.active {
    color: var(--accent-purple);
    background: rgba(124, 58, 237, 0.1);
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.05);
    margin: 6px 4px;
}

/* ContentEditable Area */
.editable-area {
    min-height: 400px;
    color: #dbdee1;
    font-size: 1.1rem;
    line-height: 1.7;
    outline: none;
}

.editable-area p {
    margin-bottom: 20px;
}

.editable-area blockquote {
    border-left: 3px solid var(--primary-purple);
    padding-left: 20px;
    margin: 30px 0;
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-style: italic;
    color: #ffffff;
}

/* Estilo para imagens e vídeos inseridos */
.inserted-img-wrapper {
    margin: 30px 0;
    text-align: center;
}

.inserted-img-wrapper img {
    max-width: 100%;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.inserted-video-wrapper {
    margin: 30px 0;
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    border-radius: 4px;
    overflow: hidden;
}

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

.inserted-btn-wrapper {
    margin: 30px 0;
    text-align: center;
}

/* ==========================================
   GERENCIADOR DE CATEGORIAS
   ========================================== */

.category-manager-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.category-list-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 30px;
}

.category-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 12px 18px;
    border-radius: 4px;
    font-weight: 500;
}

.category-item span {
    color: #ffffff;
}

.category-item button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.category-item button:hover {
    color: var(--danger-red);
}

.category-add-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 30px;
    height: fit-content;
}

/* Default styles for new mobile components (hidden on desktop) */
.admin-mobile-header {
    display: none;
}
.admin-sidebar-close {
    display: none;
}
.admin-sidebar-overlay {
    display: none;
}

/* ==========================================
   RESPONSIVIDADE DA ADMINISTRAÇÃO
   ========================================== */

@media (max-width: 1024px) {
    .dashboard-container {
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
    }
    
    .admin-mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: #090711;
        border-bottom: 1px solid rgba(124, 58, 237, 0.08);
        height: 60px;
        padding: 0 16px;
        padding-top: env(safe-area-inset-top);
        height: calc(60px + env(safe-area-inset-top));
        position: sticky;
        top: 0;
        z-index: 900;
        width: 100%;
        box-sizing: border-box;
        flex-shrink: 0;
    }
    
    .admin-mobile-logo {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
    }
    
    .admin-mobile-logo img {
        height: 40px;
        max-width: 100%;
        object-fit: contain;
    }
    
    .admin-mobile-menu-toggle {
        background: none;
        border: none;
        color: var(--text-light);
        font-size: 1.3rem;
        cursor: pointer;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
        transition: var(--transition-smooth);
    }

    .admin-mobile-menu-toggle:hover {
        background: rgba(255, 255, 255, 0.03);
    }

    .admin-sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 950;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .admin-sidebar-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        height: 100dvh;
        z-index: 1000;
        background: #090711;
        transform: translate3d(-100%, 0, 0);
        transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
        padding: 40px 24px;
        padding-top: max(40px, env(safe-area-inset-top));
        padding-bottom: max(40px, env(safe-area-inset-bottom));
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.6);
        border-right: 1px solid rgba(124, 58, 237, 0.05);
    }
    
    .admin-sidebar.open {
        transform: translate3d(0, 0, 0);
    }

    .admin-sidebar-close {
        display: flex;
        position: absolute;
        top: 16px;
        right: 16px;
        background: none;
        border: none;
        color: var(--text-muted);
        font-size: 1.5rem;
        cursor: pointer;
        width: 36px;
        height: 36px;
        align-items: center;
        justify-content: center;
        transition: var(--transition-smooth);
        z-index: 1005;
        border-radius: 50%;
    }
    
    .admin-sidebar-close:hover {
        color: #fff;
        background: rgba(255, 255, 255, 0.03);
        transform: rotate(90deg);
    }

    .admin-brand {
        margin-bottom: 6px;
        text-align: center;
    }
    
    .admin-tag {
        margin-bottom: 24px;
        text-align: center;
    }

    .admin-menu {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 0;
    }
    
    .btn-logout {
        width: 100%;
        margin-top: 24px;
    }

    .admin-main {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .admin-main {
        padding: 16px;
    }
    
    .admin-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 24px;
    }
    
    .admin-section-title {
        font-size: 1.5rem;
    }
    
    .btn-accent {
        width: 100%;
        justify-content: center;
    }
    
    .category-manager-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .editor-workspace {
        flex-direction: column;
        overflow-y: auto;
    }
    
    .editor-meta-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.03);
    }
    
    .editor-main-panel {
        padding: 16px;
    }

    .table-card {
        overflow-x: auto !important;
        max-width: 100% !important;
        background: #110f18;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        -webkit-overflow-scrolling: touch;
    }
    
    .admin-table {
        width: 100%;
        min-width: 600px; /* Garante que a tabela tenha tamanho suficiente para rolar sem esmagar colunas */
    }
    
    .admin-table th, .admin-table td {
        padding: 12px 16px;
        font-size: 0.85rem;
    }
    input, textarea, select {
        font-size: 16px !important;
    }
}
