/* ==========================================================================
   AssinaDoc SaaS - Design System & Custom CSS
   Cores: Indigo Elétrico (#4f46e5), Ardósia Escura (#0f172a), Fundo (#f8fafc)
   ========================================================================== */

:root {
    --cor-primaria: #4f46e5;
    --cor-primaria-hover: #4338ca;
    --cor-primaria-rgb: 79, 70, 229;
    --cor-sucesso: #10b981;
    --cor-alerta: #f59e0b;
    --cor-perigo: #ef4444;
    --cor-info: #0ea5e9;
    --cor-fundo: #f8fafc;
    --cor-fundo-card: #ffffff;
    --cor-texto-principal: #0f172a;
    --cor-texto-mutado: #64748b;
    --cor-borda: #e2e8f0;
    --sombra-card: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
    --sombra-elevada: 0 10px 30px -5px rgba(79, 70, 229, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --sombra-flutuante: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --borda-raio: 0.75rem;
    --borda-raio-lg: 1rem;
    --borda-raio-sm: 0.5rem;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--cor-fundo);
    color: var(--cor-texto-principal);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}

/* Sidebar & Layout */
.painel-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.painel-sidebar {
    width: 280px;
    background: #0f172a;
    color: #f8fafc;
    flex-shrink: 0;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
}

.painel-sidebar.recolhida {
    margin-left: -280px;
}

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1035;
    transition: opacity 0.3s ease;
}

.painel-conteudo {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: #f8fafc;
    min-height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #ffffff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.sidebar-brand .logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #4f46e5, #818cf8);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.sidebar-nav {
    padding: 1rem 0.85rem;
    list-style: none;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* Custom Scrollbar na Sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

.nav-secao-titulo {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    font-weight: 700;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    padding-left: 0.75rem;
}

.sidebar-nav .nav-item {
    margin-bottom: 0.25rem;
}

.sidebar-nav .nav-link {
    color: #94a3b8;
    padding: 0.7rem 0.95rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.sidebar-nav .nav-link i {
    font-size: 1.15rem;
    color: #94a3b8;
    opacity: 0.85;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
}

.sidebar-nav .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.06);
    transform: translateX(3px);
}

.sidebar-nav .nav-link:hover i {
    color: #ffffff;
    opacity: 1;
    transform: scale(1.08);
}

.sidebar-nav .nav-link.active {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.95), rgba(99, 102, 241, 0.85));
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.sidebar-nav .nav-link.active i {
    color: #ffffff;
    opacity: 1;
}

/* Cards & Components */
.card-moderno {
    background: var(--cor-fundo-card);
    border: 1px solid var(--cor-borda);
    border-radius: var(--borda-raio);
    box-shadow: var(--sombra-card);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-moderno.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: var(--sombra-elevada);
}

.card-kpi {
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
}

