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

:root {
    --primary-color: #2563eb;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --gray-color: #6b7280;
    --border-color: #e5e7eb;
    --bg-color: #f9fafb;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    background: #fff;
    box-shadow: var(--shadow);
    padding: 20px 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: inherit;
}

.logo {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.company-info h1 {
    font-size: 20px;
    font-weight: 600;
}

.company-info p {
    font-size: 14px;
    color: var(--text-light);
}

.header-actions {
    display: flex;
    gap: 10px;
}

.main {
    padding: 30px 0;
    min-height: calc(100vh - 120px);
}

.search-section {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    max-width: 500px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--primary-color);
}

.search-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.search-btn:hover {
    opacity: 0.9;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-size-select {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.page-size-select select {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.product-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.product-item {
    margin-bottom: 12px;
    font-size: 14px;
    color: #374151;
}

.product-item:last-child {
    margin-bottom: 0;
}

.product-label {
    font-weight: 500;
    color: #6b7280;
}

.stock-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.stock-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.stock-status.现货 {
    background: #dcfce7;
    color: #166534;
}

.stock-status.现货::before {
    background: #22c55e;
}

.stock-status.需订货 {
    background: #f3f4f6;
    color: #6b7280;
}

.stock-status.需订货::before {
    background: #9ca3af;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    min-width: 40px;
    min-height: 40px;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination button.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

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

.floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(79, 70, 229, 0.35);
    z-index: 1000;
    transition: transform 0.2s, opacity 0.2s;
}

.floating-btn:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    z-index: 2000;
}

.modal.show {
    display: block;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-large {
    max-width: 700px;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-content h3 {
    margin-bottom: 20px;
    font-size: 18px;
}

.qrcode {
    text-align: center;
    margin-bottom: 20px;
}

.qrcode img {
    width: 180px;
    height: 180px;
    margin-bottom: 10px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.copy-btn {
    padding: 4px 10px;
    border: 1px solid var(--primary-color);
    background: #fff;
    color: var(--primary-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.copy-btn:hover {
    background: var(--primary-color);
    color: #fff;
}

.login-section {
    max-width: 350px;
    margin: 60px auto;
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
}

.login-section h2 {
    margin-bottom: 25px;
    font-size: 22px;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-light);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.admin-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table th,
.admin-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.admin-table th {
    background: var(--bg-color);
    font-weight: 600;
}

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

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    min-height: 40px;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background: #1d4ed8;
}

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

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-success {
    background: var(--success-color);
    color: #fff;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-warning {
    background: var(--warning-color);
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    min-height: auto;
}

.form-group {
    margin-bottom: 18px;
}

.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
}

.required {
    color: var(--danger-color);
}

.input,
.textarea,
select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.input:focus,
.textarea:focus,
select:focus {
    border-color: var(--primary-color);
}

.textarea {
    resize: vertical;
}

.checkbox-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: 400;
}

.price-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.price-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: var(--bg-color);
    border-radius: 8px;
}

.price-item input {
    flex: 1;
    min-width: 120px;
}

.price-item.dragging {
    opacity: 0.5;
}

.config-form {
    max-width: 600px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 24px;
    background: #333;
    color: #fff;
    border-radius: 8px;
    z-index: 3000;
    transition: transform 0.3s;
}

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

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .header {
        padding: 15px 0;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .logo-link {
        width: 100%;
        justify-content: center;
    }

    .logo {
        width: 45px;
        height: 45px;
    }

    .company-info {
        text-align: center;
    }

    .company-info h1 {
        font-size: 16px;
        margin-bottom: 5px;
    }

    .company-info p {
        font-size: 12px;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-actions .btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .main {
        padding: 20px 0;
    }

    .search-section {
        max-width: 100%;
        flex-direction: column;
        gap: 12px;
    }

    .search-input {
        padding: 10px 14px;
        font-size: 14px;
    }

    .search-btn {
        width: 100%;
        padding: 10px 20px;
    }

    .products-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-size-select {
        width: 100%;
        justify-content: space-between;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .product-card {
        padding: 18px;
        border-radius: 8px;
    }

    .product-item {
        margin-bottom: 14px;
        font-size: 14px;
        line-height: 1.5;
    }

    .product-label {
        font-size: 13px;
    }

    .stock-status {
        padding: 4px 12px;
        font-size: 12px;
    }

    .pagination {
        gap: 6px;
        margin-top: 20px;
    }

    .pagination button {
        min-width: 36px;
        min-height: 36px;
        padding: 6px 12px;
        font-size: 13px;
    }

    .floating-btn {
        bottom: 15px;
        right: 15px;
        padding: 12px 22px;
        font-size: 14px;
        border-radius: 40px;
    }

    .btn {
        min-height: 44px;
        padding: 10px 18px;
        font-size: 14px;
    }

    .btn-sm {
        padding: 8px 14px;
        min-height: 36px;
    }

    .modal-content {
        padding: 20px 15px;
        width: 95%;
        max-width: 95%;
        max-height: 85vh;
    }

    .modal-large {
        max-width: 95%;
    }

    .modal-content h3 {
        font-size: 16px;
        margin-bottom: 15px;
    }

    .qrcode img {
        width: 150px;
        height: 150px;
    }

    .contact-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .copy-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .form-row .form-group {
        min-width: 100%;
    }

    .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .input,
    .textarea,
    select {
        padding: 10px 12px;
        font-size: 14px;
    }

    .checkbox-group {
        flex-direction: column;
        gap: 10px;
    }

    .checkbox-group label {
        font-size: 14px;
    }

    .price-item {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }

    .price-item input {
        width: 100%;
        min-width: 100%;
    }

    .price-item .btn-sm {
        width: 100%;
    }

    .login-section {
        padding: 30px 20px;
        margin: 30px auto;
    }

    .login-section h2 {
        font-size: 18px;
    }

    .admin-tabs {
        flex-direction: column;
        gap: 5px;
        border-bottom: none;
    }

    .tab-btn {
        padding: 10px 15px;
        font-size: 14px;
        border-bottom: none;
        border-left: 3px solid transparent;
        text-align: left;
    }

    .tab-btn.active {
        border-left-color: var(--primary-color);
        border-bottom-color: transparent;
    }

    .admin-toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .admin-toolbar .btn {
        width: 100%;
    }

    .admin-table {
        display: block;
        overflow-x: auto;
        font-size: 13px;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 12px;
    }

    .form-actions {
        flex-direction: column;
        gap: 10px;
    }

    .form-actions .btn {
        width: 100%;
    }

    .toast {
        width: 90%;
        max-width: 300px;
        font-size: 13px;
        padding: 10px 20px;
    }
}
