/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    /* Enterprise Color Palette */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #f8fafc;
    --secondary-hover: #e2e8f0;
    --accent-color: #8b5cf6;
    --accent-hover: #7c3aed;
    --danger-color: #ef4444;
    
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #cbd5e1;
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --transition-fast: 0.15s ease-in-out;
    --transition-normal: 0.3s ease;
}

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

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

/* Animations */
@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* Layout */
.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
    animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 12px 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.logo-icon {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 24px;
    margin-bottom: 24px;
    transition: box-shadow var(--transition-normal);
}

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

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background-color: #fff;
    transition: all var(--transition-fast);
    outline: none;
    color: var(--text-main);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea.form-control {
    height: 180px;
    resize: vertical;
    line-height: 1.5;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
}

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

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

.btn-accent {
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.2);
}

.btn-accent:hover:not(:disabled) {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 6px rgba(139, 92, 246, 0.3);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background-color: var(--secondary-color);
    border-color: #94a3b8;
}

.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 1.05rem;
}

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

/* Action Area Grid */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

/* Image Grid */
.image-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    min-height: 120px;
    background: var(--secondary-color);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    align-items: center;
    justify-content: flex-start;
}

.empty-state {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 8px;
}

.empty-state .icon {
    font-size: 2rem;
    opacity: 0.5;
}

.preview-item {
    position: relative;
    width: 110px;
    height: 110px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: #fff;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.preview-item:hover img {
    transform: scale(1.05);
}

.btn-preview-img {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
    transition: all 0.2s;
    backdrop-filter: blur(2px);
}

.btn-preview-img:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.btn-delete-img {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
    transition: all 0.2s;
    backdrop-filter: blur(2px);
}

.btn-delete-img:hover {
    background: var(--danger-color);
    transform: scale(1.1);
}

/* Image Status Overlays */
.preview-item.status-nameplate {
    border: 3px solid #3b82f6; /* Blue */
}
.preview-item.status-nameplate::after {
    content: "车辆铭牌";
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: rgba(59, 130, 246, 0.9);
    color: white;
    font-size: 11px;
    text-align: center;
    padding: 2px 0;
    z-index: 5;
}

.preview-item.status-dealer {
    border: 3px solid #ef4444; /* Red */
}
.preview-item.status-dealer::after {
    content: "存在经销商信息";
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    font-size: 11px;
    text-align: center;
    padding: 2px 0;
    z-index: 5;
}

.preview-item.status-valid {
    border: 3px solid #10b981; /* Green */
}
.preview-item.status-valid::after {
    content: "合格车辆照片";
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: rgba(16, 185, 129, 0.9);
    color: white;
    font-size: 11px;
    text-align: center;
    padding: 2px 0;
    z-index: 5;
}

.preview-item.status-unknown {
    border: 3px solid #9ca3af; /* Gray */
}
.preview-item.status-unknown::after {
    content: "疑似无关信息";
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: rgba(156, 163, 175, 0.9);
    color: white;
    font-size: 11px;
    text-align: center;
    padding: 2px 0;
    z-index: 5;
}

.preview-item.status-processing::after {
    content: "AI识别中...";
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 11px;
    text-align: center;
    padding: 2px 0;
    z-index: 5;
}

.preview-item.status-generating {
    border: 3px solid #8b5cf6; /* Purple */
    animation: pulse-border 1.5s infinite;
}
.preview-item.status-generating img {
    opacity: 0.6;
    filter: grayscale(30%) blur(1px);
}
.preview-item.status-generating::after {
    content: "豆包生图中...";
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: rgba(139, 92, 246, 0.9);
    color: white;
    font-size: 11px;
    text-align: center;
    padding: 2px 0;
    z-index: 5;
}

@keyframes pulse-border {
    0% { border-color: rgba(139, 92, 246, 0.4); }
    50% { border-color: rgba(139, 92, 246, 1); }
    100% { border-color: rgba(139, 92, 246, 0.4); }
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 8px;
    background-color: var(--secondary-hover);
    border-radius: 4px;
    margin-top: 16px;
    overflow: hidden;
    display: none;
}

.progress-container.active {
    display: block;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
    display: none;
}

.progress-text.active {
    display: block;
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    padding: 32px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal:not(.hidden) .modal-content {
    transform: translateY(0) scale(1);
}

.modal h2 {
    font-size: 1.25rem;
    margin-bottom: 24px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 24px;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-main);
}

/* Contact Items */
.contact-item {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    animation: fadeIn 0.3s;
}

.contact-item .form-control {
    margin-bottom: 0;
}

.btn-remove-contact {
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    color: var(--danger-color);
    border-radius: var(--radius-sm);
    width: 42px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.btn-remove-contact:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

/* Preset List */
.preset-list-container {
    margin-top: 32px;
}

.preset-list-container h3 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

#preset-ul {
    list-style: none;
}

#preset-ul li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

#preset-ul li:hover {
    border-color: var(--primary-color);
}

.preset-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.preset-name {
    font-weight: 600;
    color: var(--text-main);
}

.preset-tags {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-del-preset {
    background: transparent;
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-del-preset:hover {
    background: var(--danger-color);
    color: white;
}

.hidden {
    display: none !important;
}

/* Mobile Adjustments */
@media (max-width: 640px) {
    .app-container {
        padding: 16px;
    }
    
    .action-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        padding: 24px;
        width: 95%;
    }
}
