/* ============================================================
   RealConnect — Global Stylesheet
   Font: Inter (headings) + Be Vietnam Pro (body)
   Theme: Dark glass / indigo-emerald accent
   ============================================================ */

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

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

:root {
    --bg:         #080c16;
    --bg2:        #0d1120;
    --card:       rgba(255,255,255,0.04);
    --glass:      rgba(255,255,255,0.06);
    --border:     rgba(255,255,255,0.10);
    --border2:    rgba(255,255,255,0.06);

    --accent:     #6366f1;          /* indigo */
    --accent2:    #10b981;          /* emerald */
    --accent3:    #f59e0b;          /* amber */
    --glow:       rgba(99,102,241,0.30);
    --glow2:      rgba(16,185,129,0.20);

    --text:       #e8eaf6;
    --text2:      #9496b0;
    --text3:      #5c5e78;

    --danger:     #f43f5e;
    --success:    #10b981;
    --warn:       #f59e0b;

    --radius:     14px;
    --radius-sm:  8px;
    --radius-lg:  20px;

    --shadow:     0 20px 60px rgba(0,0,0,0.5);
    --shadow-sm:  0 4px 20px rgba(0,0,0,0.3);

    --nav-bg:     rgba(8,12,22,0.90);
    --orb1:       rgba(99,102,241,0.18);
    --orb2:       rgba(16,185,129,0.12);
    --grid-color: rgba(99,102,241,0.05);
    --scrollbar:  rgba(99,102,241,0.35);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Be Vietnam Pro', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   BACKGROUND DECORATORS
   ============================================================ */
.bg-noise {
    position: fixed; inset: 0; z-index: -2; pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
    opacity: 0.4;
}
.bg-grid {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image:
        linear-gradient(var(--grid-color, rgba(99,102,241,0.05)) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color, rgba(99,102,241,0.05)) 1px, transparent 1px);
    background-size: 64px 64px;
}
.bg-orb {
    position: fixed; border-radius: 50%; filter: blur(90px); pointer-events: none; z-index: -1;
    animation: orbFloat 14s ease-in-out infinite;
}
.orb1 { width: 600px; height: 600px; top: -20%; left: -15%;
    background: radial-gradient(circle, rgba(99,102,241,0.18), transparent 70%); }
.orb2 { width: 400px; height: 400px; bottom: -10%; right: -10%; animation-delay: -7s; animation-duration: 18s;
    background: radial-gradient(circle, rgba(16,185,129,0.12), transparent 70%); }
.orb3 { width: 300px; height: 300px; top: 50%; left: 55%; animation-delay: -3s; animation-duration: 20s;
    background: radial-gradient(circle, rgba(245,158,11,0.08), transparent 70%); }
@keyframes orbFloat {
    0%,100% { transform: translate(0,0) scale(1); }
    33%      { transform: translate(25px,-15px) scale(1.04); }
    66%      { transform: translate(-18px,12px) scale(0.97); }
}

/* ============================================================
   TOPNAV
   ============================================================ */
.topnav {
    position: sticky; top: 0; z-index: 100;
    background: var(--nav-bg, rgba(8,12,22,0.90));
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border2);
    padding: 0 24px;
    display: flex; align-items: center; height: 60px; gap: 24px;
}
.nav-logo {
    display: flex; align-items: center; gap: 10px; text-decoration: none;
    flex-shrink: 0;
}
.nav-logo-icon {
    width: 34px; height: 34px; border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; box-shadow: 0 4px 15px var(--glow);
}
.nav-logo-text { font-family: 'Inter', 'Segoe UI', Arial, sans-serif; font-size: 17px; font-weight: 700; color: var(--text); }
.nav-logo-text span { color: var(--accent2); }

.nav-links { display: flex; align-items: center; gap: 2px; flex: 1; flex-wrap: nowrap; }
.nav-link {
    padding: 6px 10px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; color: var(--text2);
    text-decoration: none; transition: all 0.2s;
    white-space: nowrap;
}
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--glass); }
.nav-link.active { color: var(--accent); }

.nav-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 18px;
    border-radius: var(--radius-sm); font-family: inherit; font-size: 14px; font-weight: 600;
    text-decoration: none; cursor: pointer; border: none; transition: all 0.25s; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #8b5cf6); color: white;
    box-shadow: 0 4px 20px var(--glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px var(--glow); }
.btn-ghost { background: var(--glass); color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.08); }
.btn-success { background: linear-gradient(135deg, var(--accent2), #059669); color: white; }
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 8px 20px var(--glow2); }
.btn-danger { background: rgba(244,63,94,0.15); color: var(--danger); border: 1px solid rgba(244,63,94,0.25); }
.btn-danger:hover { background: rgba(244,63,94,0.25); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 15px; border-radius: var(--radius); }

.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: white; flex-shrink: 0;
}
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }

