/**
 * ==============================================================================
 * ESTILOS DO ASSISTENTE INTELIGENTE DE REPORTE DE ERROS & SUGESTÕES (NEGOMIL OS)
 * Ficheiro: css/assistente_reportes.css
 * Design System: Glassmorphism Negomil (Modo Escuro & Modo Claro) + 100% Responsivo
 * ==============================================================================
 */

:root {
    --rep-primary: #0072CE;
    --rep-emerald: #00A651;
    --rep-amber: #F9A01B;
    --rep-coral: #F05323;
    --rep-bg-modal: rgba(13, 21, 38, 0.96);
    --rep-bg-card: rgba(23, 35, 61, 0.85);
    --rep-border: rgba(56, 189, 248, 0.28);
    --rep-text: #f8fafc;
    --rep-text-muted: #94a3b8;
    --rep-input-bg: rgba(9, 14, 26, 0.9);
    --rep-shadow: 0 25px 70px -10px rgba(0, 0, 0, 0.85), 0 0 35px rgba(0, 114, 206, 0.35);
}

html[data-theme="negomil"],
html[data-mode="claro"] {
    --rep-bg-modal: rgba(255, 255, 255, 0.97);
    --rep-bg-card: rgba(241, 245, 249, 0.92);
    --rep-border: rgba(0, 114, 206, 0.22);
    --rep-text: #0f172a;
    --rep-text-muted: #475569;
    --rep-input-bg: #ffffff;
    --rep-shadow: 0 25px 65px -10px rgba(15, 23, 42, 0.28), 0 10px 25px -5px rgba(0, 114, 206, 0.18);
}

/* 1. CONTENTOR FLUTUANTE NO CANTO INFERIOR ESQUERDO */
#negomil-rep-fab-wrapper {
    position: fixed;
    bottom: 22px;
    left: 22px;
    z-index: 99990;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    font-family: 'Outfit', 'Inter', 'Segoe UI', sans-serif;
    user-select: none;
}

/* Ajustar posição caso o tema Ubuntu tenha doca esquerda de 70px */
html[data-theme="ubuntu"] #negomil-rep-fab-wrapper {
    left: 82px;
}

/* Botão Principal Flutuante (Canto Inferior Esquerdo) */
#negomil-rep-fab-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 50px;
    padding: 0 18px 0 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(13, 25, 48, 0.94), rgba(0, 114, 206, 0.88));
    border: 1.5px solid rgba(56, 189, 248, 0.55);
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 20px rgba(0, 114, 206, 0.45);
    backdrop-filter: blur(16px);
    transition: all 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

html[data-theme="negomil"] #negomil-rep-fab-btn,
html[data-mode="claro"] #negomil-rep-fab-btn {
    background: linear-gradient(135deg, #0072CE, #005bb5);
    border-color: rgba(255, 255, 255, 0.65);
    color: #ffffff;
    box-shadow: 0 12px 28px rgba(0, 114, 206, 0.42);
}

#negomil-rep-fab-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 16px 38px rgba(0, 114, 206, 0.65), 0 0 25px rgba(0, 166, 81, 0.45);
    border-color: #00A651;
}

#negomil-rep-fab-btn .rep-fab-icon-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #fbbf24;
    flex-shrink: 0;
}

/* Badge de Notificação de Reporte Resolvido */
#negomil-rep-fab-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: linear-gradient(135deg, #00A651, #10b981);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #0f172a;
    box-shadow: 0 0 14px rgba(0, 166, 81, 0.9);
    animation: repPulseBadge 1.6s infinite;
}

@keyframes repPulseBadge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.16); }
}

/* Menu Rápido Popover acima do Botão Flutuante */
#negomil-rep-quick-menu {
    display: none;
    flex-direction: column;
    gap: 8px;
    width: 285px;
    padding: 12px;
    border-radius: 20px;
    background: var(--rep-bg-modal);
    border: 1.5px solid var(--rep-border);
    box-shadow: var(--rep-shadow);
    backdrop-filter: blur(24px);
    transform-origin: bottom left;
    animation: repMenuIn 0.22s ease-out;
}

#negomil-rep-quick-menu.active {
    display: flex;
}

@keyframes repMenuIn {
    from { opacity: 0; transform: translateY(12px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.rep-quick-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: var(--rep-bg-card);
    color: var(--rep-text);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rep-quick-item:hover {
    border-color: var(--rep-primary);
    transform: translateX(3px);
    background: rgba(0, 114, 206, 0.14);
}

.rep-quick-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.rep-quick-item-title {
    font-size: 13.5px;
    font-weight: 700;
    display: block;
    color: var(--rep-text);
}

.rep-quick-item-sub {
    font-size: 11px;
    color: var(--rep-text-muted);
    display: block;
    margin-top: 1px;
}

/* 2. MODO "APONTAR E CLICAR" (SELETOR VISUAL DE ELEMENTOS / LINKS) */
#negomil-rep-inspector-banner {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000001;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    border: 2px solid #38bdf8;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 999px;
    display: none;
    align-items: center;
    gap: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 25px rgba(56, 189, 248, 0.55);
    font-family: 'Outfit', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
}

#negomil-rep-inspector-highlight {
    position: fixed;
    pointer-events: none;
    z-index: 1000000;
    border: 2.5px dashed #F9A01B;
    background: rgba(249, 160, 27, 0.16);
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(249, 160, 27, 0.55);
    display: none;
    transition: all 0.06s ease-out;
}

#negomil-rep-inspector-tooltip {
    position: fixed;
    pointer-events: none;
    z-index: 1000001;
    background: #0f172a;
    border: 1px solid #F9A01B;
    color: #f8fafc;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11.5px;
    font-family: monospace;
    max-width: 420px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.6);
}

