/* ============================================
   Member Mall Management System - Blue Theme
   ============================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --primary-bg: #eff6ff;
    --sidebar-width: 250px;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --topbar-height: 60px;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --card-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* ============ Auth Pages ============ */
.auth-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 30%, #1e40af 70%, #1e3a8a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,.15);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-logo i {
    font-size: 32px;
    color: #fff;
}

.auth-header h4 {
    color: #1e293b;
    font-weight: 700;
    margin-bottom: 4px;
}

.auth-header p {
    font-size: 14px;
    margin-bottom: 0;
}

.auth-alert {
    margin-bottom: 20px;
    font-size: 14px;
}

.auth-card .form-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.auth-card .input-group-text {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #94a3b8;
}

.auth-card .form-control {
    border-color: #e2e8f0;
    padding: 10px 14px;
    font-size: 14px;
    transition: all .2s;
}

.auth-card .form-control:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.auth-card .form-text {
    font-size: 12px;
    color: #94a3b8;
}

.btn-auth {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border: none;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
    transition: all .3s;
}

.btn-auth:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
}

.btn-auth:disabled {
    opacity: .7;
    transform: none;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: #64748b;
}

.auth-footer a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ---- Captcha ---- */
.captcha-row {
    display: flex;
    gap: 10px;
    align-items: center;
}
.captcha-input {
    flex: 1;
}
.captcha-img {
    height: 42px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    flex-shrink: 0;
}
.captcha-img:hover {
    border-color: #2563eb;
}

/* ============ Main Layout ============ */
.app-wrapper {
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    transition: transform .3s;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    min-height: var(--topbar-height);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
}

.sidebar-brand i {
    font-size: 24px;
    color: #3b82f6;
    margin-right: 10px;
}

.sidebar-brand:hover {
    color: #e2e8f0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 22px;
    cursor: pointer;
}

.sidebar-user {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(59,130,246,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.user-avatar i {
    font-size: 24px;
    color: #3b82f6;
}

.user-info {
    overflow: hidden;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 12px;
    color: #64748b;
}

/* ---- Navigation ---- */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-nav .nav-item {
    padding: 0 12px;
    margin-bottom: 2px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: #94a3b8;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: all .2s;
    text-decoration: none;
}

.sidebar-nav .nav-link i {
    font-size: 18px;
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,.3);
}

/* ---- Sidebar Footer ---- */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.06);
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    color: #94a3b8;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: all .2s;
    text-decoration: none;
}

.btn-logout i {
    margin-right: 8px;
}

.btn-logout:hover {
    background: rgba(239,68,68,.15);
    color: #f87171;
    border-color: rgba(239,68,68,.25);
}

/* ---- Sidebar Invite ---- */
.sidebar-invite {
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,.06);
}
.invite-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    margin-bottom: 6px;
}
.invite-code-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.invite-code-text {
    flex: 1;
    background: rgba(255,255,255,.08);
    color: #e2e8f0;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.invite-copy-btn {
    background: rgba(37,99,235,.3);
    color: #93c5fd;
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all .2s;
}
.invite-copy-btn:hover {
    background: rgba(37,99,235,.5);
    color: #bfdbfe;
}
.invite-link-hint {
    font-size: 11px;
    color: #4ade80;
    margin-top: 4px;
}

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: #f1f5f9;
}

/* ---- Top Bar ---- */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    font-size: 22px;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.topbar-actions {
    display: flex;
    align-items: center;
}

.topbar-link {
    position: relative;
    color: #64748b;
    font-size: 18px;
    padding: 4px 8px;
    text-decoration: none;
}

.topbar-link:hover {
    color: #2563eb;
}

.badge-notify {
    position: absolute;
    top: 0;
    right: 2px;
    width: 16px;
    height: 16px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Content Area ---- */
.content-area {
    min-height: calc(100vh - var(--topbar-height));
}

/* ---- Stats Cards ---- */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    box-shadow: var(--card-shadow);
    transition: all .2s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    flex-shrink: 0;
}

.stat-icon i {
    font-size: 22px;
    color: #fff;
}

.stat-info h6 {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 4px;
}

.stat-info h3 {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 2px;
}

.stat-info small {
    font-size: 12px;
}

/* ---- Dashboard 卡片 ---- */
.card-dashboard {
    border: none;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    height: 100%;
}

.card-dashboard .card-header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    border-radius: 12px 12px 0 0;
}

.card-dashboard .card-header h5 {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

/* ---- Quick Actions ---- */
.quick-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    border-radius: 12px;
    text-decoration: none;
    transition: all .2s;
    border: 1px solid transparent;
}

.quick-link:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.quick-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.quick-icon i {
    font-size: 22px;
}

.quick-link span {
    font-size: 13px;
    font-weight: 500;
    color: #475569;
}

