/* ============================================================
   ContraSaaS — Estilos customizados
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

* { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: #030712;
    color: #f1f5f9;
}

/* Scrollbar personalizada */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #111827; }
::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4B5563; }

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: 256px;
    background: #0f172a;
    border-right: 1px solid #1e293b;
    z-index: 50;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 40;
    display: none;
}

.sidebar-overlay.ativo { display: block; }

@media (max-width: 1023px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.aberta { transform: translateX(0); }
    #conteudo-principal { margin-left: 0 !important; }
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 24px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover { border-color: #334155; }

.card-glass {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    padding: 24px;
}

/* ============================================================
   Botões
   ============================================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #4f46e5;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    text-decoration: none;
}
.btn-primary:hover { background: #4338ca; box-shadow: 0 0 20px rgba(79,70,229,0.4); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1e293b;
    color: #cbd5e1;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    border: 1px solid #334155;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    text-decoration: none;
}
.btn-secondary:hover { background: #273549; border-color: #4b5563; }

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #7f1d1d;
    color: #fca5a5;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    border: 1px solid #991b1b;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}
.btn-danger:hover { background: #991b1b; }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }

/* ============================================================
   Inputs
   ============================================================ */
.input-dark {
    width: 100%;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #f1f5f9;
    padding: 10px 14px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.input-dark:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}
.input-dark::placeholder { color: #64748b; }
.input-dark:disabled { opacity: 0.5; cursor: not-allowed; }

.label-dark {
    display: block;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-group { margin-bottom: 16px; }

/* ============================================================
   Badges de status
   ============================================================ */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-rascunho  { background: #1f2937; color: #9ca3af; border: 1px solid #374151; }
.badge-enviado   { background: #1e3a5f; color: #60a5fa; border: 1px solid #1d4ed8; }
.badge-visualizado { background: #3d2c00; color: #fbbf24; border: 1px solid #d97706; }
.badge-assinado  { background: #14532d; color: #4ade80; border: 1px solid #16a34a; }
.badge-cancelado { background: #450a0a; color: #f87171; border: 1px solid #dc2626; }
.badge-expirado  { background: #431407; color: #fb923c; border: 1px solid #ea580c; }
.badge-trial     { background: #312e81; color: #a5b4fc; border: 1px solid #4f46e5; }
.badge-ia        { background: #1a1a2e; color: #c084fc; border: 1px solid #7c3aed; }

/* ============================================================
   Tabelas
   ============================================================ */
.tabela-dark {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.tabela-dark th {
    background: #0f172a;
    color: #64748b;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #1e293b;
}
.tabela-dark td {
    padding: 14px 16px;
    border-bottom: 1px solid #1e293b;
    color: #cbd5e1;
    vertical-align: middle;
}
.tabela-dark tr:last-child td { border-bottom: none; }
.tabela-dark tr:hover td { background: rgba(255,255,255,0.02); }

/* ============================================================
   Toast notifications
   ============================================================ */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    animation: slideInRight 0.3s ease;
    cursor: pointer;
}

.toast-sucesso  { background: #14532d; color: #4ade80; border: 1px solid #16a34a; }
.toast-erro     { background: #450a0a; color: #f87171; border: 1px solid #dc2626; }
.toast-aviso    { background: #3d2c00; color: #fbbf24; border: 1px solid #d97706; }
.toast-info     { background: #1e3a5f; color: #60a5fa; border: 1px solid #1d4ed8; }

/* ============================================================
   Animações
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-slow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.fade-in    { animation: fadeIn 0.4s ease; }
.slide-in   { animation: slideIn 0.3s ease; }
.pulse-slow { animation: pulse-slow 2s infinite; }

/* ============================================================
   Spinner
   ============================================================ */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(79,70,229,0.3);
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Paginação
   ============================================================ */
.paginacao {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 20px;
}
.paginacao a, .paginacao span {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.2s;
}
.paginacao a { color: #94a3b8; }
.paginacao a:hover { background: #1e293b; color: #f1f5f9; }
.paginacao .ativa { background: #4f46e5; color: #fff; pointer-events: none; }
.paginacao .desabilitada { color: #374151; pointer-events: none; }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-box {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeIn 0.25s ease;
}

/* ============================================================
   Editor Quill dark
   ============================================================ */
.ql-toolbar { background: #1e293b !important; border-color: #334155 !important; border-radius: 8px 8px 0 0; }
.ql-container { background: #1e293b !important; border-color: #334155 !important; border-radius: 0 0 8px 8px; color: #f1f5f9 !important; min-height: 300px; font-family: 'Inter', sans-serif; }
.ql-toolbar .ql-stroke { stroke: #94a3b8 !important; }
.ql-toolbar .ql-fill { fill: #94a3b8 !important; }
.ql-toolbar button:hover .ql-stroke { stroke: #f1f5f9 !important; }
.ql-toolbar .ql-picker-label { color: #94a3b8 !important; }

/* ============================================================
   Canvas de assinatura
   ============================================================ */
#canvas-assinatura {
    border: 2px dashed #334155;
    border-radius: 8px;
    cursor: crosshair;
    background: #1e293b;
    display: block;
    width: 100%;
    touch-action: none;
}
#canvas-assinatura.assinado { border-color: #16a34a; border-style: solid; }

/* ============================================================
   Métricas (cards de dashboard)
   ============================================================ */
.metrica-card {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 20px 24px;
    transition: all 0.2s;
}
.metrica-card:hover { border-color: #4f46e5; box-shadow: 0 0 30px rgba(79,70,229,0.1); }
.metrica-valor { font-size: 32px; font-weight: 700; line-height: 1; }
.metrica-label { font-size: 13px; color: #64748b; margin-top: 4px; }
.metrica-variacao { font-size: 12px; margin-top: 8px; }
.metrica-up   { color: #4ade80; }
.metrica-down { color: #f87171; }

/* ============================================================
   Step wizard (instalação, novo contrato)
   ============================================================ */
.step-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 32px;
}
.step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #64748b;
}
.step.ativo { color: #a5b4fc; }
.step.concluido { color: #4ade80; }
.step-numero {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600;
    background: #1e293b;
    border: 1px solid #334155;
    flex-shrink: 0;
}
.step.ativo .step-numero { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.step.concluido .step-numero { background: #16a34a; border-color: #16a34a; color: #fff; }
.step-linha { flex: 1; height: 1px; background: #1e293b; margin: 0 8px; }
