/* ═══════════════════════════════════════════════════════════════
   Finança — Custom Styles
   Design: Dark glassmorphism, premium gradients, micro-animations
   ═══════════════════════════════════════════════════════════════ */

/* ─── Glass Effects ──────────────────────────────────────────── */
.glass-card {
    background: rgba(15, 22, 41, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.glass-card-solid {
    background: rgba(22, 29, 53, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
    background: rgba(22, 29, 53, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.08);
    transform: translateY(-1px);
}

.card-glow {
    position: relative;
}

.card-glow::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.5), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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


/* ─── Form Elements ──────────────────────────────────────────── */
.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: rgba(10, 14, 26, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.625rem;
    color: white;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    outline: none;
}

.form-input:focus {
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input::placeholder {
    color: rgba(107, 114, 128, 0.8);
}

.form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: rgba(10, 14, 26, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.625rem;
    color: white;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.form-select:focus {
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-select option {
    background: #161d35;
    color: white;
}

.form-input-color {
    width: 3rem;
    height: 2.5rem;
    padding: 0.25rem;
    background: rgba(10, 14, 26, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    cursor: pointer;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(156, 163, 175, 1);
    margin-bottom: 0.375rem;
}

.form-error {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.625rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    outline: none;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: rgba(156, 163, 175, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 0.5rem;
}

/* ─── Status Badges ──────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-paid {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge-pending {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.badge-income {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.badge-expense {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* ─── Tag Pills ──────────────────────────────────────────────── */
.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 500;
}

/* ─── Progress Bar ───────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Animations ─────────────────────────────────────────────── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(99, 102, 241, 0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.4s ease-out;
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* New row highlight (for HTMX inserts) */
.new-row {
    animation: fadeInUp 0.5s ease-out;
    background: rgba(99, 102, 241, 0.05) !important;
}

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(10, 14, 26, 0.5);
}

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

/* ─── Checkbox Overrides (for tags) ──────────────────────────── */
.tag-checkbox input[type="checkbox"] {
    display: none;
}

.tag-checkbox label {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.tag-checkbox input[type="checkbox"]:checked + label {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.5);
    color: #818cf8;
}

.tag-checkbox label:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

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

.data-table th {
    padding: 0.75rem 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(156, 163, 175, 0.7);
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.data-table td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.15s ease;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* ─── Utilities ──────────────────────────────────────────────── */
.text-income {
    color: #4ade80;
}

.text-expense {
    color: #f87171;
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    margin: 1.5rem 0;
}

/* Stat card with gradient border */
.stat-card {
    position: relative;
    padding: 1.5rem;
    border-radius: 1rem;
    background: rgba(22, 29, 53, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stat-color, linear-gradient(90deg, #6366f1, #8b5cf6));
    border-radius: 0 0 1rem 1rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: rgba(107, 114, 128, 0.8);
}

.empty-state svg {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 1rem;
    opacity: 0.3;
}

/* ─── Quick Date Picker ──────────────────────────────────────── */
.date-picker-wrap {
    position: relative;
}

.date-picker-wrap .form-input {
    padding-right: 2.5rem;
}

.date-picker-toggle {
    position: absolute;
    right: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(156, 163, 175, 1);
    transition: color 0.2s ease;
}

.date-picker-toggle:hover {
    color: rgba(129, 140, 248, 1);
}

.date-picker-panel {
    position: absolute;
    z-index: 40;
    top: calc(100% + 0.5rem);
    left: 0;
    width: 100%;
    min-width: 17rem;
    background: rgba(15, 22, 41, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    box-shadow: 0 14px 35px rgba(4, 8, 19, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 0.75rem;
}

.date-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.625rem;
}

.date-picker-header button {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 0.5rem;
    color: rgba(156, 163, 175, 1);
    transition: all 0.2s ease;
}

.date-picker-header button:hover {
    color: rgba(129, 140, 248, 1);
    background: rgba(255, 255, 255, 0.08);
}

.date-picker-header span {
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

.date-picker-weekdays,
.date-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
}

.date-picker-weekdays span {
    color: rgba(107, 114, 128, 1);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.04em;
    padding: 0.2rem 0;
}

.date-picker-day {
    height: 2rem;
    border-radius: 0.5rem;
    color: rgba(229, 231, 235, 1);
    font-size: 0.8rem;
    transition: all 0.15s ease;
}

.date-picker-day:hover {
    background: rgba(99, 102, 241, 0.18);
    color: white;
}

.date-picker-day.is-today {
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.8);
}

.date-picker-day.is-selected {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: white;
    box-shadow: 0 6px 14px rgba(99, 102, 241, 0.35);
}

.date-picker-day.is-outside {
    color: rgba(107, 114, 128, 0.7);
    opacity: 0.5;
    cursor: default;
}

@media (max-width: 640px) {
    .date-picker-panel {
        min-width: 15.5rem;
    }
}

/* Keep quick-entry date picker visible outside glow card bounds */
.quick-entry-card {
    overflow: visible;
}

/* Dynamic display of empty states when container has items */
#cards-list:has(> :not(.empty-state)) > .empty-state {
    display: none !important;
}

/* Seleção de Abas de Metas */
#goals-grid.tab-active-selected .is-archived-goal { display: none !important; }
#goals-grid.tab-archived-selected .is-active-goal { display: none !important; }

/* Exibição condicional do empty state de metas com :has */
#goals-grid.tab-active-selected:has(.goal-card.is-active-goal) .empty-state-active { display: none !important; }
#goals-grid.tab-archived-selected:has(.goal-card.is-archived-goal) .empty-state-archived { display: none !important; }

/* Seleção de Abas de Regras Recorrentes */
#recurring-list.tab-active-selected .is-archived-rule { display: none !important; }
#recurring-list.tab-archived-selected .is-active-rule { display: none !important; }

/* Exibição condicional do empty state de regras recorrentes com :has */
#recurring-list.tab-active-selected:has(.recurring-row.is-active-rule) .empty-state-active { display: none !important; }
#recurring-list.tab-archived-selected:has(.recurring-row.is-archived-rule) .empty-state-archived { display: none !important; }