/* ---- Timeline ---- */
.timeline {
    list-style: none;
    padding: 0;
    margin: 0;
}

.timeline-item {
    display: flex;
    padding-bottom: 16px;
    position: relative;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 14px;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.timeline-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 14px;
    margin-top: 4px;
    flex-shrink: 0;
}

.timeline-content {
    flex: 1;
}

.timeline-content p {
    font-size: 14px;
    color: #334155;
}

/* ---- Dropdown ---- */
.dropdown-menu {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,.12);
    padding: 8px;
}

.dropdown-header {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 8px 16px;
}

.dropdown-item {
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    color: #334155;
    transition: all .15s;
}

.dropdown-item:hover {
    background: #f1f5f9;
    color: #1e293b;
}

/* ============ Responsive ============ */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1050;
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,.15);
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 767.98px) {
    .auth-card {
        padding: 24px 20px;
    }

    .auth-header h4 {
        font-size: 18px;
    }

    .topbar {
        padding: 0 16px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
    }

    .stat-icon i {
        font-size: 18px;
    }

    .stat-info h3 {
        font-size: 20px;
    }

    /* 移动端表格字体缩小 */
    .table-responsive table {
        font-size: 13px;
    }

    /* 移动端卡片头部搜索栏垂直排列 */
    .card-header.d-flex {
        flex-direction: column;
        align-items: flex-start !important;
    }
    .card-header.d-flex > .d-flex {
        width: 100%;
    }
    .card-header .d-flex.flex-wrap.gap-2 {
        width: 100%;
    }
}

/* ============ Shop Products ============ */
.shop-product-card {
    border-radius: 12px;
    overflow: hidden;
    transition: all .2s;
    height: 100%;
    border: 1px solid var(--border-color);
}
.shop-product-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    transform: translateY(-2px);
}
.product-img-placeholder {
    height: 160px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}
.product-title {
    font-weight: 600;
    color: var(--text-dark);
}

/* ---- Tag Ribbon (右上角斜着显示) ---- */
.tag-ribbon {
    position: absolute;
    top: 12px;
    right: -30px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transform: rotate(15deg);
    pointer-events: none;
}
.tag-ribbon-item {
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 28px;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(239,68,68,.35);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---- Buy Button ---- */
.shop-buy-btn {
    padding: 6px 18px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all .2s;
    /* 默认样式，会被 button_style 覆盖 */
    background: #2563eb;
    color: #fff;
}
.shop-buy-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}
.shop-buy-btn-free {
    /* 0元试用按钮额外样式，会叠加在 button_style 之上 */
}

/* ---- Free Card Lock Overlay ---- */
.free-card-lock-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: rgba(30, 41, 59, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}
.free-card-lock-overlay .lock-content {
    text-align: center;
    color: #f1f5f9;
}
.free-card-lock-overlay .lock-content i {
    font-size: 32px;
    display: block;
    margin-bottom: 4px;
}
.free-card-lock-overlay .lock-content span {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}
.free-card-lock-overlay .unlock-btn {
    border-color: #fbbf24;
    color: #fbbf24;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 14px;
    border-radius: 20px;
    transition: all .2s;
}
.free-card-lock-overlay .unlock-btn:hover {
    background: #fbbf24;
    color: #1e293b;
}

/* ============ Brand ============ */
.brand-hero-placeholder {
    border-radius: 12px;
}

/* ============ Announcement ============ */
.announcement-item:hover {
    background: #f8fafc;
}

/* ============ Cart ============ */
.cart-badge {
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 10px;
    padding: 0 6px;
}
.cart-product-preview {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #f1f5f9;
}
.qty-group { width: 120px; }
.qty-input { background: #fff !important; }
.qty-btn { width: 32px; }

/* ============ Checkout ============ */
.payment-methods {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.payment-option {
    display: block;
    cursor: pointer;
    margin: 0;
}
.payment-option input { display: none; }
.payment-option-content {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    transition: all .2s;
}
.payment-option-content i {
    font-size: 24px;
    color: #64748b;
    flex-shrink: 0;
}
.payment-option input:checked + .payment-option-content {
    border-color: #2563eb;
    background: #eff6ff;
}
.payment-option input:checked + .payment-option-content i {
    color: #2563eb;
}

/* Order Success */
.success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
}
.success-icon i {
    font-size: 44px;
    color: #059669;
}

/* Cart Toast */
.cart-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    background: #2563eb;
    color: #fff;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(37,99,235,.35);
    opacity: 0;
    transform: translateX(100%);
    transition: all .3s ease;
}
.cart-toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* ============ Responsive ============ */
@media (max-width: 575.98px) {
    .auth-body {
        padding: 12px;
        align-items: flex-start;
        padding-top: 40px;
    }
}
