/* =====================================================
   ระบบบริหารค่าใช้จ่ายในครัวเรือน - Custom Styles
   ===================================================== */

:root {
    --primary: #2D3436;
    --primary-light: #636E72;
    --accent: #6C63FF;
    --accent-hover: #5A52D5;
    --success: #00B894;
    --warning: #FDCB6E;
    --danger: #E17055;
    --bg: #F8F9FD;
    --card-bg: #FFFFFF;
    --text: #2D3436;
    --text-muted: #636E72;
    --border: #E8ECF1;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Navbar ===== */
.navbar-custom {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 8px rgba(0,0,0,0.04);
    padding: 0.6rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text) !important;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.brand-icon {
    font-size: 1.4rem;
}

.navbar-custom .nav-link {
    color: var(--text-muted) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    font-size: 0.95rem;
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link.active {
    color: var(--accent) !important;
    background: rgba(108,99,255,0.06);
}

.navbar-toggler {
    border: none;
    font-size: 1.4rem;
    color: var(--text);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    background: var(--bg);
}

.avatar-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-outline-logout {
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 50px;
    font-size: 0.85rem;
}

.btn-outline-logout:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
}

/* ===== Cards ===== */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--card-bg);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* ===== Summary Cards (Dashboard) ===== */
.summary-card {
    border: none;
    border-radius: var(--radius);
    padding: 1.5rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.summary-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
}

.summary-card .card-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.summary-card .card-value {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.summary-card .card-label {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-top: 0.2rem;
}

.bg-gradient-purple { background: linear-gradient(135deg, #6C63FF 0%, #8B83FF 100%); }
.bg-gradient-green  { background: linear-gradient(135deg, #00B894 0%, #00D2AA 100%); }
.bg-gradient-orange { background: linear-gradient(135deg, #E17055 0%, #F39C7F 100%); }
.bg-gradient-blue   { background: linear-gradient(135deg, #45B7D1 0%, #6FC8DB 100%); }

/* ===== Tables ===== */
.table {
    font-size: 0.95rem;
}

.table thead th {
    background: var(--bg);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
}

.table tbody tr {
    transition: background 0.15s;
}

.table tbody tr:hover {
    background: rgba(108,99,255,0.03);
}

/* ===== Category Badge ===== */
.cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--bg);
    border: 1px solid var(--border);
}

/* ===== Buttons ===== */
.btn-accent {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    padding: 0.5rem 1.2rem;
    transition: all 0.2s;
}

.btn-accent:hover {
    background: var(--accent-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108,99,255,0.3);
}

.btn-sm {
    border-radius: 6px;
}

/* ===== Forms ===== */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    padding: 0.6rem 0.9rem;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108,99,255,0.12);
}

.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 0.35rem;
}

/* ===== Budget Progress ===== */
.budget-progress {
    height: 10px;
    border-radius: 10px;
    background: var(--bg);
    overflow: hidden;
}

.budget-progress .progress-bar {
    border-radius: 10px;
    transition: width 0.6s ease;
}

.budget-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* ===== Login Page ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    padding: 2.5rem;
    background: #fff;
}

.login-card h2 {
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.3rem;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.login-card .house-icon {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* ===== Charts ===== */
.chart-container {
    position: relative;
    width: 100%;
    padding: 1rem;
}

/* ===== Alerts ===== */
.alert {
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3rem;
    opacity: 0.5;
    margin-bottom: 1rem;
}

/* ===== Footer ===== */
.footer-custom {
    padding: 1rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .summary-card .card-value {
        font-size: 1.3rem;
    }
    .user-name {
        display: none;
    }
    .table {
        font-size: 0.85rem;
    }
}

/* ===== Amount Colors ===== */
.text-expense {
    color: var(--danger);
    font-weight: 600;
}

/* ===== Action Buttons ===== */
.action-btns {
    display: flex;
    gap: 0.3rem;
}

.action-btns .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

/* ===== Page Title ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

/* ===== Filter Bar ===== */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: end;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.filter-bar .form-group {
    flex: 1;
    min-width: 150px;
}

/* ===== Modal ===== */
.modal-content {
    border-radius: var(--radius);
    border: none;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-header {
    border-bottom: 1px solid var(--border);
}

.modal-footer {
    border-top: 1px solid var(--border);
}
