/* Web版全局样式 */

/* CSS Variables */
:root {
    --primary-color: #21aba7;
    --primary-dark: #1a8a87;
    --primary-light: #e0f7f6;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --neutral-50: #f9fafb;
    --neutral-100: #f3f4f6;
    --neutral-200: #e5e7eb;
    --neutral-300: #d1d5db;
    --neutral-400: #9ca3af;
    --neutral-500: #6b7280;
    --neutral-600: #4b5563;
    --neutral-700: #374151;
    --neutral-800: #1f2937;
    --neutral-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* CSS Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, var(--neutral-50) 0%, #ffffff 100%);
    color: var(--neutral-700);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Header Styles */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 40px;
    border-bottom: 1px solid #e5e7eb;
    background-color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .logo {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.header .logo img {
    height: 36px;
    width: auto;
    margin-right: 8px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 40px;
}

.header .main-nav ul {
    display: flex;
    gap: 30px;
}

.header .main-nav a {
    color: #4a4a4a;
    font-size: 14px;
    transition: color 0.2s;
    cursor: pointer;
}

.header .main-nav a.active,
.header .main-nav a:hover {
    color: #21aba7;
}

.header .main-nav a.active {
    font-weight: bold;
}

.header .user-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header .user-actions .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #f0f0f0;
    background-image: url('../assets/default_avatar.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
}

/* Main Content */
.main-content {
    padding: 32px 40px;
    max-width: 100%;
    flex: 1;
}

/* Footer Styles */
.footer {
    border-top: 1px solid var(--neutral-200);
    padding: 24px 40px;
    background: linear-gradient(135deg, var(--neutral-50) 0%, #ffffff 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--neutral-500);
    margin-top: auto;
}

.footer-left .copyright {
    color: #666;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.footer-right .friendly-links {
    color: #666;
}

.footer-right a {
    color: #21aba7;
    text-decoration: none;
    margin: 0 4px;
}

.footer-right a:hover {
    text-decoration: underline;
}

.footer.center-only {
    justify-content: center;
}

/* Content Wrapper */
.content-wrapper {
    background: #ffffff;
    border-radius: var(--radius-xl);
    padding: 0;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--neutral-200);
    overflow: hidden;
}

/* Form Header */
.form-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 32px 40px;
    text-align: center;
    position: relative;
}

.form-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.form-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

/* Form Container */
.form-container {
    padding: 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.form-column {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.form-section {
    background: var(--neutral-50);
    border-radius: var(--radius-lg);
    padding: 32px;
    border: 1px solid var(--neutral-200);
    transition: all 0.3s ease;
    height: fit-content;
}

.form-section:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.form-section.full-width {
    grid-column: 1 / -1;
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--neutral-200);
}

.section-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    margin-right: 16px;
    box-shadow: var(--shadow-sm);
}

.section-title {
    flex: 1;
}

.section-title h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--neutral-800);
    margin: 0 0 4px 0;
}

.section-title p {
    font-size: 0.875rem;
    color: var(--neutral-500);
    margin: 0;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.form-grid.single-column {
    grid-template-columns: 1fr;
}

/* Form Group */
.form-group {
    position: relative;
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--neutral-700);
}

.form-group.required label::after {
    content: ' *';
    color: var(--error-color);
}

/* Modern Input */
.modern-input {
    width: 100%;
    padding: 16px 48px 16px 16px;
    border-radius: var(--radius-md);
    border: 2px solid var(--neutral-300);
    font-size: 1rem;
    background: white;
    transition: all 0.3s ease;
}

.modern-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(33, 171, 167, 0.1);
    transform: translateY(-1px);
}

.modern-input:hover:not(:focus) {
    border-color: var(--neutral-400);
}

.modern-input.error {
    border-color: var(--error-color);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.modern-input.success {
    border-color: var(--success-color);
}

/* Input with Icon */
.input-with-icon {
    position: relative;
}

.input-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--neutral-400);
    font-size: 1.25rem;
}

/* Textarea */
.modern-textarea {
    min-height: 120px;
    resize: vertical;
    padding: 16px;
    line-height: 1.6;
}

/* Select */
.modern-select {
    appearance: none;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6,9 12,15 18,9"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 48px;
}

