/* ==========================================================
   Kashoo V2 - Components: buttons, cards, forms, tables, modals, toasts
   ========================================================== */

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 24px; border-radius: var(--radius-pill);
    font-family: inherit; font-weight: 500; font-size: .95rem;
    border: none; cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s;
    text-decoration: none; line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--gradient); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { box-shadow: var(--shadow-lg); color: #fff; }
.btn-secondary { background: var(--lavender); color: #fff; }
.btn-secondary:hover { background: var(--lavender-dark); color: #fff; }
.btn-outline { background: transparent; border: 2px solid var(--mint); color: var(--mint-dark); }
.btn-outline:hover { background: var(--mint-soft); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { opacity: .9; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: .85rem; }
.btn-lg { padding: 15px 32px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); padding: var(--sp-5);
    border: 1px solid var(--border);
}
.card-hover { transition: transform .2s, box-shadow .2s; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.stat-card { display: flex; align-items: center; gap: var(--sp-4); }
.stat-card .stat-icon {
    width: 56px; height: 56px; border-radius: 16px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--gradient-soft); color: var(--lavender-dark);
}
.stat-card .stat-icon .material-symbols-rounded { font-size: 28px; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { color: var(--text-muted); font-size: .85rem; }

.balance-card {
    background: var(--gradient); color: #fff; border-radius: var(--radius-lg);
    padding: var(--sp-6); box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.balance-card::after {
    content: ''; position: absolute; right: -40px; top: -40px;
    width: 160px; height: 160px; background: rgba(255,255,255,.12); border-radius: 50%;
}
.balance-card .label { opacity: .9; font-size: .9rem; }
.balance-card .amount { font-size: 2.6rem; font-weight: 700; margin: 6px 0; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: var(--sp-4); }
.form-group label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: 6px; color: var(--text); }
.input, .form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 13px 16px; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); font-family: inherit; font-size: .95rem;
    background: var(--surface); color: var(--text); transition: border .2s, box-shadow .2s;
}
.input:focus, .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--mint); box-shadow: 0 0 0 4px var(--mint-soft);
}
.input-icon { position: relative; }
.input-icon .material-symbols-rounded { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.input-icon input { padding-left: 46px; }
.form-hint { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .8rem; color: var(--error); margin-top: 4px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; font-weight: 400; font-size: .9rem; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px;
    border-radius: var(--radius-pill); font-size: .78rem; font-weight: 500;
}
.badge-success { background: var(--mint-soft); color: var(--mint-dark); }
.badge-warning { background: #fdf2d9; color: #b7791f; }
.badge-error   { background: #fde8e8; color: #c53030; }
.badge-info    { background: var(--lavender-soft); color: var(--lavender-dark); }
.badge-neutral { background: var(--surface-2); color: var(--text-muted); }

/* ---------- Tables ---------- */
.table-wrap { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 14px 16px; text-align: left; }
table.data thead { background: var(--surface-2); }
table.data th { font-size: .82rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
table.data tbody tr { border-top: 1px solid var(--border); }
table.data tbody tr:hover { background: var(--surface-2); }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(43,45,66,.5); backdrop-filter: blur(3px);
    z-index: 1000; display: none; align-items: center; justify-content: center; padding: var(--sp-4);
}
.modal-backdrop.open { display: flex; }
.modal {
    background: var(--surface); border-radius: var(--radius-lg); padding: var(--sp-6);
    max-width: 480px; width: 100%; box-shadow: var(--shadow-lg); animation: popin .25s;
}
@keyframes popin { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }
.toast {
    display: flex; align-items: center; gap: 10px; background: var(--surface);
    padding: 14px 18px; border-radius: var(--radius); box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--info); min-width: 280px; max-width: 360px;
    animation: slidein .3s; font-size: .9rem;
}
.toast--success { border-left-color: var(--success); }
.toast--success .material-symbols-rounded { color: var(--success); }
.toast--error { border-left-color: var(--error); }
.toast--error .material-symbols-rounded { color: var(--error); }
.toast--warning { border-left-color: var(--warning); }
.toast--warning .material-symbols-rounded { color: var(--warning); }
.toast--info .material-symbols-rounded { color: var(--info); }
@keyframes slidein { from { transform: translateX(120%); } to { transform: translateX(0); } }
@media (max-width: 560px) { .toast-stack { left: 12px; right: 12px; } .toast { min-width: 0; max-width: none; } }

/* ---------- Section headings ---------- */
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); gap: var(--sp-3); flex-wrap: wrap; }
.section-title h2, .section-title h3 { margin: 0; }
.page-head { margin-bottom: var(--sp-5); }
.page-head h1 { font-size: 1.7rem; }
.page-head p { color: var(--text-muted); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: var(--sp-7) var(--sp-4); color: var(--text-muted); }
.empty .material-symbols-rounded { font-size: 56px; color: var(--lavender); }
