/* assets/creative_theme.css - Zahar.AI Creative OS Theme */

:root {
    /* --- COLOR PALETTE: Olive & Natural (Sync with styles.css) --- */
    --primary-deep: var(--primary-900);
    /* Main Background Depth */
    --primary-mid: var(--primary-700);
    /* Secondary Elements */
    --primary-light: var(--primary-600);
    /* Hover States */
    --accent-teal: var(--accent-500);
    /* Highlights / Info (Goldenrod) */
    --accent-gold: var(--warning);
    /* Warnings / Attention */
    --success-green: var(--success);
    /* Success States */
    --danger-red: var(--danger);
    /* Errors */

    /* --- TEXT --- */
    --text-primary: var(--text-main);
    /* Dark Text */
    --text-secondary: var(--neutral-500);
    /* Muted Text */
    --text-white: #FFFFFF;
    /* Light Text */

    /* --- GLASSMORPHISM VARS --- */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(47, 62, 41, 0.10);
    --glass-blur: blur(12px);

    /* --- SIDEBAR VARS --- */
    --sidebar-width: 17rem;
    --sidebar-bg: var(--primary-900);
    /* Deep Olive */
}

body {
    background-color: #f8fafc;
    /* Neutral 50 */
    background-image:
        radial-gradient(circle at 10% 20%, rgba(30, 74, 120, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(8, 145, 178, 0.05) 0%, transparent 20%);
    background-attachment: fixed;
    font-family: 'Inter', -apple-system, system-ui, sans-serif !important;
    color: var(--text-primary);
}

/* --- TYPOGRAPHY --- */
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* --- LAYOUT UTILITIES --- */

/* Sidebar Container */
.glass-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    padding: 2rem 1rem;
    background: var(--sidebar-bg);
    color: var(--text-white);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1010;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(0);
    will-change: transform;
}

.glass-sidebar.sidebar-collapsed {
    transform: translateX(-100%);
    box-shadow: none;
}

/* Sidebar fixada: sem animaÃ§Ã£o de slide, cursor nÃ£o muda */
.glass-sidebar.sidebar-pinned {
    transform: translateX(0) !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2) !important;
    border-right: 2px solid rgba(255, 255, 255, 0.2);
}

/* BotÃ£o de pin: Ã­cone de thumbtack */
.sidebar-pin-btn {
    border: none !important;
    background: transparent !important;
    transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    line-height: 1;
}

.sidebar-pin-btn:hover {
    opacity: 0.9 !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 6px;
}

/* Quando fixado, o Ã­cone fica rotacionado -45deg e mais brilhante (feito via JS inline) */


/* BotÃ£o flutuante de reabrir sidebar (visÃ­vel quando sidebar estÃ¡ fechada) */
#sidebar-reopen-btn {
    position: fixed;
    top: 18px;
    left: 12px;
    z-index: 1011;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease 0.2s;
    border-radius: 0 8px 8px 0 !important;
    padding: 10px 14px !important;
}

#sidebar-reopen-btn.sidebar-btn-visible {
    opacity: 1;
    pointer-events: auto;
}

/* Main Content Area */
/* Dash DataTable Markdown Images */
#top-posts-table img {
    max-height: 40px !important;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.main-content {
    margin-left: 19rem;
    /* Sidebar width + gap */
    margin-right: 2rem;
    padding: 5rem 0 2rem 0;
    /* padding-top compensa o header fixo (~68px) */
    min-height: 100vh;
    transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        margin-right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: margin-left;
}

.main-content.content-expanded {
    margin-left: 2rem;
    margin-right: 2rem;
    transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        margin-right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header Global Fixo - Background via variÃ¡vel CSS para suportar temas */
.global-app-header {
    background: var(--header-bg) !important;
}

/* Header fixo acompanha o colapso do sidebar */
.content-expanded .global-app-header,
#page-content.content-expanded .global-app-header {
    left: 0 !important;
}

.main-content-full {
    margin-left: 0;
    margin-right: 0;
    padding: 0;
    min-height: 100vh;
    width: 100%;
    transition: all 0.3s ease;
}

/* --- COMPONENTS --- */

