/* Material Design 风格 */
:root {
    --primary: #1976d2;
    --primary-dark: #115293;
    --primary-light: #4791db;
    --secondary: #dc004e;
    --success: #4caf50;
    --warning: #ff9800;
    --error: #f44336;
    --bg: #f5f5f5;
    --surface: #ffffff;
    --text-primary: rgba(0, 0, 0, 0.87);
    --text-secondary: rgba(0, 0, 0, 0.6);
    --divider: rgba(0, 0, 0, 0.12);
    --shadow-1: 0 2px 1px -1px rgba(0,0,0,0.2), 0 1px 1px 0 rgba(0,0,0,0.14), 0 1px 3px 0 rgba(0,0,0,0.12);
    --shadow-2: 0 3px 1px -2px rgba(0,0,0,0.2), 0 2px 2px 0 rgba(0,0,0,0.14), 0 1px 5px 0 rgba(0,0,0,0.12);
    --shadow-4: 0 2px 4px -1px rgba(0,0,0,0.2), 0 4px 5px 0 rgba(0,0,0,0.14), 0 1px 10px 0 rgba(0,0,0,0.12);
    --shadow-8: 0 5px 5px -3px rgba(0,0,0,0.2), 0 8px 10px 1px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* App Bar */
.app-bar {
    background: var(--primary);
    color: white;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-4);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-bar h1 { font-size: 1.25rem; font-weight: 500; letter-spacing: 0.0075em; }

.app-bar .nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.app-bar .nav-links a, .app-bar .nav-links button {
    color: white;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s;
    border: none;
    background: transparent;
    cursor: pointer;
}

.app-bar .nav-links a:hover, .app-bar .nav-links button:hover {
    background: rgba(255,255,255,0.15);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.container-narrow {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px;
}

/* Card */
.card {
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--shadow-2);
    padding: 24px;
    margin-bottom: 24px;
    transition: box-shadow 0.3s;
}

.card:hover { box-shadow: var(--shadow-4); }

.card-title {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-group label .required { color: var(--error); margin-left: 2px; }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--divider);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--surface);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.12);
}

textarea { resize: vertical; min-height: 80px; }

/* Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 22px;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.02857em;
    text-transform: uppercase;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    gap: 6px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-4);
}

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 1px solid rgba(25, 118, 210, 0.5);
}

.btn-secondary:hover {
    background: rgba(25, 118, 210, 0.04);
    border-color: var(--primary);
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: var(--shadow-2);
}

.btn-success:hover { background: #388e3c; }

.btn-danger {
    background: var(--error);
    color: white;
    box-shadow: var(--shadow-2);
}

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

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

.btn-sm { padding: 4px 12px; font-size: 0.8125rem; }

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

/* Ripple effect */
.btn::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

/* Table */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-2);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    font-size: 0.875rem;
}

thead {
    background: #fafafa;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--divider);
}

th {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tbody tr:hover { background: rgba(0,0,0,0.02); }
tbody tr:last-child td { border-bottom: none; }

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-warning { background: #fff3e0; color: #ef6c00; }
.badge-error { background: #ffebee; color: #c62828; }
.badge-info { background: #e3f2fd; color: #1565c0; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--shadow-8);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--divider);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.modal-close:hover { background: rgba(0,0,0,0.04); }

/* Star Rating */
.star-rating {
    display: flex;
    gap: 4px;
    font-size: 1.5rem;
    cursor: pointer;
}

.star-rating .star {
    color: #e0e0e0;
    transition: color 0.2s;
}

.star-rating .star.active { color: #ffc107; }
.star-rating .star:hover { color: #ffd54f; }

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--divider);
    margin-bottom: 24px;
}

.tab {
    padding: 12px 24px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

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

/* Grid */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -12px;
}

.col-6 { flex: 0 0 50%; padding: 0 12px; }
.col-4 { flex: 0 0 33.333%; padding: 0 12px; }
.col-3 { flex: 0 0 25%; padding: 0 12px; }
.col-12 { flex: 0 0 100%; padding: 0 12px; }

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-8);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.login-card h2 {
    text-align: center;
    margin-bottom: 8px;
    font-weight: 500;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 0.875rem;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--surface);
    border-radius: 4px;
    box-shadow: var(--shadow-8);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--primary);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination button {
    padding: 6px 14px;
    border: 1px solid var(--divider);
    background: var(--surface);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

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

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

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

/* Search Box */
.search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.search-box input {
    flex: 1;
    max-width: 300px;
}

/* File Upload */
.file-upload {
    border: 2px dashed var(--divider);
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload:hover {
    border-color: var(--primary);
    background: rgba(25, 118, 210, 0.02);
}

.file-upload input { display: none; }

/* Checkbox */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--divider);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.checkbox-item:hover { border-color: var(--primary); }
.checkbox-item.selected {
    background: rgba(25, 118, 210, 0.08);
    border-color: var(--primary);
    color: var(--primary);
}

.checkbox-item input { display: none; }

/* Stats Card */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--shadow-2);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue { background: #e3f2fd; color: var(--primary); }
.stat-icon.green { background: #e8f5e9; color: var(--success); }
.stat-icon.orange { background: #fff3e0; color: var(--warning); }
.stat-icon.red { background: #ffebee; color: var(--error); }

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 4px;
}

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

/* Responsive */
@media (max-width: 768px) {
    .col-6, .col-4, .col-3 { flex: 0 0 100%; }
    .app-bar { padding: 0 16px; }
    .container { padding: 16px; }
    .login-card { padding: 24px; margin: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
}

/* Print */
@media print {
    .app-bar, .btn, .pagination, .modal-overlay, .toast-container {
        display: none !important;
    }
    .card { box-shadow: none; border: 1px solid #ddd; }
}
