/**
 * ============================================================
 * Finança Fácil — Folha de Estilos Personalizada
 * ============================================================
 * CSS complementar ao Tailwind CSS para a aplicação financeira.
 * Paleta: Esmeralda / Teal (primary / accent).
 * Organizado por seções com comentários em Português.
 * ============================================================
 */


/* ============================================================
   1. ESTILOS BASE
   ============================================================ */

/* --- Seleção de texto personalizada --- */
::selection {
    background-color: #059669;       /* primary-600 */
    color: #ffffff;
}

::-moz-selection {
    background-color: #059669;
    color: #ffffff;
}

/* --- Scrollbar fina com tema esmeralda --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;             /* slate-100 */
}

::-webkit-scrollbar-thumb {
    background: #6ee7b7;             /* primary-300 */
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #34d399;             /* primary-400 */
}

/* Scrollbar para Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #6ee7b7 #f1f5f9;
}

/* --- Transições suaves em elementos interativos --- */
a,
button,
input,
select,
textarea,
[role="button"] {
    transition: all 0.2s ease-in-out;
}

/* Remove outline padrão, adiciona ring ao focar */
:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #34d399;
    border-radius: 0.375rem;
}

/* --- Corpo da página: fonte Inter --- */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


/* ============================================================
   2. ANIMAÇÕES — KEYFRAMES
   ============================================================ */