/* 3. MODAL PRINCIPAL DO ASSISTENTE DE REPORTE & EDITOR DE ANOTAÇÃO */
#negomil-rep-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999995;
    background: rgba(5, 10, 22, 0.78);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    font-family: 'Outfit', 'Inter', sans-serif;
}

#negomil-rep-modal-backdrop.active {
    display: flex;
}

.rep-modal-container {
    width: 100%;
    max-width: 1140px;
    max-height: 92vh;
    background: var(--rep-bg-modal);
    border: 1.5px solid var(--rep-border);
    border-radius: 26px;
    box-shadow: var(--rep-shadow);
    color: var(--rep-text);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.rep-modal-top-stripe {
    height: 4px;
    width: 100%;
    background: linear-gradient(90deg, #F05323, #F9A01B, #0072CE, #00A651);
}

.rep-modal-header {
    padding: 18px 26px;
    border-bottom: 1px solid var(--rep-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.rep-modal-tabs {
    display: flex;
    gap: 8px;
}

.rep-tab-btn {
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid var(--rep-border);
    background: var(--rep-bg-card);
    color: var(--rep-text-muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.rep-tab-btn.active {
    background: var(--rep-primary);
    border-color: var(--rep-primary);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(0, 114, 206, 0.4);
}

.rep-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 22px 26px;
}

.rep-workspace-grid {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 22px;
    align-items: start;
}

/* Barra de Ferramentas de Desenho na Captura */
.rep-canvas-panel {
    background: var(--rep-bg-card);
    border: 1px solid var(--rep-border);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rep-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 14px;
    background: var(--rep-input-bg);
    border: 1px solid var(--rep-border);
}

.rep-tool-btn {
    height: 34px;
    padding: 0 11px;
    border-radius: 9px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--rep-text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.18s;
}

.rep-tool-btn:hover {
    background: rgba(0, 114, 206, 0.15);
}

.rep-tool-btn.active {
    background: var(--rep-primary);
    color: #ffffff;
}

.rep-color-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    cursor: pointer;
    transition: transform 0.15s;
}

.rep-color-dot.active {
    transform: scale(1.25);
    border-color: #ffffff;
    box-shadow: 0 0 10px currentColor;
}

.rep-canvas-stage {
    position: relative;
    width: 100%;
    min-height: 290px;
    max-height: 430px;
    border-radius: 14px;
    overflow: auto;
    background: #070b14;
    border: 1px dashed var(--rep-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

#negomil-rep-canvas {
    max-width: 100%;
    height: auto;
    cursor: crosshair;
    display: block;
    border-radius: 10px;
}

/* Formulário de Dados do Reporte */
.rep-form-panel {
    background: var(--rep-bg-card);
    border: 1px solid var(--rep-border);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.rep-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rep-label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--rep-text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rep-input, .rep-select, .rep-textarea {
    width: 100%;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid var(--rep-border);
    background: var(--rep-input-bg);
    color: var(--rep-text);
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.rep-input:focus, .rep-select:focus, .rep-textarea:focus {
    border-color: var(--rep-primary);
    box-shadow: 0 0 0 3px rgba(0, 114, 206, 0.22);
}

.rep-element-box {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(249, 160, 27, 0.12);
    border: 1px solid rgba(249, 160, 27, 0.4);
    font-size: 12px;
    color: var(--rep-text);
    display: none;
    flex-direction: column;
    gap: 4px;
}

.rep-btn-submit {
    width: 100%;
    padding: 14px 20px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, #00A651, #059669);
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 10px 25px rgba(0, 166, 81, 0.4);
    transition: all 0.25s;
}

.rep-btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0, 166, 81, 0.6);
}

/* Cartões de Notificação e Histórico do Utilizador */
.rep-notif-card {
    background: var(--rep-bg-card);
    border: 1px solid var(--rep-border);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rep-notif-card.unread {
    border-left: 5px solid #00A651;
    box-shadow: 0 8px 25px rgba(0, 166, 81, 0.18);
}

/* Responsividade Mobile / Tablet */
@media (max-width: 960px) {
    .rep-workspace-grid {
        grid-template-columns: 1fr;
    }
    #negomil-rep-fab-wrapper {
        bottom: 90px;
        left: 14px;
    }
    #negomil-rep-fab-btn span.rep-fab-text {
        display: none;
    }
    #negomil-rep-fab-btn {
        padding: 0 10px;
        width: 48px;
        height: 48px;
        justify-content: center;
    }
}
