/*
Theme Name: Sistem Banjar Adat Digital
Theme URI: https://example.com/banjar-digital
Author: Your Name
Author URI: https://example.com
Description: Digital system for traditional Balinese community (Banjar) financial management with role-based access for Bendahara, Kelian Adat, and Kelian Regu.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: banjar-digital
Tags: community, financial, management, custom-application
*/

:root {
    --primary: #f97316;
    --primary-dark: #c2410c;
    --secondary: #1e293b;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #334155;
    --danger: #ef4444;
    --success: #22c55e;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    padding-bottom: 80px;
}

/* HEADER */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.brand {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.role-selector {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    font-size: 0.9rem;
    cursor: pointer;
}

/* LAYOUT */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

@media (max-width: 600px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* CARDS & PANELS */
.card {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.stat-card {
    padding: 1.5rem;
    color: white;
    border-radius: 12px;
    margin-bottom: 1rem;
    text-align: center;
}

.stat-income {
    background: linear-gradient(135deg, var(--success), #15803d);
}

.stat-debt {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
}

.stat-cash {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    margin-top: 0.5rem;
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* FORMS */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--secondary);
}

input, select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    ring: 2px solid var(--primary);
}

button {
    cursor: pointer;
    border: none;
    font-weight: 600;
    border-radius: 8px;
    transition: 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
    padding: 0.5rem 1rem;
}

.btn-danger {
    background: var(--danger);
    color: white;
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
    white-space: nowrap;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    background: var(--secondary);
    color: white;
}

/* LISTS */
.member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.member-item:last-child {
    border-bottom: none;
}

.member-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    background: #eee;
}

.text-sm {
    font-size: 0.85rem;
    color: #64748b;
}

.badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 99px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-active {
    background: #dbeafe;
    color: #1e40af;
}

.badge-passive {
    background: #f1f5f9;
    color: #475569;
}

/* TABLE */
.transaction-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.transaction-table th {
    text-align: left;
    padding: 0.75rem;
    background: #f1f5f9;
    color: var(--secondary);
}

.transaction-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.amount-pos {
    color: var(--success);
    font-weight: 600;
}

.amount-neg {
    color: var(--danger);
    font-weight: 600;
}

/* MEMBER LIST TABLE (ADMIN) */
.member-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.85rem;
}

.member-table th {
    text-align: left;
    padding: 0.5rem;
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
}

.member-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.member-photo-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

/* SEARCH DROPDOWN */
.search-dropdown {
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--border);
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 100;
    margin-top: -10px;
}

.search-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-item:hover {
    background-color: #f8fafc;
}

.search-item img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

/* TOAST */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--secondary);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* UTILS */
.hidden {
    display: none;
}

.text-center {
    text-align: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mt-4 {
    margin-top: 1rem;
}

/* INTERACTION */
.clickable-area {
    cursor: pointer;
    transition: 0.2s;
}

.clickable-area:hover .avatar {
    border-color: var(--primary);
}

.clickable-area:hover .member-name-text {
    color: var(--primary);
    text-decoration: underline;
}

/* INPUT GROUPS */
.action-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.input-row {
    display: flex;
    width: 100%;
    gap: 5px;
}

.mini-input {
    padding: 0.5rem !important;
    font-size: 0.9rem;
    border: 1px solid var(--border) !important;
    border-radius: 6px !important;
}

.mini-note {
    width: 100% !important;
    font-size: 0.8rem !important;
    padding: 0.4rem 0.6rem !important;
}

.mini-amount {
    width: 80px !important;
    text-align: right;
}

/* FILTER BAR & PAGINATION */
.filter-bar {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 1rem;
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 8px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.page-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 5px 15px;
    border-radius: 6px;
}

/* BILL BREAKDOWN */
.bill-breakdown {
    background: #fef3c7;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-top: 0.75rem;
    border-left: 4px solid #f59e0b;
}

.bill-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #fde68a;
}

.bill-item:last-child {
    border-bottom: none;
}

.bill-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bill-date {
    font-size: 0.7rem;
    color: #92400e;
}