/* Fade in simples */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Slide in pela direita */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide in pela esquerda */
@keyframes slideInLeft {
    from {
        transform: translateX(-30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide in pela direita (sutil) */
@keyframes slideInRight {
    from {
        transform: translateX(30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide in de baixo para cima */
@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Escala desde zero */
@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Pulso para alertas */
@keyframes pulseAlert {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.02);
    }
}

/* Shimmer para estados de carregamento */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Animação da barra de progresso */
@keyframes progressFill {
    from { width: 0%; }
    to   { width: var(--progress-width, 100%); }
}

/* Slide out para fechar alertas */
@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
        max-height: 200px;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
        max-height: 0;
    }
}

/* Rotação do spinner */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Bounce sutil para notificações */
@keyframes bounceIn {
    0%   { transform: translateY(20px) scale(0.95); opacity: 0; }
    60%  { transform: translateY(-4px) scale(1.01); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* --- Classes utilitárias de animação --- */
.animate-fade-in       { animation: fadeIn 0.3s ease-out forwards; }
.animate-slide-in      { animation: slideIn 0.3s ease-out forwards; }
.animate-slide-left    { animation: slideInLeft 0.35s ease-out forwards; }
.animate-slide-right   { animation: slideInRight 0.35s ease-out forwards; }
.animate-slide-up      { animation: slideInUp 0.3s ease-out forwards; }
.animate-scale-in      { animation: scaleIn 0.25s ease-out forwards; }
.animate-pulse-alert   { animation: pulseAlert 2s ease-in-out infinite; }
.animate-bounce-in     { animation: bounceIn 0.4s ease-out forwards; }
.animate-slide-out     { animation: slideOutRight 0.4s ease-in forwards; }


/* ============================================================
   3. ENHANCEMENTS DE FORMULÁRIOS
   ============================================================ */

/* --- Foco personalizado em inputs --- */
.form-input:focus {
    border-color: #34d399;          /* primary-400 */
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
    outline: none;
}

/* Estado de erro nos campos */
.form-input.input-error {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.form-input.input-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Estado de sucesso nos campos */
.form-input.input-success {
    border-color: #10b981;
    background-color: #ecfdf5;
}

/* --- Select customizado com seta esmeralda --- */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236ee7b7'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

.form-select:focus {
    border-color: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
}

/* --- Toggle Switch (interruptor) --- */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.toggle-switch input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.toggle-track {
    width: 2.5rem;                   /* 40px */
    height: 1.25rem;                 /* 20px */
    background-color: #d1d5db;       /* gray-300 */
    border-radius: 9999px;
    transition: background-color 0.3s ease;
    position: relative;
}

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1rem;                     /* 16px */
    height: 1rem;
    background-color: #ffffff;
    border-radius: 9999px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.toggle-switch input:checked + .toggle-track {
    background-color: #059669;       /* primary-600 */
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
    transform: translateX(1.25rem);
}

/* Tamanho pequeno */
.toggle-sm .toggle-track {
    width: 2rem;
    height: 1rem;
}

.toggle-sm .toggle-thumb {
    width: 0.75rem;
    height: 0.75rem;
}

.toggle-sm input:checked + .toggle-track .toggle-thumb {
    transform: translateX(1rem);
}

/* --- Radio button customizado --- */
.radio-card {
    position: relative;
    cursor: pointer;
}

.radio-card input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.radio-card-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;      /* gray-200 */
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;                 /* gray-600 */
    transition: all 0.2s ease;
}

.radio-card input:checked + .radio-card-label {
    border-color: #059669;           /* primary-600 */
    background-color: #ecfdf5;       /* primary-50 */
    color: #047857;                  /* primary-700 */
}

.radio-card:hover .radio-card-label {
    border-color: #6ee7b7;
}

/* --- File input customizado --- */
.file-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #d1d5db;
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #f9fafb;
}

.file-input-wrapper:hover {
    border-color: #6ee7b7;
    background-color: #ecfdf5;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-input-wrapper.has-file {
    border-color: #059669;
    border-style: solid;
    background-color: #ecfdf5;
}

/* --- Date picker (calendário) --- */
input[type="date"],
input[type="datetime-local"],
input[type="month"] {
    color-scheme: light;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    color: #059669;
}


/* ============================================================
   4. ESTILOS DE TABELA
   ============================================================ */

/* --- Container responsivo com scroll horizontal --- */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
}

/* --- Tabela base --- */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f9fafb;       /* gray-50 */
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;                 /* gray-500 */
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
    user-select: none;
}

/* Cursor de ordenação */
.data-table thead th.sortable {
    cursor: pointer;
}

.data-table thead th.sortable:hover {
    color: #059669;
    background-color: #ecfdf5;
}

/* Indicadores de ordenação */
.sort-asc::after  { content: ' ↑'; font-size: 0.65rem; color: #059669; }
.sort-desc::after { content: ' ↓'; font-size: 0.65rem; color: #059669; }

/* --- Linhas com zebrado (striped) --- */
.data-table tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

/* Hover nas linhas */
.data-table tbody tr {
    transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
    background-color: #ecfdf5;       /* primary-50 */
}

/* --- Células --- */
.data-table tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #374151;                 /* gray-700 */
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

/* Sem borda na última linha */
.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* --- Linha de destaque (ex: item selecionado) --- */
.data-table tbody tr.row-highlight {
    background-color: #d1fae5;       /* primary-100 */
}

/* Linha de erro */
.data-table tbody tr.row-error {
    background-color: #fef2f2;       /* red-50 */
}


/* ============================================================
   5. ESTILOS DE CARDS
   ============================================================ */

/* --- Card stat com efeito de elevação no hover --- */
.stat-card {
    background: #ffffff;
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #059669, #14b8a6);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.12);
    border-color: #6ee7b7;
}

.stat-card:hover::before {
    opacity: 1;
}

/* --- Card genérico --- */
.card {
    background: #ffffff;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.1);
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f3f4f6;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #f3f4f6;
    background-color: #f9fafb;
}


/* ============================================================
   6. ESTILOS DE MODAL
   ============================================================ */

/* --- Backdrop com blur --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 40;
    animation: fadeIn 0.2s ease-out;
}

/* --- Container do modal --- */
.modal-container {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 1rem;
}

/* --- Conteúdo do modal --- */
.modal-content {
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    position: relative;
    z-index: 10;
    animation: scaleIn 0.25s ease-out;
}

/* Tamanhos */
.modal-sm { max-width: 24rem; }
.modal-md { max-width: 32rem; }
.modal-lg { max-width: 48rem; }
.modal-xl { max-width: 64rem; }
.modal-full { max-width: 95vw; }

/* --- Cabeçalho do modal --- */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f3f4f6;
}

.modal-header-bg {
    background: linear-gradient(135deg, #059669, #0d9488);
    color: #ffffff;
}

.modal-header-bg .modal-title {
    color: #ffffff;
}

/* --- Botão fechar do modal --- */
.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    color: #9ca3af;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.modal-close:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.modal-header-bg .modal-close {
    color: rgba(255, 255, 255, 0.7);
}

.modal-header-bg .modal-close:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* --- Corpo do modal com scroll --- */
.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(85vh - 8rem);
}

/* --- Rodapé do modal --- */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #f3f4f6;
    background-color: #f9fafb;
}