.user-chip {
    display: flex; align-items: center; gap: 9px;
    padding: 4px 12px 4px 4px;
    background: var(--glass); border: 1px solid var(--border);
    border-radius: 40px; cursor: pointer; text-decoration: none;
    font-size: 13px; font-weight: 500; color: var(--text2);
    transition: all 0.2s;
}
.user-chip:hover { color: var(--text); background: rgba(255,255,255,0.08); }

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
.page-wrap {
    max-width: 1200px; margin: 0 auto; padding: 32px 20px;
}
.page-wrap-sm { max-width: 720px; margin: 0 auto; padding: 40px 20px; }

.two-col { display: grid; grid-template-columns: 1fr 320px; gap: 28px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ============================================================
   CARD / GLASS
   ============================================================ */
.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px;
    transition: border-color 0.2s;
}
.card:hover { border-color: rgba(255,255,255,0.16); }
.card-header { display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border2); }
.card-title { font-family: 'Inter', 'Segoe UI', Arial, sans-serif; font-size: 16px; font-weight: 700; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.field { margin-bottom: 20px; }
.field-label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.8px; color: var(--text2); margin-bottom: 8px; }
.field-wrap {
    position: relative;
    background: var(--glass); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); transition: all 0.25s;
}
.field-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
    background: rgba(99,102,241,0.05);
}
.field-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    font-size: 15px; color: var(--text3); pointer-events: none; transition: color 0.2s; }
.field-wrap:focus-within .field-icon { color: var(--accent); }
.field-input {
    width: 100%; padding: 12px 14px 12px 40px;
    background: transparent; border: none; outline: none;
    font-family: inherit; font-size: 15px; color: var(--text);
}
.field-input::placeholder { color: rgba(148,150,176,0.5); }
.field-input.no-icon { padding-left: 14px; }
textarea.field-input { padding: 14px; resize: vertical; min-height: 120px; }
select.field-input { cursor: pointer; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 14px;
    display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.alert-error { background: rgba(244,63,94,0.10); border: 1px solid rgba(244,63,94,0.25); color: var(--danger); }
.alert-success { background: rgba(16,185,129,0.10); border: 1px solid rgba(16,185,129,0.25); color: var(--success); }
.alert-warn { background: rgba(245,158,11,0.10); border: 1px solid rgba(245,158,11,0.25); color: var(--warn); }

/* ============================================================
   BADGES & TAGS
   ============================================================ */
.badge { display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-accent { background: rgba(99,102,241,0.15); color: var(--accent); border: 1px solid rgba(99,102,241,0.25); }
.badge-green  { background: rgba(16,185,129,0.12); color: var(--accent2); border: 1px solid rgba(16,185,129,0.2); }
.badge-amber  { background: rgba(245,158,11,0.12); color: var(--accent3); border: 1px solid rgba(245,158,11,0.2); }
.badge-gray   { background: var(--glass); color: var(--text2); border: 1px solid var(--border); }
.badge-admin  { background: rgba(244,63,94,0.12); color: var(--danger); border: 1px solid rgba(244,63,94,0.2); }

.tag { display: inline-block; padding: 3px 10px; background: var(--glass);
    border: 1px solid var(--border2); border-radius: 20px;
    font-size: 12px; color: var(--text2); margin: 2px; transition: all 0.2s; }
.tag:hover { color: var(--accent); border-color: rgba(99,102,241,0.3); }

/* ============================================================
   POST CARD
   ============================================================ */
.post-card {
    background: var(--card); border: 1px solid var(--border2);
    border-radius: var(--radius); padding: 20px 24px;
    margin-bottom: 12px; transition: all 0.25s; text-decoration: none; display: block;
}
.post-card:hover { border-color: rgba(99,102,241,0.3); background: rgba(99,102,241,0.04);
    transform: translateX(3px); }
.post-card.pinned { border-left: 3px solid var(--accent3); }

.post-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.post-title { font-family: 'Inter', 'Segoe UI', Arial, sans-serif; font-size: 17px; font-weight: 700; color: var(--text);
    margin-bottom: 8px; line-height: 1.4; }
.post-excerpt { font-size: 14px; color: var(--text2); margin-bottom: 14px; line-height: 1.6; }
.post-footer { display: flex; align-items: center; gap: 20px; font-size: 13px; color: var(--text3); flex-wrap: wrap; }
.post-stat { display: flex; align-items: center; gap: 5px; }

/* ============================================================
   CATEGORY CARD
   ============================================================ */
.cat-card {
    background: var(--card); border: 1px solid var(--border2);
    border-radius: var(--radius); padding: 18px 20px;
    text-decoration: none; display: block; transition: all 0.2s;
}
.cat-card:hover { border-color: var(--border); transform: translateY(-2px); }
.cat-icon { font-size: 26px; margin-bottom: 10px; display: block; }
.cat-name { font-family: 'Inter', 'Segoe UI', Arial, sans-serif; font-size: 15px; font-weight: 700; margin-bottom: 5px; }
.cat-desc { font-size: 12px; color: var(--text2); line-height: 1.5; margin-bottom: 10px; }
.cat-count { font-size: 12px; color: var(--text3); }

/* ============================================================
   COMMENT
   ============================================================ */
.comment-item { display: flex; gap: 14px; padding: 16px 0;
    border-bottom: 1px solid var(--border2); }
.comment-item:last-child { border-bottom: none; }
.comment-body { flex: 1; }
.comment-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.comment-author { font-weight: 600; color: var(--text); }
.comment-time { color: var(--text3); }
.comment-text { font-size: 14px; color: var(--text2); line-height: 1.7; }

/* ============================================================
   PROJECT CARD (Trang liên kết dự án)
   ============================================================ */
.project-card {
    background: var(--card); border: 1px solid var(--border2);
    border-radius: var(--radius-lg); padding: 28px;
    display: flex; flex-direction: column; gap: 16px;
    transition: all 0.3s;
}
.project-card:hover { border-color: var(--border); transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
.project-icon { font-size: 40px; }
.project-name { font-family: 'Inter', 'Segoe UI', Arial, sans-serif; font-size: 18px; font-weight: 800; }
.project-desc { font-size: 13px; color: var(--text2); line-height: 1.6; flex: 1; }

/* ============================================================
   DIVIDER / SECTION
   ============================================================ */
.section-title {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif; font-size: 20px; font-weight: 800;
    margin-bottom: 20px; display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border2); }

.divider { height: 1px; background: var(--border2); margin: 24px 0; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 30px; }
.page-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; text-decoration: none;
    border: 1px solid var(--border); color: var(--text2); background: var(--glass); transition: all 0.2s; }
.page-btn:hover, .page-btn.active { color: white; background: var(--accent); border-color: var(--accent); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-state .icon { font-size: 52px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-family: 'Inter', 'Segoe UI', Arial, sans-serif; font-size: 18px; color: var(--text2); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--scrollbar, rgba(99,102,241,0.3)); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============================================================
   RESPONSIVE — Mobile First
   ============================================================ */

/* Hamburger button */
.nav-hamburger {
    display: none;
    flex-direction: column; justify-content: center; align-items: center;
    width: 38px; height: 38px; gap: 5px; cursor: pointer;
    background: var(--glass); border: 1px solid var(--border);
    border-radius: var(--radius-sm); flex-shrink: 0; margin-left: auto;
}
.nav-hamburger span {
    display: block; width: 18px; height: 2px;
    background: var(--text2); border-radius: 2px; transition: .25s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer */
.nav-drawer {
    display: none;
    position: fixed; top: 60px; left: 0; right: 0; bottom: 0;
    background: var(--nav-bg, rgba(8,12,22,0.98));
    backdrop-filter: blur(20px);
    z-index: 99; overflow-y: auto;
    flex-direction: column; gap: 0;
    border-top: 1px solid var(--border2);
    padding: 12px 0 32px;
}
.nav-drawer.open { display: flex; }
.nav-drawer a {
    padding: 13px 24px; font-size: 15px; font-weight: 500;
    color: var(--text2); text-decoration: none;
    border-bottom: 1px solid var(--border2); transition: .15s;
    display: flex; align-items: center; gap: 10px;
}
.nav-drawer a:hover, .nav-drawer a.active { color: var(--text); background: var(--glass); }
.nav-drawer a.active { color: var(--accent); }
.nav-drawer .drawer-divider {
    height: 1px; background: var(--border2); margin: 8px 0;
}
.nav-drawer .drawer-actions {
    padding: 14px 20px; display: flex; flex-direction: column; gap: 8px;
}

@media (max-width: 860px) {
    .topnav { padding: 0 16px; gap: 12px; }
    .nav-links { display: none; }
    .nav-actions { display: none; }
    .nav-hamburger { display: flex; }
    body.drawer-open { overflow: hidden; }
}

@media (max-width: 640px) {
    /* Layout */
    .page-wrap, .page-wrap-sm { padding: 16px 14px; }
    .two-col { grid-template-columns: 1fr; }
    .create-wrap, .wrap { padding: 16px 14px !important; }

    /* Cards grid */
    .posts-grid, .cards-grid { grid-template-columns: 1fr !important; }

    /* Card */
    .card { padding: 16px !important; }

    /* Buttons */
    .btn-lg { padding: 11px 20px; font-size: 14px; }

    /* Hero sections */
    .shop-hero, .hero { flex-direction: column !important; gap: 14px !important; padding: 20px !important; }

    /* Stat grid */
    .stat-grid { grid-template-columns: repeat(2,1fr) !important; }

    /* Form price row */
    .price-row { grid-template-columns: 1fr !important; }

    /* Product grid */
    .prod-grid { grid-template-columns: repeat(2,1fr) !important; }

    /* Table scroll */
    .tbl-wrap { overflow-x: auto; }
    table { min-width: 500px; }

    /* Mon grid CTV */
    .mon-grid { grid-template-columns: repeat(3,1fr) !important; }

    /* Type grid cho */
    .type-grid { grid-template-columns: repeat(2,1fr) !important; }
}

@media (max-width: 400px) {
    .prod-grid { grid-template-columns: 1fr !important; }
    .mon-grid  { grid-template-columns: repeat(2,1fr) !important; }
    .stat-grid { grid-template-columns: repeat(2,1fr) !important; }
}
