/* MiXing Website - Shared Styles */
:root {
    --brand-blue: #000080;
    --brand-teal: #5FFEB0;
    --white: #FFFFFF;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Header Navigation */
header {
    position: sticky;
    top: 0;
    background: var(--white);
    box-shadow: var(--shadow);
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-area img {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
}

.logo-text h1 {
    font-size: 18px;
    color: var(--brand-blue);
    font-weight: 700;
}

.logo-text span {
    font-size: 11px;
    color: var(--text-secondary);
}

nav {
    display: flex;
    gap: 8px;
}

nav a {
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    border-radius: 8px;
    transition: 0.3s;
}

nav a:hover, nav a.active {
    background: var(--brand-blue);
    color: var(--white);
}

/* Buttons */
.btn-primary {
    background: var(--brand-teal);
    color: var(--brand-blue);
    border: none;
    padding: 10px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(95, 254, 176, 0.4);
}

.btn-secondary {
    background: var(--white);
    color: var(--brand-blue);
    border: 2px solid var(--brand-blue);
    padding: 8px 22px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.btn-secondary:hover {
    background: var(--brand-blue);
    color: var(--white);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--brand-blue), #0a0a3e);
    color: var(--white);
    padding: 80px 20px;
    text-align: center;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Services Grid */
.services-grid,
.service-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin: 40px auto;
}

.service-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: 0.3s;
    border: 2px solid transparent;
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--brand-teal);
}

.service-card .icon {
    font-size: 42px;
    margin-bottom: 15px;
}

.service-card h3 {
    color: var(--brand-blue);
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.service-card p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    transition: 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand-teal);
    box-shadow: 0 0 0 3px rgba(95, 254, 176, 0.2);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 128, 0.3);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.modal-header h3 {
    color: var(--brand-blue);
    font-size: 1.4rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Footer */
footer {
    background: var(--brand-blue);
    color: var(--white);
    padding: 50px 20px 30px;
    margin-top: 60px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
}

.footer-section h4 {
    margin-bottom: 18px;
    font-size: 16px;
    position: relative;
    padding-bottom: 10px;
}

.footer-section h4::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 30px;
    height: 2px;
    background: var(--brand-teal);
}

.footer-section p,
.footer-section a {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    line-height: 2;
    text-decoration: none;
    display: block;
}

.footer-section a:hover {
    color: var(--brand-teal);
}

.footer-qrcode {
    text-align: center;
}

.footer-qrcode img {
    width: 120px;
    height: 120px;
    background: var(--white);
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.footer-qrcode p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    margin-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

/* Side Contact Widget */
.side-contact {
    position: fixed;
    right: 20px;
    bottom: 100px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 24px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
}

.contact-btn:hover {
    transform: scale(1.15);
}

.btn-wechat {
    background: #07C160;
    color: var(--white);
}

.btn-mp {
    background: var(--brand-blue);
    color: var(--white);
}

.btn-consult {
    background: var(--brand-teal);
    color: var(--brand-blue);
    width: auto;
    padding: 0 18px;
    border-radius: 27px;
    font-size: 14px;
    font-weight: 600;
}

/* QR Code Popup */
.qrcode-popup {
    position: fixed;
    right: 90px;
    bottom: 100px;
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
    z-index: 91;
    display: none;
    text-align: center;
}

.qrcode-popup.active {
    display: block;
}

.qrcode-popup img {
    width: 140px;
    height: 140px;
    margin-bottom: 10px;
}

.qrcode-popup p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Utility Classes */
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.container { max-width: 1200px; margin: 0 auto; }

/* Responsive */
@media (max-width: 1024px) {
    .services-grid,
    .service-detail-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .nav-container { flex-wrap: wrap; gap: 15px; }
    nav { order: 3; width: 100%; justify-content: center; }
    .hero h2 { font-size: 1.8rem; }
    .hero { padding: 50px 15px; }
    .footer-container { grid-template-columns: 1fr 1fr; }
    .side-contact { right: 10px; bottom: 80px; }
    .contact-btn { width: 48px; height: 48px; font-size: 20px; }
    .services-grid,
    .service-detail-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   MOBILE ENHANCEMENTS - Full responsive adaptation
   ============================================================ */

/* ---------- Hamburger Menu ---------- */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 8px;
    gap: 5px;
    border-radius: 8px;
    transition: background 0.3s;
}

.hamburger:hover {
    background: var(--gray-100);
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--brand-blue);
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile nav overlay */
.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
    opacity: 0;
    transition: opacity 0.3s;
}

.nav-overlay.active {
    display: block;
    opacity: 1;
}

/* ---------- Mobile Navigation Panel ---------- */
.mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    right: -280px;
    width: 260px;
    height: 100%;
    background: var(--white);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 99;
    transition: right 0.3s ease;
    overflow-y: auto;
    padding-top: 0;
}

.mobile-nav.active {
    display: flex;
    flex-direction: column;
    right: 0;
}

.mobile-nav-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.mobile-nav-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.mobile-nav-close:hover {
    background: var(--gray-100);
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
}

.mobile-nav-links a {
    padding: 14px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 16px;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.2s;
}

.mobile-nav-links a:hover,
.mobile-nav-links a.active {
    background: var(--gray-50);
    color: var(--brand-blue);
}

.mobile-nav-links a.highlight {
    color: #DC2626;
    font-weight: 700;
}

.mobile-nav-footer {
    padding: 20px;
    margin-top: auto;
    border-top: 1px solid var(--gray-200);
}

.mobile-nav-footer .btn-primary {
    width: 100%;
    text-align: center;
    padding: 14px;
    font-size: 16px;
}