/* ============================================================
   7. ESTILOS DE BADGE (DISTINTIVOS)
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25rem;
    white-space: nowrap;
}

/* Pago / Ativo / Sucesso */
.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

/* Pendente / Aguardando */
.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

/* Atrasado / Vencido / Erro */
.badge-danger {
    background-color: #fef2f2;
    color: #991b1b;
}

/* Informativo / Info */
.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Neutro / Padrão */
.badge-neutral {
    background-color: #f3f4f6;
    color: #4b5563;
}

/* Esmeralda (primário) */
.badge-primary {
    background-color: #d1fae5;
    color: #047857;
}

/* Cancelado / Inativo */
.badge-secondary {
    background-color: #f3f4f6;
    color: #6b7280;
}

/* Outline */
.badge-outline-success {
    border: 1px solid #6ee7b7;
    color: #059669;
    background-color: transparent;
}

.badge-outline-warning {
    border: 1px solid #fcd34d;
    color: #d97706;
    background-color: transparent;
}

.badge-outline-danger {
    border: 1px solid #fca5a5;
    color: #dc2626;
    background-color: transparent;
}


/* ============================================================
   8. ESTILOS DE GRÁFICO / CONTAINER
   ============================================================ */

/* --- Container de gráfico --- */
.chart-container {
    background: #ffffff;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.chart-container-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

/* --- Barra de gráfico com topo arredondado --- */
.chart-bar {
    border-radius: 0.375rem 0.375rem 0 0;
    background: linear-gradient(180deg, #059669, #14b8a6);
    transition: all 0.3s ease;
    position: relative;
    min-height: 4px;
}

.chart-bar:hover {
    opacity: 0.85;
    transform: scaleY(1.02);
    transform-origin: bottom;
}

.chart-bar::after {
    content: attr(data-value);
    position: absolute;
    top: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.625rem;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chart-bar:hover::after {
    opacity: 1;
}

/* Barra negativa (despesas) */
.chart-bar-negative {
    background: linear-gradient(180deg, #f87171, #ef4444);
}

/* --- Barra de progresso --- */
.progress-bar {
    height: 0.5rem;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    background: linear-gradient(90deg, #059669, #14b8a6);
    transition: width 0.6s ease;
    animation: progressFill 1s ease-out;
}

/* --- Timeline connector (linha conectora) --- */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #d1fae5;
}

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

.timeline-item:last-child {
    padding-bottom: 0;
}

/* Ponto do timeline */
.timeline-dot {
    position: absolute;
    left: -1.625rem;
    top: 0.25rem;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 9999px;
    background-color: #059669;
    border: 2px solid #d1fae5;
    z-index: 1;
}

.timeline-dot-pending {
    background-color: #f59e0b;
    border-color: #fef3c7;
}

.timeline-dot-danger {
    background-color: #ef4444;
    border-color: #fef2f2;
}


/* ============================================================
   9. ALERTAS / NOTIFICAÇÕES
   ============================================================ */

/* --- Alerta descartável --- */
.alert-dismissible {
    position: relative;
    padding: 1rem 2.5rem 1rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid;
    animation: bounceIn 0.4s ease-out;
    overflow: hidden;
}

.alert-dismissible.dismissing {
    animation: slideOutRight 0.4s ease-in forwards;
}

/* Tipos de alerta */
.alert-success {
    background-color: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.alert-danger {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.alert-info {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

/* Botão fechar do alerta */
.alert-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 0.25rem;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.alert-close:hover {
    opacity: 1;
}

/* --- Banner de alerta com gradiente --- */
.alert-banner {
    background: linear-gradient(135deg, #059669 0%, #0d9488 50%, #0891b2 100%);
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.alert-banner a {
    color: #ffffff;
    text-decoration: underline;
    font-weight: 600;
}

.alert-banner a:hover {
    opacity: 0.9;
}


/* ============================================================
   10. ESTILOS DE IMPRESSÃO
   ============================================================ */

@media print {
    /* Esconde sidebar */
    #sidebar,
    #sidebar-overlay,
    #sidebar-toggle {
        display: none !important;
    }

    /* Esconde botões e ações interativas */
    button,
    .no-print,
    .alert-dismissible,
    .toast-container,
    nav,
    .modal-backdrop,
    .modal-container {
        display: none !important;
    }

    /* Ajusta layout para imprimir */
    body {
        background: #ffffff !important;
        font-size: 12pt;
        color: #000000;
    }

    main {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    /* Tabelas sem hover */
    .data-table tbody tr:hover {
        background-color: transparent !important;
    }

    .data-table thead th {
        background-color: #f3f4f6 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Cards sem sombra */
    .stat-card,
    .card,
    .chart-container {
        box-shadow: none !important;
        border: 1px solid #d1d5db !important;
        break-inside: avoid;
    }

    /* Links com underline */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #6b7280;
    }
}


/* ============================================================
   11. ESTILOS DE CALENDÁRIO (Melhor Dia)
   ============================================================ */

/* --- Grid do calendário --- */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

/* Cabeçalhos do calendário (dias da semana) */
.calendar-header {
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: #6b7280;
    padding: 0.5rem 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Célula do dia --- */
.calendar-day {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 3.5rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    color: #374151;
    border: 1px solid transparent;
}

.calendar-day:hover {
    background-color: #ecfdf5;
    border-color: #a7f3d0;
}

/* Dia de hoje */
.calendar-day.today {
    background-color: #059669;
    color: #ffffff;
    font-weight: 700;
}

.calendar-day.today:hover {
    background-color: #047857;
}

/* Dia selecionado */
.calendar-day.selected {
    border-color: #059669;
    background-color: #d1fae5;
    color: #047857;
    font-weight: 600;
}

/* Dia fora do mês atual */
.calendar-day.other-month {
    color: #d1d5db;
    pointer-events: none;
}

/* Dia com vencimento (indicador visual) */
.calendar-day.has-event::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 9999px;
    background-color: #f59e0b;
    position: absolute;
    bottom: 0.25rem;
}

.calendar-day.has-event-danger::after {
    background-color: #ef4444;
}

/* Melhor dia para compras */
.calendar-day.best-day {
    background-color: #ecfdf5;
    border: 2px solid #059669;
}

.calendar-day.best-day .day-number {
    color: #059669;
    font-weight: 700;
}


/* ============================================================
   12. SPINNER DE CARREGAMENTO (CSS Only)
   ============================================================ */

/* --- Spinner circular --- */
.spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid #d1fae5;
    border-top-color: #059669;
    border-radius: 9999px;
    animation: spin 0.7s linear infinite;
}

/* Tamanhos do spinner */
.spinner-xs {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
}

.spinner-sm {
    width: 1.25rem;
    height: 1.25rem;
    border-width: 2px;
}

.spinner-md {
    width: 2rem;
    height: 2rem;
    border-width: 3px;
}

.spinner-lg {
    width: 3rem;
    height: 3rem;
    border-width: 4px;
}

.spinner-xl {
    width: 4rem;
    height: 4rem;
    border-width: 5px;
}

/* Spinner em botões */
.btn-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 9999px;
    animation: spin 0.6s linear infinite;
}

/* --- Overlay de carregamento (bloqueia a tela) --- */
.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(2px);
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

/* --- Shimmer skeleton (placeholder de carregamento) --- */
.skeleton {
    background: linear-gradient(
        90deg,
        #f3f4f6 25%,
        #e5e7eb 50%,
        #f3f4f6 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.375rem;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text-sm {
    height: 0.75rem;
    width: 60%;
    margin-bottom: 0.5rem;
}

.skeleton-circle {
    border-radius: 9999px;
}

.skeleton-card {
    height: 120px;
    border-radius: 0.75rem;
}


/* ============================================================
   13. TOOLTIPS
   ============================================================ */

/* --- Container do tooltip --- */
.tooltip {
    position: relative;
    display: inline-flex;
    cursor: help;
}

/* Balão do tooltip */
.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 0.375rem 0.75rem;
    background-color: #1f2937;       /* gray-800 */
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.5rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 60;
    max-width: 16rem;
    text-align: center;
}

/* Seta do tooltip */
.tooltip::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 0.25rem);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1f2937;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 60;
}

/* Visível ao hover */
.tooltip:hover::after,
.tooltip:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.tooltip:hover::before {
    transform: translateX(-50%);
}

/* Tooltip para baixo (bottom) */
.tooltip-bottom::after {
    bottom: auto;
    top: calc(100% + 0.5rem);
    transform: translateX(-50%) translateY(-4px);
}

.tooltip-bottom::before {
    bottom: auto;
    top: calc(100% + 0.25rem);
    border-top-color: transparent;
    border-bottom-color: #1f2937;
}

.tooltip-bottom:hover::after {
    transform: translateX(-50%) translateY(0);
}

/* Tooltip para a esquerda */
.tooltip-left::after {
    bottom: auto;
    left: auto;
    right: calc(100% + 0.5rem);
    top: 50%;
    transform: translateY(-50%) translateX(4px);
}

.tooltip-left::before {
    display: none;
}

.tooltip-left:hover::after {
    transform: translateY(-50%) translateX(0);
}


/* ============================================================
   14. SIDEBAR — TRANSIÇÃO MOBILE
   ============================================================ */

/* Sidebar: oculta por padrão em mobile */
@media (max-width: 1023px) {
    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    #sidebar.sidebar-open {
        transform: translateX(0);
    }

    /* Overlay escuro ao abrir sidebar */
    #sidebar-overlay {
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }

    #sidebar-overlay.overlay-visible {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Sidebar em desktop: sempre visível, sem transição de translate */
@media (min-width: 1024px) {
    #sidebar {
        transform: translateX(0) !important;
        transition: none;
    }

    #sidebar-overlay {
        display: none !important;
    }

    #sidebar-toggle {
        display: none !important;
    }
}

/* Previne rolagem do body quando sidebar está aberta em mobile */
body.sidebar-active {
    overflow: hidden;
}


/* ============================================================
   ESTILOS UTILITÁRIOS ADICIONAIS
   ============================================================ */

/* --- Toast container (canto inferior direito) --- */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 24rem;
}