.card-kpi .kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* KPI Cards Coloridos com Gradientes Modernos */
.card-kpi-indigo {
    background: linear-gradient(135deg, #4338ca 0%, #6366f1 100%) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.4), 0 4px 6px -2px rgba(79, 70, 229, 0.2);
}

.card-kpi-verde {
    background: linear-gradient(135deg, #047857 0%, #10b981 100%) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.4), 0 4px 6px -2px rgba(16, 185, 129, 0.2);
}

.card-kpi-amarelo {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 10px 25px -5px rgba(245, 158, 11, 0.4), 0 4px 6px -2px rgba(245, 158, 11, 0.2);
}

.card-kpi-azul {
    background: linear-gradient(135deg, #0369a1 0%, #0ea5e9 100%) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 10px 25px -5px rgba(14, 165, 233, 0.4), 0 4px 6px -2px rgba(14, 165, 233, 0.2);
}

.card-kpi-colorido .kpi-label {
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 0.825rem;
    font-weight: 500;
}

.card-kpi-colorido .kpi-valor {
    color: #ffffff !important;
    font-size: 1.85rem;
    font-weight: 700;
}

.card-kpi-colorido .kpi-icon-glass {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.bg-primary-soft { background-color: rgba(79, 70, 229, 0.1); color: var(--cor-primaria); }
.bg-success-soft { background-color: rgba(16, 185, 129, 0.1); color: var(--cor-sucesso); }
.bg-warning-soft { background-color: rgba(245, 158, 11, 0.1); color: var(--cor-alerta); }
.bg-danger-soft { background-color: rgba(239, 68, 68, 0.1); color: var(--cor-perigo); }
.bg-info-soft { background-color: rgba(14, 165, 233, 0.1); color: var(--cor-info); }

/* Buttons */
.btn-primario {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #ffffff;
    border: none;
    font-weight: 600;
    border-radius: 0.5rem;
    padding: 0.6rem 1.25rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primario:hover, .btn-primario:focus {
    background: linear-gradient(135deg, #4338ca, #4f46e5);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

.btn-whatsapp {
    background-color: #25D366;
    color: #ffffff;
    border: none;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}
.btn-whatsapp:hover {
    background-color: #1eb956;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

/* Badges */
.badge-status {
    padding: 0.4em 0.8em;
    font-weight: 600;
    font-size: 0.775rem;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* Timeline */
.timeline-auditoria {
    position: relative;
    padding-left: 2rem;
    list-style: none;
}

.timeline-auditoria::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0.75rem;
    width: 2px;
    background: var(--cor-borda);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-icon {
    position: absolute;
    left: -2rem;
    top: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--cor-borda);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Assinador Canvas & Signature UI */
.canvas-container {
    position: relative;
    background: #ffffff;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    cursor: crosshair;
    touch-action: none;
    overflow: hidden;
}

.canvas-container.has-signature {
    border-style: solid;
    border-color: #4f46e5;
}

.assinatura-preview-caligrafica {
    font-size: 2.25rem;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.fonte-script-1 { font-family: 'Great Vibes', cursive; }
.fonte-script-2 { font-family: 'Dancing Script', cursive; }
.fonte-script-3 { font-family: 'Caveat', cursive; }
.fonte-script-4 { font-family: 'Alex Brush', cursive; }

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .painel-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
    }

    .painel-sidebar.aberta {
        left: 0;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
    }
}

/* ==========================================================================
   Toast Notifications (Canto Direito Superior)
   ========================================================================== */
.container-notificacoes-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
    width: calc(100% - 48px);
    pointer-events: none;
}

.card-notificacao {
    pointer-events: auto;
    background: #ffffff;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 10px 25px -3px rgba(15, 23, 42, 0.12), 0 4px 6px -2px rgba(15, 23, 42, 0.05);
    border-left: 5px solid #4f46e5;
    border-top: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
    overflow: hidden;
    animation: slideInNotificacao 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.card-notificacao.sucesso {
    border-left-color: #10b981;
}

.card-notificacao.erro {
    border-left-color: #ef4444;
}

.card-notificacao.alerta {
    border-left-color: #f59e0b;
}

.card-notificacao.info {
    border-left-color: #0ea5e9;
}

.card-notificacao .icone-notificacao {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.15rem;
}

.card-notificacao.sucesso .icone-notificacao {
    background-color: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.card-notificacao.erro .icone-notificacao {
    background-color: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.card-notificacao.alerta .icone-notificacao {
    background-color: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.card-notificacao.info .icone-notificacao {
    background-color: rgba(14, 165, 233, 0.12);
    color: #0ea5e9;
}

.card-notificacao .conteudo-notificacao {
    flex-grow: 1;
    min-width: 0;
}

.card-notificacao .titulo-notificacao {
    font-size: 0.875rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
}

.card-notificacao .mensagem-notificacao {
    font-size: 0.815rem;
    color: #475569;
    line-height: 1.35;
    margin: 0;
}

.card-notificacao .btn-fechar-toast {
    background: none;
    border: none;
    color: #94a3b8;
    padding: 0;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: color 0.2s;
}

.card-notificacao .btn-fechar-toast:hover {
    color: #0f172a;
}

.card-notificacao .barra-progresso-toast {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background-color: rgba(0, 0, 0, 0.08);
    width: 100%;
}

.card-notificacao .barra-progresso-toast::after {
    content: '';
    display: block;
    height: 100%;
    width: 100%;
    background-color: currentColor;
    animation: diminuirBarraToast 5s linear forwards;
}

.card-notificacao.sucesso .barra-progresso-toast::after { background-color: #10b981; }
.card-notificacao.erro .barra-progresso-toast::after { background-color: #ef4444; }
.card-notificacao.alerta .barra-progresso-toast::after { background-color: #f59e0b; }
.card-notificacao.info .barra-progresso-toast::after { background-color: #0ea5e9; }

@keyframes slideInNotificacao {
    0% {
        opacity: 0;
        transform: translateX(120%);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes diminuirBarraToast {
    0% { width: 100%; }
    100% { width: 0%; }
}

