:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #f1f5f9;
    --secondary-hover: #e2e8f0;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --bg-white: #ffffff;
    --bg-light: #f8fafc;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 20px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 15px;
}


header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    font-size: 2.2rem;
    color: var(--primary-color);
}

.logo-text h1 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.logo-text p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.user-actions {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--bg-white);
    padding: 25px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.add-category-section {
    background-color: var(--bg-white);
    padding: 25px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--secondary-color);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input, .form-group select, .form-group textarea {
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.color-preview {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: var(--text-primary);
    transform: scale(1.1);
}

.icon-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 10px;
}

.icon-option {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background-color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.icon-option:hover {
    background-color: var(--secondary-hover);
    transform: translateY(-2px);
}

.icon-option.selected {
    background-color: #e0e7ff;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.categories-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.categories-count {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.view-options {
    display: flex;
    gap: 10px;
}

.view-btn {
    padding: 8px 12px;
    border-radius: 6px;
    background-color: var(--secondary-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
}

.view-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* 网格视图样式 */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.category-card {
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.category-header {
    padding: 20px 20px 15px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.category-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
}

.category-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    background-color: var(--bg-light);
    color: var(--text-light);
    border: none;
}

.action-btn:hover {
    background-color: var(--secondary-color);
}

.edit-btn:hover {
    color: var(--primary-color);
}

.delete-btn:hover {
    color: var(--danger-color);
}

.category-info {
    padding: 0 20px 20px;
    flex-grow: 1;
}

.category-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.category-code {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.category-description {
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.category-meta {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--secondary-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* 列表视图样式 */
.categories-table {
    width: 100%;
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: none;
}

.categories-table.active {
    display: table;
}

.categories-grid.active {
    display: grid;
}

.categories-grid:not(.active) {
    display: none;
}

.table-header {
    display: grid;
    grid-template-columns: 60px 120px 1fr 1fr 120px 80px 80px 80px 80px 100px 120px;
    gap: 15px;
    padding: 15px 20px;
    background-color: var(--bg-light);
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.table-row {
    display: grid;
    grid-template-columns: 60px 120px 1fr 1fr 120px 80px 80px 80px 80px 100px 120px;
    gap: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--secondary-color);
    transition: all 0.3s;
}

.table-row:hover {
    background-color: var(--bg-light);
}

.table-cell {
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-active {
    background-color: #d1fae5;
    color: #065f46;
}

.status-inactive {
    background-color: #fef3c7;
    color: #92400e;
}

.visibility-badge {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.visibility-visible {
    background-color: #dbeafe;
    color: #1e40af;
}

.visibility-hidden {
    background-color: #f3f4f6;
    color: #6b7280;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 20px;
    color: #cbd5e1;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

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

/* 响应式设计 */
@media (max-width: 1400px) {
    .table-header, .table-row {
        grid-template-columns: 60px 120px 1fr 1fr 120px 80px 80px 100px 120px;
    }

    .table-header .hide-on-large,
    .table-row .hide-on-large {
        display: none;
    }
}

@media (max-width: 1200px) {
    .table-header, .table-row {
        grid-template-columns: 60px 120px 1fr 120px 80px 80px 100px 120px;
    }

    .table-header .hide-on-medium,
    .table-row .hide-on-medium {
        display: none;
    }
}

@media (max-width: 992px) {
    .table-header, .table-row {
        grid-template-columns: 60px 1fr 120px 80px 100px 120px;
    }

    .table-header .hide-on-small,
    .table-row .hide-on-small {
        display: none;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .categories-grid {
        grid-template-columns: 1fr;
    }

    .table-header, .table-row {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 10px;
    }

    .table-header .hide-on-mobile,
    .table-row .hide-on-mobile {
        display: none;
    }

    .user-actions {
        width: 100%;
        justify-content: space-between;
    }

    .modal-content {
        padding: 20px;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 10px;
    }

    .table-header, .table-row {
        grid-template-columns: 1fr 1fr;
    }

    .view-options {
        flex-direction: column;
    }
}

.search-section {
    background-color: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.search-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    position: relative;
}

.search-input input {
    width: 100%;
    padding: 14px 20px 14px 45px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.search-input input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

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

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
}

.filter-group select {
    padding: 10px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background-color: white;
    min-width: 150px;
}