/* ==========================================================================
   HỆ THỐNG QUẢN TRỊ DỮ LIỆU DU LỊCH THÔNG MINH TỈNH QUẢNG NINH (CMS)
   Gov-Tech Style System | Professional State Management UI
   ========================================================================== */

:root {
    --cms-navy: #001E4D;
    --cms-blue: #0284C7;
    --cms-blue-dark: #0369A1;
    --cms-blue-light: #F0F9FF;
    --cms-accent: #0EA5E9;
    --cms-accent-dark: #0284C7;
    --cms-emerald: #10B981;
    --cms-danger: #EF4444;
    --cms-warning: #F59E0B;
    
    --cms-bg: #F8FAFC;
    --cms-card: #FFFFFF;
    --cms-text: #0F172A;
    --cms-text-sub: #475569;
    --cms-text-muted: #94A3B8;
    --cms-border: #E2E8F0;
    
    --cms-sidebar-width: 260px;
    --cms-header-height: 70px;
    --cms-radius: 12px;
    --cms-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Be Vietnam Pro', 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--cms-bg);
    color: var(--cms-text);
    line-height: 1.5;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }

/* LAYOUT */
.cms-wrapper {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.cms-sidebar {
    width: var(--cms-sidebar-width);
    background: var(--cms-navy);
    color: white;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.cms-sidebar-brand {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.cms-brand-title {
    font-weight: 800;
    font-size: 1.05rem;
    color: white;
    line-height: 1.2;
}

.cms-brand-subtitle {
    font-size: 0.75rem;
    color: #38BDF8;
    font-weight: 600;
}

.cms-menu-group {
    padding: 15px 0;
    flex: 1;
    overflow-y: auto;
}

.cms-menu-title {
    padding: 10px 20px 5px 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #94A3B8;
}

.cms-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #CBD5E1;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.cms-nav-item:hover, .cms-nav-item.active {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left: 4px solid var(--cms-accent);
}

.cms-nav-item.active {
    font-weight: 700;
}

.cms-nav-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* HEADER */
.cms-header {
    height: var(--cms-header-height);
    background: white;
    border-bottom: 1px solid var(--cms-border);
    position: fixed;
    top: 0;
    right: 0;
    left: var(--cms-sidebar-width);
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.cms-header-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--cms-navy);
}

.cms-role-switcher {
    display: flex;
    align-items: center;
    gap: 15px;
}

.role-badge-current {
    background: var(--cms-blue-light);
    color: var(--cms-blue);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 700;
    border: 1px solid rgba(0,71,171,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-select-dropdown {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--cms-border);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cms-navy);
    background: white;
    cursor: pointer;
}

/* MAIN CONTENT */
.cms-main {
    margin-left: var(--cms-sidebar-width);
    margin-top: var(--cms-header-height);
    padding: 30px;
    flex: 1;
}

/* STAT CARDS */
.cms-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.cms-stat-card {
    background: white;
    border-radius: var(--cms-radius);
    padding: 20px;
    box-shadow: var(--cms-shadow);
    border: 1px solid var(--cms-border);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon-wrapper {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-icon-wrapper.blue { background: #EFF6FF; color: var(--cms-blue); }
.stat-icon-wrapper.green { background: #ECFDF5; color: var(--cms-emerald); }
.stat-icon-wrapper.yellow { background: #FEF3C7; color: var(--cms-warning); }
.stat-icon-wrapper.red { background: #FEF2F2; color: var(--cms-danger); }

.stat-val { font-size: 1.6rem; font-weight: 800; color: var(--cms-text); }
.stat-lbl { font-size: 0.82rem; color: var(--cms-text-sub); }

/* TABLES */
.cms-card {
    background: white;
    border-radius: var(--cms-radius);
    padding: 24px;
    box-shadow: var(--cms-shadow);
    border: 1px solid var(--cms-border);
    margin-bottom: 30px;
}

.cms-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--cms-border);
    padding-bottom: 15px;
}

.cms-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--cms-navy);
    display: flex;
    align-items: center;
    gap: 10px;
}

.cms-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.cms-table th {
    background: #F8FAFC;
    color: var(--cms-text-sub);
    font-weight: 700;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 2px solid var(--cms-border);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.cms-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--cms-border);
    color: var(--cms-text);
}

.cms-table tbody tr:hover {
    background: #F1F5F9;
}

/* BADGES */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 0.78rem;
    font-weight: 700;
}

.status-badge.approved { background: #DCFCE7; color: #15803D; }
.status-badge.pending { background: #FEF3C7; color: #B45309; }
.status-badge.supplement { background: #E0F2FE; color: #0369A1; }
.status-badge.error { background: #FEE2E2; color: #B91C1C; }
.status-badge.draft { background: #F1F5F9; color: #475569; }

/* DEMO SCRIPT FLOATING TOOLBAR */
.demo-flow-bar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--cms-navy);
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid var(--cms-accent);
}

.demo-flow-btn {
    background: var(--cms-blue);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.demo-flow-btn:hover {
    background: var(--cms-accent);
    color: white;
}

/* Pagination styles */
.cms-pagination { display:flex; align-items:center; justify-content:space-between; padding:15px 0; border-top:1px solid var(--cms-border); margin-top:15px; }
.cms-pagination .page-info { font-size:0.85rem; color:var(--cms-text-sub); font-weight:600; }
.cms-pagination .page-btns { display:flex; gap:4px; }
.page-btn { padding:6px 12px; border:1px solid var(--cms-border); background:white; border-radius:6px; font-size:0.82rem; font-weight:600; color:var(--cms-text-sub); cursor:pointer; transition:all 0.2s; }
.page-btn:hover:not(:disabled) { background:var(--cms-blue-light); color:var(--cms-blue); border-color:var(--cms-blue); }
.page-btn.active { background:var(--cms-blue); color:white; border-color:var(--cms-blue); }
.page-btn:disabled { opacity:0.4; cursor:not-allowed; }

/* Login page styles */
.login-container { min-height:100vh; background:linear-gradient(135deg, #001E4D 0%, #0047AB 50%, #001E4D 100%); display:flex; align-items:center; justify-content:center; padding:20px; }
.login-card { background:white; border-radius:24px; width:100%; max-width:1100px; overflow:hidden; display:grid; grid-template-columns:1fr 1.4fr; box-shadow:0 25px 60px rgba(0,0,0,0.35); }
@media(max-width:900px){.login-card{grid-template-columns:1fr;}}
.login-branding { background:linear-gradient(160deg, #001E4D 0%, #0039A6 100%); color:white; padding:50px 40px; display:flex; flex-direction:column; justify-content:space-between; position:relative; overflow:hidden; }
.login-branding::before { content:''; position:absolute; top:-50%; right:-50%; width:100%; height:100%; background:radial-gradient(circle, rgba(14,165,233,0.12) 0%, transparent 70%); }
.login-form-side { padding:40px; overflow-y:auto; max-height:100vh; }
.account-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; max-height:420px; overflow-y:auto; padding-right:8px; margin:15px 0; }
.account-grid::-webkit-scrollbar { width:6px; }
.account-grid::-webkit-scrollbar-thumb { background:#CBD5E1; border-radius:3px; }
.account-card { display:flex; align-items:center; gap:10px; padding:10px 12px; border:2px solid #E2E8F0; border-radius:10px; cursor:pointer; transition:all 0.2s; background:white; }
.account-card:hover { border-color:#0047AB; background:#F0F5FF; transform:translateY(-1px); }
.account-card.selected { border-color:#0047AB; background:#F0F5FF; box-shadow:0 0 0 3px rgba(0,71,171,0.15); }
.account-avatar { width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:0.75rem; color:white; flex-shrink:0; }
.account-name { font-weight:700; font-size:0.82rem; color:#0F172A; line-height:1.2; }
.account-role { font-size:0.72rem; color:#64748B; }
.role-group-title { font-size:0.72rem; font-weight:700; text-transform:uppercase; letter-spacing:0.8px; color:#94A3B8; padding:10px 0 5px; grid-column:1/-1; border-top:1px solid #F1F5F9; }
.role-group-title:first-child { border-top:none; }
.login-fields { margin-top:15px; }
.login-field { margin-bottom:12px; }
.login-field label { display:block; font-size:0.78rem; font-weight:700; color:#334155; margin-bottom:4px; }
.login-field input { width:100%; padding:10px 14px; border:1px solid #CBD5E1; border-radius:8px; font-size:0.9rem; transition:border-color 0.2s; }
.login-field input:focus { outline:none; border-color:#0047AB; box-shadow:0 0 0 3px rgba(0,71,171,0.1); }
.login-submit { width:100%; padding:14px; background:linear-gradient(135deg, #0047AB 0%, #0039A6 100%); color:white; border:none; border-radius:10px; font-weight:700; font-size:1rem; cursor:pointer; transition:all 0.2s; display:flex; align-items:center; justify-content:center; gap:8px; }
.login-submit:hover { background:linear-gradient(135deg, #0039A6 0%, #002B7F 100%); transform:translateY(-1px); box-shadow:0 4px 15px rgba(0,71,171,0.3); }

/* Table enhancements */
.cms-table tbody tr:nth-child(even) { background:#FAFBFC; }
.cms-table tbody tr { transition:background 0.15s; }
.cms-search-bar { display:flex; gap:10px; margin-bottom:15px; align-items:center; }
.cms-search-bar input { flex:1; padding:8px 14px; border:1px solid var(--cms-border); border-radius:8px; font-size:0.85rem; }
.cms-search-bar select { padding:8px 12px; border:1px solid var(--cms-border); border-radius:8px; font-size:0.85rem; }

/* User header display */
.user-info-header { display:flex; align-items:center; gap:10px; }
.user-info-header .user-avatar-sm { width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:0.7rem; color:white; background:var(--cms-blue); }
.user-info-header .user-name-sm { font-size:0.82rem; font-weight:700; color:var(--cms-navy); }
