/* 大商管理页面样式 - 现代化设计 */

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

:root {
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.3);
    --danger: #f43f5e;
    --danger-hover: #fb7185;
    --success: #10b981;
    --warning: #f59e0b;
    --bg: #0f0f1a;
    --bg-card: rgba(30, 32, 48, 0.8);
    --bg-hover: rgba(55, 60, 85, 0.6);
    --bg-input: rgba(20, 22, 35, 0.9);
    --text: #f1f5f9;
    --text-muted: #8b92a5;
    --border: rgba(99, 102, 241, 0.15);
    --border-hover: rgba(99, 102, 241, 0.4);
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px var(--primary-glow);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at top, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    color: var(--text);
    min-height: 100vh;
}

/* 视图切换 */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* 隐藏元素 */
.hidden {
    display: none !important;
}

/* 按钮 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(75, 80, 110, 0.6);
    border-color: var(--border-hover);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #e11d48 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.3);
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(244, 63, 94, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
    font-size: 14px;
}

/* 头部 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    max-width: 1100px;
    margin: 32px auto 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 22px;
    font-weight: 600;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    padding: 6px 12px;
    border-radius: 6px;
}

.back-link:hover {
    color: var(--text);
    background: var(--bg-hover);
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 12px;
    padding: 20px 28px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    flex-wrap: wrap;
    align-items: center;
    max-width: 1100px;
    margin: 20px auto 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.filter-input {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font-size: 14px;
    transition: all 0.25s;
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.filter-input::placeholder {
    color: var(--text-muted);
}

.total-count {
    color: var(--text-muted);
    font-size: 14px;
    margin-left: auto;
    padding: 6px 14px;
    background: var(--bg-hover);
    border-radius: 20px;
}

/* 大商列表 */
.dealers-container {
    padding: 20px 28px 40px;
    max-width: 1100px;
    margin: 0 auto;
}

.dealers-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.dealers-table th,
.dealers-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.dealers-table th {
    background: rgba(99, 102, 241, 0.08);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dealers-table tbody tr {
    transition: all 0.2s;
}

.dealers-table tbody tr:hover {
    background: var(--bg-hover);
}

.dealers-table tbody tr:last-child td {
    border-bottom: none;
}

.dealers-table .user-id {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
}

.dealers-table .user-id a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s;
    padding: 4px 8px;
    margin: -4px -8px;
    border-radius: 6px;
}

.dealers-table .user-id a:hover {
    color: var(--primary-hover);
    background: rgba(99, 102, 241, 0.1);
}

.dealers-table .username {
    color: var(--text);
    font-weight: 500;
}

.dealers-table .notes {
    color: var(--text-muted);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.dealers-table .update-time {
    color: var(--text-muted);
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace;
}

.dealers-table .actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.dealers-table .actions .btn-sm {
    min-width: 60px;
}

.dealers-table .actions .edit-btn {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-hover);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.dealers-table .actions .edit-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: var(--primary);
}

.dealers-table .actions .delete-btn {
    background: rgba(244, 63, 94, 0.12);
    color: var(--danger-hover);
    border: 1px solid rgba(244, 63, 94, 0.25);
    box-shadow: none;
}

.dealers-table .actions .delete-btn:hover {
    background: rgba(244, 63, 94, 0.2);
    border-color: var(--danger);
    transform: none;
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow), var(--shadow-glow);
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-sm {
    max-width: 420px;
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    color: var(--text);
    background: rgba(244, 63, 94, 0.15);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
}

/* 表单 */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-row label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.form-row input {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font-size: 14px;
    transition: all 0.25s;
}

.form-row input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-row input::placeholder {
    color: var(--text-muted);
}

.form-row input:disabled {
    background: var(--bg-hover);
    color: var(--text-muted);
    cursor: not-allowed;
    border-style: dashed;
}

.hint {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 8px;
}

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: var(--text-muted);
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

.empty-state p {
    font-size: 15px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    border-color: var(--success);
    color: white;
}

.toast.error {
    background: linear-gradient(135deg, var(--danger) 0%, #e11d48 100%);
    border-color: var(--danger);
    color: white;
}

/* 响应式 */
@media (max-width: 768px) {
    .header {
        margin: 12px;
        padding: 14px 16px;
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .header > div {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start !important;
    }

    .header h1 {
        font-size: 18px;
    }

    .header .btn-primary {
        width: 100%;
    }

    .filter-bar {
        margin: 12px;
        padding: 14px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .filter-input {
        max-width: none !important;
        width: 100%;
    }

    .total-count {
        margin-left: 0;
        text-align: center;
    }

    .dealers-container {
        padding: 12px;
    }

    /* 移动端表格改为卡片布局 */
    .dealers-table {
        display: block;
    }

    .dealers-table thead {
        display: none;
    }

    .dealers-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .dealers-table tr {
        display: flex;
        flex-direction: column;
        padding: 16px;
        border-radius: var(--radius);
        border: 1px solid var(--border);
        background: var(--bg-card);
    }

    .dealers-table td {
        display: flex;
        padding: 6px 0;
        border-bottom: none;
    }

    .dealers-table td::before {
        content: attr(data-label);
        font-weight: 500;
        color: var(--text-muted);
        min-width: 80px;
        font-size: 12px;
    }

    .dealers-table .user-id {
        max-width: none;
        overflow: visible;
    }

    .dealers-table .notes {
        max-width: none;
        white-space: normal;
    }

    .dealers-table .actions {
        flex-direction: row;
        gap: 8px;
        padding-top: 12px;
        margin-top: 8px;
        border-top: 1px solid var(--border);
    }

    .dealers-table .actions .btn-sm {
        flex: 1;
    }

    .modal {
        margin: 12px;
        max-height: calc(100vh - 24px);
    }

    .modal-header {
        padding: 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 16px;
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header {
        margin: 8px;
        padding: 12px;
    }

    .filter-bar {
        margin: 8px;
        padding: 12px;
    }

    .dealers-container {
        padding: 8px;
    }

    .dealers-table tr {
        padding: 12px;
    }
}