/* Glass Card - Standard */
.glass-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    /* For rounded corners on children */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
}

.overflow-visible {
    overflow: visible !important;
}

/* Glass Card - Strong (Checking Login) */
.glass-card-strong {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    padding: 2rem;
}

/* SortableJS drag and ghost config */
.sortable-ghost {
    opacity: 0.4;
    background-color: #f1f5f9;
}

.sortable-drag {
    cursor: grabbing !important;
}

/* Navigation Links */
.nav-link-custom {
    color: rgba(255, 255, 255, 0.7) !important;
    border-radius: 12px !important;
    padding: 0.75rem 1rem !important;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    border: 1px solid transparent;
}

.nav-link-custom:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.nav-link-custom.active {
    color: #fff !important;
    background: linear-gradient(90deg, rgba(8, 145, 178, 0.2) 0%, rgba(8, 145, 178, 0.0) 100%);
    border-left: 3px solid var(--accent-teal);
    border-radius: 4px 12px 12px 4px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.nav-link-custom i {
    width: 24px;
    text-align: center;
    margin-right: 12px;
}

/* --- ANIMATIONS --- */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-in {
    animation: fadeInScale 0.4s ease-out forwards;
}

/* --- CUSTOM SCROLLBAR --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- AI RESTRICTED BUTTONS --- */
.btn-ia-restrito {
    background-color: #e2e8f0 !important;
    border-color: #cbd5e1 !important;
    color: #94a3b8 !important;
    cursor: pointer !important;
    filter: grayscale(0.8);
    opacity: 0.8;
    box-shadow: none !important;
}

.btn-ia-restrito:hover {
    background-color: #cbd5e1 !important;
    opacity: 1;
}

/* --- CHAT REDESIGN (Side Drawer) --- */
.chat-drawer-container {
    position: fixed;
    top: 50%;
    /* Center vertically */
    right: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
}

.chat-toggle-arrow {
    background: var(--accent-teal);
    /* Use accent color */
    color: white;
    width: 30px;
    height: 60px;
    border-radius: 8px 0 0 8px;
    /* Rounded only on left */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-toggle-arrow:hover {
    width: 35px;
    /* Expand slightly on hover */
    background: var(--primary-color);
}

.chat-drawer-window {
    position: fixed;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
    transition: right 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Open State */
.chat-drawer-open {
    right: 0 !important;
}

/* Backdrop for mobile (optional) */
.chat-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9998;
    display: none;
}

.chat-backdrop.visible {
    display: block;
}

/* Brace removed */

.chat-window {
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.chat-header {
    background: #0f172a;
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Chat Header Text */
.chat-header h6,
.chat-header .h6,
.chat-header span {
    color: #1f2937 !important;
}

/* Messages Area */
.chat-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 85%;
    font-size: 0.9rem;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-message.sent {
    background: #e2e8f0;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-message.received {
    background: white;
    border: 1px solid #e2e8f0;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.message-meta {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-bottom: 2px;
}

.chat-input-area {
    padding: 10px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    background: white;
}

/* STATUS DOTS */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.status-online {
    background-color: #22c55e;
}

.status-away {
    background-color: #f97316;
}

.status-busy {
    background-color: #ef4444;
}

.status-offline {
    background-color: #94a3b8;
}

.user-presence-item {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    font-size: 0.85rem;
}
/* =========================================
   MODAL DE IMPRESSÃO (CADERNO DE CAMPANHAS)
   ========================================= */
@media print {
    /* Esconde navbars, menus, botões e barras de rolagem */
    .sidebar, .glass-sidebar, .hamburger-btn, .mobile-menu-overlay, 
    .filters-stack, .dash-tabs, .d-print-none, .tab-content > .active > div:not(.print-only-container) {
        display: none !important;
    }

    /* Reseta layout do body para ocupar 100% da folha */
    body, html, #page-content, .content-transition {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }

    /* Exibe o container de impressão que estava oculto */
    #print-report-container, .d-print-block {
        display: block !important;
        width: 100% !important;
    }

    /* Evita quebras de página no meio de um card */
    .print-page-break-inside-avoid {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
}
