/* ລະບົບຈັດການການຂາຍນ້ຳ - ສະຕາຍຫຼັກ */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #ca8a04;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { font-family: 'Noto Sans Lao', 'Phetsarath OT', 'Saysettha OT', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }

.container { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.card { background: var(--card); border-radius: 0.75rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 1rem; margin-bottom: 1rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.6rem 1.2rem; border: none; border-radius: 0.5rem; font-size: 1rem; cursor: pointer; transition: all 0.2s; text-decoration: none; font-family: inherit; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.875rem; }

.form-group { margin-bottom: 1rem; }
.form-label { display: block; margin-bottom: 0.35rem; font-weight: 600; color: var(--text); }
.form-control { width: 100%; padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: 0.5rem; font-size: 1rem; font-family: inherit; background: #fff; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.8rem center; padding-right: 2rem; }

table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 0.75rem; overflow: hidden; }
th, td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-weight: 700; color: var(--text-light); font-size: 0.875rem; }
tr:hover { background: #f8fafc; }

.navbar { background: var(--primary); color: #fff; padding: 0.75rem 1rem; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.navbar .container { display: flex; align-items: center; justify-content: space-between; max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.navbar-brand { font-size: 1.25rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.navbar-menu { display: flex; gap: 0.5rem; align-items: center; }
.navbar-menu a { color: #fff; text-decoration: none; padding: 0.4rem 0.8rem; border-radius: 0.375rem; font-size: 0.9rem; }
.navbar-menu a:hover, .navbar-menu a.active { background: rgba(255,255,255,0.15); }

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

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .navbar-menu { flex-wrap: wrap; justify-content: center; }
    table { display: block; overflow-x: auto; white-space: nowrap; }
}

.stat-card { background: var(--card); border-radius: 0.75rem; padding: 1.25rem; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--text-light); font-size: 0.875rem; margin-top: 0.25rem; }

.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: #dcfce7; color: var(--success); }
.badge-danger { background: #fee2e2; color: var(--danger); }
.badge-warning { background: #fef9c3; color: var(--warning); }

.toast { position: fixed; bottom: 1rem; right: 1rem; background: var(--text); color: #fff; padding: 0.75rem 1.25rem; border-radius: 0.5rem; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 200; transform: translateY(120%); transition: transform 0.3s; }
.toast.show { transform: translateY(0); }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 150; display: none; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.active { display: flex; }
.modal { background: var(--card); border-radius: 0.75rem; width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 1rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 1rem; }
.modal-footer { padding: 1rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.5rem; }

.search-box { position: relative; }
.search-box input { padding-left: 2.5rem; }
.search-box::before { content: "🔍"; position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); font-size: 0.9rem; }

.img-preview { max-width: 100%; max-height: 200px; border-radius: 0.5rem; object-fit: cover; border: 1px solid var(--border); }

.map-container { width: 100%; height: 300px; background: #e2e8f0; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; color: var(--text-light); }

.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%); }
.login-card { background: var(--card); padding: 2rem; border-radius: 1rem; box-shadow: 0 10px 40px rgba(0,0,0,0.2); width: 100%; max-width: 400px; }
.login-card h1 { text-align: center; margin-bottom: 1.5rem; color: var(--primary); }

.tabs { display: flex; gap: 0.5rem; border-bottom: 2px solid var(--border); margin-bottom: 1rem; }
.tab { padding: 0.6rem 1rem; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; font-weight: 600; color: var(--text-light); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.debt-row { background: #fffbeb; }
.debt-row.overdue { background: #fee2e2; }

.hidden { display: none !important; }

.spinner { width: 1.25rem; height: 1.25rem; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; animation: spin 0.6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
