/**
 * app.css — Custom Styles
 * Pencatat Keuangan
 *
 * File ini MELENGKAPI Tailwind CSS — bukan menggantikannya.
 * Hanya berisi utility yang tidak tersedia di Tailwind CDN.
 */

/* ─── CSS Custom Properties ───────────────────────────────────────────────── */

:root {
    --brand-primary:   #3B82F6;  /* blue-500 */
    --brand-secondary: #10B981;  /* emerald-500 */
    --brand-danger:    #EF4444;  /* red-500 */
    --brand-warning:   #F59E0B;  /* amber-500 */

    --sidebar-width: 16rem;      /* 256px / w-64 */
    --navbar-height: 4rem;       /* 64px / h-16 */

    --transition-fast:   150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
}

/* ─── Base ────────────────────────────────────────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Scrollbar ───────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* ─── Animations ──────────────────────────────────────────────────────────── */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

.fade-in {
    animation: fadeIn var(--transition-normal) both;
}

.slide-in-right {
    animation: slideInRight var(--transition-normal) both;
}

/* ─── Transaction Type Badges ─────────────────────────────────────────────── */

.badge-income {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #D1FAE5;
    color: #065F46;
}

.badge-expense {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #FEE2E2;
    color: #991B1B;
}

/* ─── Category Color Dots ─────────────────────────────────────────────────── */

.category-dot {
    display: inline-block;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 9999px;
    flex-shrink: 0;
}

/* ─── Amount Display ──────────────────────────────────────────────────────── */

.amount-income {
    color: #059669;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.amount-expense {
    color: #DC2626;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.amount-neutral {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ─── Card Components ─────────────────────────────────────────────────────── */

.card {
    background: white;
    border-radius: 1rem;
    border: 1px solid #E5E7EB;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05);
    padding: 1.5rem;
}

.dark .card {
    background: #0f172a;
    border-color: #334155;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #111827;
}

.dark .card-title {
    color: #f8fafc;
}

/* ─── Stat Cards (Dashboard) ──────────────────────────────────────────────── */

.stat-card {
    background: white;
    border-radius: 1rem;
    border: 1px solid #E5E7EB;
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.dark .stat-card {
    background: #0f172a;
    border-color: #334155;
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    flex-shrink: 0;
}

.stat-label {
    font-size: 0.8125rem;
    color: #6B7280;
    font-weight: 500;
}

.dark .stat-label {
    color: #94a3b8;
}

.stat-value {
    font-size: 1.375rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
}

.dark .stat-value {
    color: #f8fafc;
}

/* ─── Smart Chat Bubbles ──────────────────────────────────────────────────── */

.chat-bubble {
    padding: 0.75rem 1rem;
    border-radius: 1.25rem;
    max-width: 82%;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 0.9375rem;
}

.chat-bubble-user {
    background-color: var(--brand-primary);
    color: white;
    border-bottom-right-radius: 0.25rem;
    margin-left: auto;
}

.chat-bubble-bot {
    background-color: #F3F4F6;
    color: #1F2937;
    border-bottom-left-radius: 0.25rem;
}

.dark .chat-bubble-bot {
    background-color: #1e293b;
    color: #f1f5f9;
}

.chat-bubble-preview {
    background-color: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: 1rem;
    padding: 1rem;
    max-width: 90%;
}

.dark .chat-bubble-preview {
    background-color: #0f172a;
    border-color: #1e3a8a;
}

/* ─── Confidence Indicator ────────────────────────────────────────────────── */

.confidence-bar {
    height: 4px;
    border-radius: 2px;
    background-color: #E5E7EB;
    overflow: hidden;
}

.dark .confidence-bar {
    background-color: #334155;
}

.confidence-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, #F59E0B, #10B981);
    transition: width 500ms ease-out;
}

/* ─── Form Styles ─────────────────────────────────────────────────────────── */

.form-input {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #D1D5DB;
    border-radius: 0.5rem;
    background-color: white;
    color: #111827;
    font-size: 0.9375rem;
    line-height: 1.5;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.dark .form-input {
    background-color: #1e293b;
    border-color: #475569;
    color: #f8fafc;
}

.form-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

.dark .form-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgb(96 165 250 / 0.2);
}

.form-input:disabled {
    background-color: #F9FAFB;
    cursor: not-allowed;
    opacity: 0.7;
}

.dark .form-input:disabled {
    background-color: #0f172a;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.375rem;
}

.dark .form-label {
    color: #cbd5e1;
}

.form-error {
    font-size: 0.8125rem;
    color: #EF4444;
    margin-top: 0.375rem;
}

.form-hint {
    font-size: 0.8125rem;
    color: #9CA3AF;
    margin-top: 0.375rem;
}

.dark .form-hint {
    color: #64748b;
}

/* ─── Spinner ─────────────────────────────────────────────────────────────── */

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 600ms linear infinite;
}

/* ─── Print Styles ────────────────────────────────────────────────────────── */

@media print {
    .no-print,
    aside,
    header,
    nav,
    button {
        display: none !important;
    }

    body {
        background-color: white !important;
        color: black !important;
        font-size: 12pt;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }

    a {
        text-decoration: none;
        color: inherit;
    }

    .amount-income  { color: #065F46 !important; }
    .amount-expense { color: #991B1B !important; }
}

/* ─── Responsive Utilities ────────────────────────────────────────────────── */

/* Touch target minimum size untuk mobile */
@media (pointer: coarse) {
    button, a, [role="button"] {
        min-height: 44px;
        min-width: 44px;
    }
}
