/* ================================================================
   Rubber Plantation Group Accounting System — Custom Styles
   ================================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --sidebar-width: 260px;
    --sidebar-bg: #ffffff;
    --sidebar-border: #dee2e6;
    --navbar-height: 56px;
    --green-primary: #198754;
    --green-dark: #155c3e;
    --section-label-color: #6c757d;
}

/* ── Base ───────────────────────────────────────────────────── */
body {
    font-family: 'Noto Sans Thai', 'Segoe UI', sans-serif;
    font-size: 0.95rem;
    background-color: #f4f6f9;
    color: #343a40;
}

/* ── Wrapper layout ─────────────────────────────────────────── */
#wrapper {
    min-height: calc(100vh - var(--navbar-height));
    margin-top: var(--navbar-height);
    position: relative;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    position: sticky;
    top: var(--navbar-height);
    overflow-y: auto;
    transition: width 0.25s ease, min-width 0.25s ease;
    z-index: 100;
    flex-shrink: 0;
}

/* Collapsed sidebar (mobile) */
#sidebar.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
}

.sidebar-sticky {
    padding-bottom: 2rem;
}

.sidebar-section-label {
    font-size: 0.70rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--section-label-color);
    padding: 0.75rem 1.25rem 0.25rem;
}

#sidebar .nav-link {
    color: #495057;
    padding: 0.55rem 1.25rem;
    border-radius: 0.375rem;
    margin: 0.1rem 0.5rem;
    transition: background-color 0.15s, color 0.15s;
    font-size: 0.9rem;
}

#sidebar .nav-link:hover {
    background-color: #e8f5e9;
    color: var(--green-primary);
}

#sidebar .nav-link.active {
    background-color: var(--green-primary);
    color: #ffffff !important;
    font-weight: 600;
}

/* ── Main content ────────────────────────────────────────────── */
#content {
    min-width: 0; /* prevent flex blowout */
}

.content-wrapper {
    max-width: 1400px;
}

/* ── Page title bar ──────────────────────────────────────────── */
.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0;
}

.page-subtitle {
    font-size: 0.85rem;
    color: #6c757d;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
}

/* ── Stat cards (dashboard) ──────────────────────────────────── */
.stat-card {
    border-radius: 0.75rem;
    border: none;
    color: #fff;
    transition: transform 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* ── Tables ──────────────────────────────────────────────────── */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    background-color: #f8f9fa;
    border-color: #dee2e6;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
    font-size: 0.9rem;
}

.table-hover tbody tr:hover {
    background-color: #f0faf3;
}

/* ── Badges / Status ─────────────────────────────────────────── */
.badge-open   { background-color: #0dcaf0; color: #000; }
.badge-closed { background-color: #6c757d; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-label {
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--green-primary);
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.2);
}

/* ── Navbar ──────────────────────────────────────────────────── */
#topNavbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1030;
    height: var(--navbar-height);
}

/* ── Money amounts ───────────────────────────────────────────── */
.amount-positive { color: #198754; font-weight: 600; }
.amount-negative { color: #dc3545; font-weight: 600; }
.amount-neutral  { color: #6c757d; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    #sidebar {
        position: fixed;
        top: var(--navbar-height);
        left: 0;
        height: calc(100vh - var(--navbar-height));
        z-index: 1020;
        box-shadow: 4px 0 12px rgba(0,0,0,.15);
    }

    #sidebar:not(.collapsed) {
        width: var(--sidebar-width);
    }
}

/* ── Report stat cards (reports.php) ────────────────────────── */
.rpt-card {
    position: relative;
    overflow: hidden;
    border-radius: 1rem;
    padding: 1.3rem 1.4rem 1.1rem;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,.13);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    height: 100%;
    min-height: 110px;
}

.rpt-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0,0,0,.18);
}

/* giant watermark icon, bottom-right */
.rpt-card__bg-icon {
    position: absolute;
    right: -0.75rem;
    bottom: -0.75rem;
    font-size: 6rem;
    line-height: 1;
    opacity: 0.13;
    pointer-events: none;
}

.rpt-card__value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.rpt-card__label {
    font-size: 0.83rem;
    font-weight: 600;
    opacity: 0.92;
    margin-top: 0.25rem;
}

.rpt-card__sub {
    font-size: 0.73rem;
    opacity: 0.72;
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* colour variants */
.rpt-card--green  { background: linear-gradient(135deg, #198754 0%, #20c997 100%); }
.rpt-card--blue   { background: linear-gradient(135deg, #0d6efd 0%, #4dabff 100%); }
.rpt-card--teal   { background: linear-gradient(135deg, #0a9ab9 0%, #0dcaf0 100%); }
.rpt-card--amber  { background: linear-gradient(135deg, #c86800 0%, #fd7e14 100%); }
.rpt-card--indigo { background: linear-gradient(135deg, #6610f2 0%, #9a5cf6 100%); }
.rpt-card--red    { background: linear-gradient(135deg, #b02a37 0%, #dc3545 100%); }
.rpt-card--dark-green {
    background: linear-gradient(135deg, #0a3d22 0%, #198754 100%);
    box-shadow: 0 6px 22px rgba(25,135,84,.38);
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
    #topNavbar, #sidebar, .no-print { display: none !important; }
    #content { margin: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
    .rpt-card { border: 1px solid #dee2e6 !important; box-shadow: none !important; break-inside: avoid; }
}