/* Validation Message */
.validation-message {
    font-size: 0.875rem;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.validation-message.error {
    color: var(--error-color);
}

.validation-message.success {
    color: var(--success-color);
}

/* Checkbox and Radio */
.checkbox-group, .radio-group {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.checkbox-item, .radio-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: white;
    border: 2px solid var(--neutral-300);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.checkbox-item:hover, .radio-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.checkbox-item.checked, .radio-item.checked {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.checkbox-item input, .radio-item input {
    width: 20px;
    height: 20px;
    margin: 0;
}

.checkbox-item label, .radio-item label {
    margin: 0;
    font-weight: 500;
    cursor: pointer;
}

/* Button Container */
.btn-container {
    text-align: center;
    margin-top: 40px;
    padding: 32px;
    background: var(--neutral-50);
    border-top: 1px solid var(--neutral-200);
}

.btn-container.full-width {
    grid-column: 1 / -1;
    margin-top: 0;
}

/* Button Styles */
.btn {
    padding: 16px 32px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--neutral-200);
    color: var(--neutral-700);
}

.btn-secondary:hover {
    background: var(--neutral-300);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--error-color), #dc2626);
    color: white;
}

.btn.processing {
    opacity: 0.8;
    cursor: not-allowed;
    transform: none !important;
}

.btn-icon {
    font-size: 1.25rem;
}

/* Toast Container */
.toast-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.toast {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.toast.show {
    opacity: 1;
    transform: scale(1);
}

.toast.hide {
    opacity: 0;
    transform: scale(0.8);
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.toast.error .toast-icon {
    background-color: #fef2f2;
    color: #dc2626;
}

.toast.success .toast-icon {
    background-color: #f0fdf4;
    color: #16a34a;
}

.toast.warning .toast-icon {
    background-color: #fffbeb;
    color: #d97706;
}

.toast.info .toast-icon {
    background-color: #ecfdf5;
    color: #21aba7;
}

.toast-content {
    flex: 1;
    color: #374151;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

/* Image Upload */
.image-upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.image-upload-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-upload-box {
    width: 100%;
    height: 160px;
    border: 3px dashed var(--neutral-300);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff 0%, var(--neutral-50) 100%);
}

.image-upload-box:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-light) 0%, #ffffff 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.image-upload-box.drag-over {
    border-color: var(--success-color);
    background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%);
    transform: scale(1.02);
}

.image-upload-box.has-image {
    border-style: solid;
    border-color: var(--success-color);
    padding: 8px;
}

.image-upload-box input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 16px;
    text-align: center;
}

.image-upload-icon {
    font-size: 2.5rem;
    color: var(--neutral-400);
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.image-upload-box:hover .image-upload-icon {
    color: var(--primary-color);
    transform: scale(1.1);
}

.image-upload-text {
    font-size: 0.875rem;
    color: var(--neutral-600);
    line-height: 1.4;
    font-weight: 500;
}

.image-upload-subtext {
    font-size: 0.75rem;
    color: var(--neutral-400);
    margin-top: 4px;
}

.image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
    transition: transform 0.3s ease;
}

.image-upload-box.has-image:hover .image-preview {
    transform: scale(1.05);
}

.image-upload-label {
    font-size: 0.875rem;
    color: var(--neutral-700);
    margin-top: 12px;
    font-weight: 600;
    text-align: center;
}

.image-delete-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(239, 68, 68, 0.95);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.image-delete-btn:hover {
    background: var(--error-color);
    transform: scale(1.1) rotate(90deg);
}

.image-upload-box.has-image .image-delete-btn {
    display: flex;
}

/* Progress Bar */
.form-progress {
    position: sticky;
    top: 0;
    background: white;
    padding: 16px 40px;
    border-bottom: 1px solid var(--neutral-200);
    z-index: 100;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--neutral-200);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 3px;
}

.progress-text {
    text-align: center;
    font-size: 0.875rem;
    color: var(--neutral-600);
    margin-top: 8px;
}

/* Error Page */
.error-page {
    text-align: center;
    padding: 60px 20px;
}

.error-page h1 {
    font-size: 2rem;
    color: var(--error-color);
    margin-bottom: 16px;
}

.error-page p {
    color: var(--neutral-500);
    margin-bottom: 24px;
}

/* Table Styles */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-success {
    background: #d4edda;
    color: #155724;
}

.status-warning {
    background: #fff3cd;
    color: #856404;
}

.status-danger {
    background: #f8d7da;
    color: #721c24;
}

/* Alert */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Card */
.card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--neutral-200);
}

.card-header {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--neutral-200);
}

/* Grid Layout */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Responsive */
@media (max-width: 1200px) {
    .form-container {
        gap: 24px;
        padding: 32px;
    }

    .form-section {
        padding: 28px;
    }
}

@media (max-width: 1024px) {
    .main-content {
        padding: 20px;
    }

    .form-container {
        padding: 24px;
        gap: 20px;
    }

    .form-section {
        padding: 24px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .header {
        padding: 16px 20px;
    }

    .header-right {
        gap: 20px;
    }

    .header .main-nav ul {
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }

    .form-header {
        padding: 24px 20px;
    }

    .form-header h1 {
        font-size: 1.5rem;
    }

    .form-container {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 24px;
    }

    .form-column {
        gap: 24px;
    }

    .form-section {
        padding: 20px;
    }

    .form-section.full-width {
        grid-column: 1;
    }

    .section-header {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }

    .section-icon {
        margin-right: 0;
    }

    .checkbox-group, .radio-group {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .header {
        flex-direction: column;
        gap: 16px;
        padding: 12px 16px;
    }

    .header-right {
        flex-direction: column;
        gap: 16px;
        width: 100%;
    }

    .header .main-nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }

    .footer {
        flex-direction: column;
        gap: 16px;
        text-align: center;
        padding: 20px;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--neutral-200);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--neutral-200) 25%, var(--neutral-100) 50%, var(--neutral-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--neutral-100);
}

::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-400);
}
