/* ==========================================================================
   HỆ THỐNG QUẢN LÝ TẠM ỨNG ĐO ĐẠC - CHI NHÁNH VPĐKĐĐ NHA TRANG
   Giao diện chuẩn công vụ - Hiện đại - Trực quan
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #0d6efd;
    --primary-dark: #0a58ca;
    --primary-light: #e7f1ff;
    --secondary-color: #495057;
    --success-color: #198754;
    --success-light: #d1e7dd;
    --warning-color: #ffc107;
    --warning-light: #fff3cd;
    --danger-color: #dc3545;
    --danger-light: #f8d7da;
    --info-color: #0dcaf0;
    --teal-color: #20c997;
    
    /* Màu sắc bảng theo hồ sơ */
    --row-normal-bg: #fffde7;       /* Vàng nhạt như file Excel gốc */
    --row-normal-hover: #fff9c4;
    --row-danger-bg: #ffebee;       /* Đỏ nhạt cho hồ sơ hủy / hoàn tiền */
    --row-danger-hover: #ffcdd2;
    --row-done-bg: #f1f8e9;         /* Xanh lá nhạt cho đã nghiệm thu xong */
    
    --sidebar-width: 260px;
    --sidebar-bg: #1e293b;
    --sidebar-color: #e2e8f0;
    --sidebar-active: #3b82f6;
    
    --bg-main: #f8fafc;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: #334155;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Sidebar Layout */
.app-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-color);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    z-index: 1000;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #1e3a8a, #1e293b);
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: #60a5fa;
}

.sidebar-nav {
    padding: 1rem 0.75rem;
    flex-grow: 1;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    padding: 0.75rem 0.75rem 0.25rem;
    font-weight: 600;
}

.sidebar .nav-link {
    color: #cbd5e1;
    padding: 0.65rem 0.85rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    font-size: 0.92rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
}

.sidebar .nav-link i {
    font-size: 1.15rem;
    width: 1.5rem;
    text-align: center;
}

.sidebar .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.08);
}

.sidebar .nav-link.active {
    color: #fff;
    background-color: var(--sidebar-active);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.sidebar-user {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(0, 0, 0, 0.15);
}

.user-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.25rem;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.top-navbar {
    background-color: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

.content-body {
    padding: 1.5rem;
    flex-grow: 1;
}

/* Stat Cards */
.stat-card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
    border: 1px solid #f1f5f9;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0.25rem 0;
    color: #0f172a;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

/* Custom Table Styles matching Land Office Sheet */
.table-custom-container {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: var(--card-shadow);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.table-custom {
    margin-bottom: 0;
    font-size: 0.88rem;
    vertical-align: middle;
}

.table-custom thead th {
    background: #0f172a;
    color: #f8fafc;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-color: #334155;
    padding: 0.75rem 0.6rem;
    text-align: center;
    vertical-align: middle;
}

.table-custom td {
    padding: 0.65rem 0.6rem;
    border-bottom: 1px solid #e2e8f0;
}

/* Highlighting rows according to PDF style & User requests */
.tr-green {
    background-color: #e8f5e9 !important; /* Xanh lá nhạt - đã hoàn thành nghiệm thu */
    color: #14532d;
}
.tr-green:hover {
    background-color: #c8e6c9 !important;
}

.tr-yellow {
    background-color: #fff9c4 !important; /* Vàng - đang đo đạc / đang xử lý */
    color: #713f12;
}
.tr-yellow:hover {
    background-color: #fff59d !important;
}

.tr-red {
    background-color: #fee2e2 !important; /* Đỏ - hợp đồng hủy & hoàn trả tiền */
    color: #991b1b;
}
.tr-red:hover {
    background-color: #fecaca !important;
}

.tr-refund {
    background-color: #ffedd5 !important; /* Cam - trả lại tiền nộp dư */
    color: #9a3412;
}
.tr-refund:hover {
    background-color: #fed7aa !important;
}

/* Tên chủ sử dụng đất bôi màu theo trạng thái */
.name-green {
    color: #15803d !important;
    font-weight: 700;
}
.name-yellow {
    color: #854d0e !important;
    font-weight: 700;
}
.name-red {
    color: #b91c1c !important;
    font-weight: 700;
    text-decoration: line-through;
}
.name-refund {
    color: #c2410c !important;
    font-weight: 700;
}

/* Badges & Pills */
.badge-tm {
    background-color: #e0e7ff;
    color: #3730a3;
    font-weight: 600;
    padding: 0.35rem 0.6rem;
}

.badge-ck {
    background-color: #dbeafe;
    color: #1e40af;
    font-weight: 600;
    padding: 0.35rem 0.6rem;
}

.money-positive {
    color: #15803d;
    font-weight: 600;
}

.money-negative {
    color: #b91c1c;
    font-weight: 700;
}

/* Quick Filter Pills */
.filter-pill {
    cursor: pointer;
    padding: 0.4rem 0.85rem;
    border-radius: 2rem;
    font-size: 0.84rem;
    font-weight: 500;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #475569;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-pill:hover, .filter-pill.active {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Print Stylesheet for Official Receipts */
@media print {
    body {
        background: #fff !important;
        color: #000 !important;
    }
    .sidebar, .top-navbar, .no-print, .btn, .breadcrumb {
        display: none !important;
    }
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    .content-body {
        padding: 0 !important;
    }
    .receipt-box {
        border: 1px solid #000 !important;
        box-shadow: none !important;
        padding: 2cm !important;
        page-break-inside: avoid;
    }
}