/* ---------- Fixed Bottom Nav (Mobile Only) ---------- */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--white);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 90;
    padding: 6px 0;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
}

.bottom-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 11px;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item .nav-icon {
    font-size: 22px;
    line-height: 1;
}

.bottom-nav-item.active {
    color: var(--brand-blue);
}

.bottom-nav-item:hover {
    background: var(--gray-50);
}

/* ---------- Stats Section ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 16px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px 10px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-card .value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--brand-blue);
}

.stat-card .label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ---------- Table Scroll (Community) ---------- */
.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.table-scroll-wrapper table {
    min-width: 600px;
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

.table-scroll-wrapper th,
.table-scroll-wrapper td {
    padding: 12px 14px;
    font-size: 14px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table-scroll-wrapper th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--brand-blue);
    white-space: nowrap;
}

/* ---------- Loading / Skeleton ---------- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--brand-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Toast Notifications ---------- */
.toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: calc(100% - 32px);
    max-width: 400px;
    pointer-events: none;
}

.toast {
    background: var(--text-primary);
    color: var(--white);
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-10px);
    animation: toastIn 0.3s forwards;
}

.toast.success {
    background: #059669;
}

.toast.error {
    background: #DC2626;
}

.toast.info {
    background: var(--brand-blue);
}

@keyframes toastIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Login / Register Forms ---------- */
.auth-container {
    max-width: 400px;
    margin: 60px auto;
    padding: 0 20px;
}

.auth-card {
    background: var(--white);
    border-radius: 16px;
    padding: 36px 28px;
    box-shadow: var(--shadow-lg);
}

.auth-card h2 {
    color: var(--brand-blue);
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 8px;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 28px;
}

.auth-card .form-group {
    margin-bottom: 16px;
}

/* ============================================================
   TABLET BREAKPOINT (768px - 1024px)
   ============================================================ */
@media (max-width: 1024px) {
    .services-grid,
    .service-detail-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-container { grid-template-columns: repeat(2, 1fr); }
    .hero { padding: 60px 20px; }
}

/* ============================================================
   MOBILE BREAKPOINT (< 768px)
   ============================================================ */
@media (max-width: 768px) {
    /* Hamburger visible, desktop nav hidden */
    .desktop-nav { display: none !important; }
    .hamburger { display: flex; }

    /* Bottom nav */
    .bottom-nav { display: block; }
    body { padding-bottom: max(65px, env(safe-area-inset-bottom)); }

    /* Hero */
    .hero { padding: 40px 16px; }
    .hero h2 { font-size: 1.7rem; }
    .hero p { font-size: 0.95rem; }

    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 0 12px;
        margin: 20px auto;
    }
    .stat-card { padding: 14px 8px; }
    .stat-card .value { font-size: 1.3rem; }
    .stat-card .label { font-size: 11px; }

    /* Services */
    .services-grid,
    .service-detail-grid {
        grid-template-columns: 1fr;
        padding: 0 12px;
        gap: 14px;
    }
    .service-card { padding: 18px; }
    .service-card .icon { font-size: 36px; }

    /* Section titles */
    h2 { font-size: 1.4rem; }

    /* Footer */
    footer { padding: 40px 16px 30px; }
    .footer-container { grid-template-columns: 1fr; gap: 24px; }
    .footer-section h4::after { width: 20px; }

    /* Hide side contact (bottom nav replaces it) */
    .side-contact { display: none !important; }
    .qrcode-popup { display: none !important; }

    /* Auth forms */
    .auth-container { margin: 30px auto; padding: 0 12px; }
    .auth-card { padding: 28px 20px; }
    .auth-card h2 { font-size: 1.3rem; }

    /* Modal */
    .modal-content { width: 95%; padding: 20px 16px; border-radius: 12px; margin: 16px; }
    .modal-header h3 { font-size: 1.2rem; }

    /* Tables */
    .table-scroll-wrapper { border-radius: 8px; margin: 0 12px; }
    .table-scroll-wrapper th,
    .table-scroll-wrapper td { padding: 10px 12px; font-size: 13px; }

    /* Buttons - larger touch targets */
    .btn-primary, .btn-secondary {
        padding: 14px 24px;
        font-size: 15px;
        border-radius: 25px;
    }

    /* Forms - prevent iOS zoom */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        padding: 14px 12px;
    }

    /* Logo - smaller */
    .logo-area img { width: 40px; height: 40px; }
    .logo-text h1 { font-size: 16px; }
    .logo-text span { font-size: 10px; }

    /* Page container */
    .container { padding: 0 12px; }

    /* Community posts grid */
    .posts-grid { grid-template-columns: 1fr; padding: 0 12px; gap: 14px; }
    .post-card { padding: 16px; }

    /* Tags */
    .tag { padding: 3px 8px; font-size: 11px; }

    /* Toast */
    .toast-container { top: 70px; width: calc(100% - 24px); }
    .toast { font-size: 13px; padding: 12px 16px; }

    /* Loading */
    .spinner { width: 36px; height: 36px; }
}

/* ============================================================
   SMALL MOBILE (< 480px)
   ============================================================ */
@media (max-width: 480px) {
    .stat-card .value { font-size: 1.1rem; }
    .stat-card .label { font-size: 10px; }
    .hero h2 { font-size: 1.4rem; }
    .auth-card { padding: 24px 16px; border-radius: 12px; }
    .service-card { padding: 16px; }
    .service-card .icon { font-size: 32px; }
    .bottom-nav-item .nav-icon { font-size: 20px; }
    .bottom-nav-item { font-size: 10px; padding: 5px 8px; }
}

/* ============================================================
   UTILITY
   ============================================================ */
.desktop-only { display: block; }
.mobile-only { display: none; }

@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: block; }
}
