:root {
    --primary: #1a56db;
    --primary-dark: #1a365d;
    --primary-light: #3b82f6;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --gradient: linear-gradient(135deg, #1a365d, #1a56db);
}

body {
    font-family: -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
    background: #f8fafc;
    color: #1e293b;
}

/* Navbar */
.navbar { box-shadow: 0 2px 10px rgba(0,0,0,0.1); padding: 12px 0; }
.navbar-brand { font-weight: 700; font-size: 1.3rem; letter-spacing: 1px; }
.navbar-nav .nav-link { font-weight: 500; padding: 8px 16px !important; border-radius: 8px; margin: 0 2px; transition: all 0.2s; }
.navbar-nav .nav-link:hover { background: rgba(255,255,255,0.15); }
.navbar-nav .nav-link i { margin-right: 6px; }
.navbar .dropdown-menu { border: none; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); margin-top: 8px; }
.navbar .dropdown-menu .dropdown-item { border-radius: 8px; padding: 8px 16px; }
.navbar .dropdown-menu .dropdown-item:hover { background: #eff6ff; }
.navbar .dropdown-menu .dropdown-item i { width: 20px; color: var(--primary); }

/* Footer hover */
.hover-light { transition: color 0.2s; }
.hover-light:hover { color: #fff !important; }

/* Buttons */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* Cards */
.card { border: none; border-radius: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); transition: transform 0.2s, box-shadow 0.2s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

/* Section spacing */
.section { padding: 80px 0; }
.section-title { font-weight: 700; margin-bottom: 40px; text-align: center; }
.section-title .subtitle { color: #64748b; font-size: 1.1rem; font-weight: 400; margin-top: 8px; }

/* Hero */
.hero-section {
    background: var(--gradient);
    color: #fff;
    padding: 100px 0 80px;
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
}
.hero-section h1 { font-weight: 800; }
.hero-section p { font-size: 1.2rem; opacity: 0.9; margin-bottom: 30px; }
.hero-section .highlight { color: #fbbf24; font-weight: 600; }

/* Feature card */
.feature-card { text-align: center; padding: 30px 20px; }
.feature-card .icon { font-size: 2.5rem; color: var(--primary); margin-bottom: 15px; }
.feature-card h5 { font-weight: 600; margin-bottom: 10px; }

/* Step card */
.step-card { text-align: center; position: relative; }
.step-number {
    width: 50px; height: 50px; line-height: 50px;
    background: var(--gradient); color: #fff;
    border-radius: 50%; font-size: 1.3rem; font-weight: 700;
    margin: 0 auto 15px;
}

/* Comparison table */
.comparison-table th { background: var(--gradient); color: #fff; }
.comparison-table .fa-check { color: var(--success); }
.comparison-table .fa-times { color: var(--danger); }

/* FAQ */
.accordion-button:not(.collapsed) { background: #eff6ff; color: var(--primary-dark); }

/* Flash messages */
.flash-container { position: fixed; top: 70px; right: 20px; z-index: 9999; min-width: 300px; }

/* Auth pages */
.auth-card { max-width: 420px; margin: 60px auto; }

/* Chat */
.chat-container { max-width: 800px; margin: 0 auto; }
.chat-messages { height: 500px; overflow-y: auto; padding: 20px; background: #fff; border-radius: 16px; }
.chat-message { margin-bottom: 20px; display: flex; }
.chat-message.user { justify-content: flex-end; }
.chat-message .bubble { max-width: 70%; padding: 12px 18px; border-radius: 16px; line-height: 1.6; }
.chat-message.user .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-message.assistant .bubble { background: #f1f5f9; color: #1e293b; border-bottom-left-radius: 4px; }
.chat-message .avatar { width: 36px; height: 36px; border-radius: 50%; margin: 0 10px; }

/* Contract review */
.cursor-pointer { cursor: pointer; }
.scenario-item, .position-item { cursor: pointer; transition: all 0.2s; }
.scenario-item:hover, .position-item:hover { border-color: var(--primary); background: #f0f7ff; }
.scenario-item.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.scenario-item.selected i { color: #fff !important; }
.scenario-item.selected small { color: #fff !important; }
.scenario-item.selected span { color: #fff !important; }
.position-item.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.position-item.selected i { color: #fff !important; }
.position-item.selected strong { color: #fff !important; }
.position-item.selected small { color: rgba(255,255,255,0.85) !important; }

/* Drop zone */
.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #f8fafc;
}
.drop-zone:hover, .drop-zone-active {
    border-color: var(--primary);
    background: #eff6ff;
}
.drop-zone-file {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

/* Dashboard sidebar */
.dashboard-sidebar { width: 250px; min-height: calc(100vh - 56px); background: #fff; border-right: 1px solid #e2e8f0; }
.dashboard-sidebar .nav-link { color: #475569; padding: 12px 20px; border-radius: 8px; margin: 2px 8px; }
.dashboard-sidebar .nav-link:hover, .dashboard-sidebar .nav-link.active { background: #eff6ff; color: var(--primary); }
.dashboard-content { flex: 1; padding: 24px; }

/* Stat card */
.stat-card { background: #fff; border-radius: 16px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.stat-card .stat-num { font-size: 2rem; font-weight: 700; }
.stat-card .stat-label { color: #64748b; font-size: 0.9rem; }

/* Region picker - two-level */
.region-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
}
.region-item:hover { background: #eff6ff; }
.region-back { justify-content: flex-start; gap: 8px; border-bottom: 1px solid #e2e8f0; margin-bottom: 4px; padding-bottom: 12px; }
.region-province-header { font-weight: 700; color: #1e293b; padding: 6px 14px 10px; font-size: 0.9rem; border-bottom: 1px solid #e2e8f0; margin-bottom: 4px; }

/* Lawyer card */
.lawyer-card { border-left: 4px solid var(--primary); }
.lawyer-card .score { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.match-reason { background: #f8fafc; border-radius: 8px; padding: 4px 10px; font-size: 0.85rem; display: inline-block; margin: 2px; }

/* ====== Responsive: Mobile (xs, <576px) ====== */
@media (max-width: 575.98px) {
    body { font-size: 0.95rem; }

    .hero-section { padding: 50px 0 40px; }
    .hero-section h1 { font-size: 1.5rem; }
    .hero-section p { font-size: 0.9rem; }

    .section { padding: 24px 0; }
    .section-title { font-size: 1.2rem; margin-bottom: 20px; }

    .navbar-brand { font-size: 1.1rem; }
    .navbar-nav .nav-link { padding: 6px 12px !important; font-size: 0.9rem; }

    .card-body { padding: 1rem !important; }
    .stat-card { padding: 14px; }
    .stat-card .stat-num { font-size: 1.4rem; }

    .auth-card { margin: 20px 12px; }

    .chat-messages { height: 350px; padding: 10px; }
    .chat-message .bubble { max-width: 92%; padding: 10px 14px; font-size: 0.9rem; }
    .chat-message .avatar { width: 30px; height: 30px; margin: 0 6px; }

    .table { font-size: 0.78rem; }
    .table td, .table th { padding: 0.35rem 0.4rem !important; }

    .float-lawyer-btn { padding: 8px 16px !important; font-size: 0.88rem !important; }
    .position-fixed.bottom-0.end-0.p-4 { padding: 10px !important; }
    .float-lawyer-wrapper .dropdown-menu { min-width: 220px !important; right: 0; left: auto !important; }

    .drop-zone { padding: 20px 12px !important; }
    .drop-zone i.fa-cloud-upload-alt { font-size: 2rem !important; }

    .dashboard-content { padding: 12px !important; }

    .scenario-item { padding: 10px 6px !important; }
    .scenario-item i { font-size: 1.3rem !important; }
    .position-item { padding: 10px 8px !important; }

    .input-group .btn { font-size: 0.82rem; padding: 0.3rem 0.4rem; white-space: nowrap; }

    .feature-card { padding: 16px 10px; }
    .feature-card .icon { font-size: 1.8rem; }

    .step-number { width: 36px; height: 36px; line-height: 36px; font-size: 1rem; }

    .flash-container { min-width: auto; right: 10px; left: 10px; top: 56px; font-size: 0.9rem; }
    .flash-container .alert { padding: 10px 36px 10px 12px; }

    .comparison-table { font-size: 0.78rem; }
    .comparison-table th, .comparison-table td { padding: 0.4rem !important; }

    .accordion-button { font-size: 0.9rem; padding: 0.8rem 1rem; }

    .modal-dialog { margin: 0.5rem; }
    .modal-body { padding: 1rem !important; }

    .region-item { padding: 8px 12px; font-size: 0.9rem; }

    .lawyer-card .score { font-size: 1.2rem; }
    .match-reason { font-size: 0.78rem; }

    .list-group-item { padding: 10px 12px !important; font-size: 0.9rem; }

    .btn { font-size: 0.88rem; padding: 0.4rem 0.75rem; }
    .btn-sm { font-size: 0.8rem; padding: 0.25rem 0.5rem; }
}

/* ====== Responsive: Tablet (sm, 576px-768px) ====== */
@media (min-width: 576px) and (max-width: 767.98px) {
    .hero-section { padding: 60px 0 50px; }
    .hero-section h1 { font-size: 1.8rem; }

    .dashboard-content { padding: 16px !important; }

    .chat-messages { height: 400px; }
    .chat-message .bubble { max-width: 85%; }

    .stat-card { padding: 18px; }
    .stat-card .stat-num { font-size: 1.6rem; }
}

/* ====== Responsive: Medium screens (md, 768px-992px) ====== */
@media (min-width: 768px) and (max-width: 991.98px) {
    .dashboard-content { padding: 20px !important; }
}

/* ====== Touch-friendly targets (all mobile) ====== */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav-link, .dropdown-item, .region-item {
        -webkit-tap-highlight-color: transparent;
    }
    .navbar-nav .nav-link { padding: 10px 16px !important; }
}

/* ====== Dashboard offcanvas sidebar overrides ====== */
@media (max-width: 767.98px) {
    .dashboard-sidebar-offcanvas { width: 260px !important; }
}