/* --- Toast individual --- */
.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
    border-left: 4px solid;
    animation: slideInRight 0.35s ease-out;
    min-width: 20rem;
}

.toast-success { border-left-color: #059669; }
.toast-danger  { border-left-color: #ef4444; }
.toast-warning { border-left-color: #f59e0b; }
.toast-info    { border-left-color: #3b82f6; }

.toast.dismissing {
    animation: slideOutRight 0.4s ease-in forwards;
}

/* --- Diálogo de confirmação customizado --- */
.confirm-dialog {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

.confirm-dialog-content {
    background: #ffffff;
    border-radius: 1rem;
    padding: 2rem;
    max-width: 24rem;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: scaleIn 0.25s ease-out;
    text-align: center;
}

/* --- Força da senha --- */
.password-strength {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.password-strength-bar {
    flex: 1;
    height: 4px;
    border-radius: 9999px;
    background-color: #e5e7eb;
    transition: background-color 0.3s ease;
}

.password-strength-bar.strength-weak     { background-color: #ef4444; }
.password-strength-bar.strength-fair     { background-color: #f59e0b; }
.password-strength-bar.strength-good     { background-color: #eab308; }
.password-strength-bar.strength-strong   { background-color: #10b981; }

/* --- Indicador de contagem de caracteres --- */
.char-counter {
    font-size: 0.75rem;
    color: #9ca3af;
    text-align: right;
    margin-top: 0.25rem;
}

.char-counter.near-limit {
    color: #f59e0b;
}

.char-counter.over-limit {
    color: #ef4444;
    font-weight: 600;
}

/* --- Empty state (estado vazio) --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    margin-bottom: 1rem;
    color: #d1d5db;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.empty-state-text {
    font-size: 0.875rem;
    color: #9ca3af;
    max-width: 20rem;
}

/* --- Avatar --- */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    font-weight: 700;
    color: #ffffff;
    flex-shrink: 0;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-xs { width: 1.5rem; height: 1.5rem; font-size: 0.625rem; }
.avatar-sm { width: 2rem; height: 2rem; font-size: 0.75rem; }
.avatar-md { width: 2.5rem; height: 2.5rem; font-size: 0.875rem; }
.avatar-lg { width: 3rem; height: 3rem; font-size: 1rem; }
.avatar-xl { width: 4rem; height: 4rem; font-size: 1.25rem; }

/* --- Divider personalizado --- */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: #9ca3af;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: #e5e7eb;
}

/* --- Truncar texto --- */
.truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Dropdown genérico --- */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 10rem;
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12);
    border: 1px solid #e5e7eb;
    padding: 0.375rem;
    z-index: 30;
    animation: scaleIn 0.15s ease-out;
    transform-origin: top right;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.dropdown-item:hover {
    background-color: #f3f4f6;
}

.dropdown-item-danger {
    color: #dc2626;
}

.dropdown-item-danger:hover {
    background-color: #fef2f2;
}

.dropdown-divider {
    height: 1px;
    background-color: #f3f4f6;
    margin: 0.25rem 0;
}
