:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #6366f1;
    --primary-bg: rgba(79, 70, 229, 0.08);
    --success: #059669;
    --success-light: #d1fae5;
    --success-bg: rgba(5, 150, 105, 0.08);
    --warning: #d97706;
    --warning-light: #fef3c7;
    --warning-bg: rgba(217, 119, 6, 0.08);
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --danger-bg: rgba(220, 38, 38, 0.08);
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    color: var(--primary);
    background: var(--primary-bg);
    padding: 6px;
    border-radius: var(--radius);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.01em;
}

.version {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-bg);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.main-content {
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    width: 100%;
}

.upload-section {
    margin-bottom: 2.5rem;
}

.upload-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--gray-100);
}

.upload-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.upload-description {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--gray-50);
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.upload-area.drag-over {
    border-color: var(--primary);
    background: var(--primary-bg);
    transform: scale(1.01);
}

.upload-area.has-image {
    border: none;
    background: var(--white);
    padding: 0;
    cursor: default;
    box-shadow: none;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--gray-400);
}

.upload-text {
    font-weight: 500;
    color: var(--gray-700);
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--gray-400);
}

.image-preview {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.image-preview-container {
    position: relative;
    display: inline-block;
    background: linear-gradient(145deg, #f8fafc, #e2e8f0);
    padding: 0.75rem;
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
}

.image-preview img {
    max-width: 100%;
    max-height: 320px;
    border-radius: var(--radius-lg);
    object-fit: contain;
    display: block;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.image-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.change-image-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
}

.change-image-btn:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.change-image-btn svg {
    width: 16px;
    height: 16px;
}

.remove-image-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--danger-light);
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--danger);
    cursor: pointer;
    transition: all 0.2s ease;
}

.remove-image-btn:hover {
    background: #fecaca;
}

.remove-image-btn svg {
    width: 16px;
    height: 16px;
}

.image-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    font-size: 0.8125rem;
    color: var(--gray-500);
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.image-info span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.image-info svg {
    width: 14px;
    height: 14px;
    color: var(--gray-400);
}

.image-preview {
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.context-section {
    margin-top: 1.5rem;
}

.context-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-600);
    padding: 0.5rem;
    margin-left: -0.5rem;
    transition: color 0.2s ease;
}

.context-toggle:hover {
    color: var(--primary);
}

.chevron-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.context-toggle.expanded .chevron-icon {
    transform: rotate(180deg);
}

.context-form {
    margin-top: 1rem;
    padding: 1.5rem;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--white);
}

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

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

.evaluate-btn {
    width: 100%;
    margin-top: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.evaluate-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.evaluate-btn:active:not(:disabled) {
    transform: translateY(0);
}

.evaluate-btn:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.results-section {
    position: relative;
    margin-top: 2rem;
    padding-top: 2rem;
}

.section-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--gray-300), transparent);
}

.section-divider-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    white-space: nowrap;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.loading-subtext {
    color: var(--gray-500);
}

.final-evaluation {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
    border: 1px solid var(--gray-100);
    animation: fadeInUp 0.4s ease;
}

.final-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    flex-wrap: wrap;
    gap: 1rem;
}

.final-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.score-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--gray-800);
    color: var(--white);
    padding: 1.25rem 1.75rem;
    border-radius: var(--radius-xl);
    min-width: 130px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.score-badge.good {
    background: var(--success);
}

.score-badge.improvement {
    background: var(--warning);
}

.score-badge.poor {
    background: var(--danger);
}

.score-symbol {
    font-size: 1.75rem;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.score-value {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}

.score-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.final-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.final-card {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
}

.final-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 1rem;
}

.final-card h3 svg {
    width: 18px;
    height: 18px;
}

.issues-card h3 {
    color: var(--danger);
}

.improvements-card h3 {
    color: var(--success);
}

.final-card ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.final-card li {
    font-size: 0.875rem;
    color: var(--gray-700);
    padding-left: 1.25rem;
    position: relative;
}

.final-card li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gray-400);
}

.issues-card li::before {
    background: var(--danger);
}

.improvements-card li::before {
    background: var(--success);
}

.experts-section {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
    border: 1px solid var(--gray-100);
    animation: fadeInUp 0.5s ease;
}

.experts-section h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1.25rem;
}

.experts-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0.5rem;
}

.expert-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1rem;
    background: var(--gray-50);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.expert-tab:hover {
    background: var(--gray-100);
}

.expert-tab.active {
    background: var(--white);
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.tab-icon {
    font-size: 1.5rem;
}

.tab-title {
    font-weight: 600;
    color: var(--gray-800);
}

.tab-subtitle {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.expert-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.expert-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.expert-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--gray-50), var(--gray-100));
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}

.expert-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.expert-icon {
    font-size: 2.5rem;
}

.expert-info h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.125rem;
}

.expert-info p {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.expert-score {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.score-num {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.score-max {
    font-size: 1rem;
    color: var(--gray-400);
}

.expert-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.expert-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gray-100);
}

.comments-list,
.suggestions-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.comments-list li,
.suggestions-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    border-left: 3px solid var(--gray-300);
}

.comments-list li::before {
    content: '•';
    color: var(--primary);
    font-weight: bold;
    flex-shrink: 0;
}

.suggestions-list li::before {
    content: '→';
    color: var(--success);
    font-weight: bold;
    flex-shrink: 0;
}

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

.defect-card {
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.defect-card.severity-none {
    border-left: 4px solid var(--success);
}

.defect-card.severity-minor {
    border-left: 4px solid var(--warning);
    background: var(--warning-light);
}

.defect-card.severity-moderate {
    border-left: 4px solid #f97316;
    background: #fff7ed;
}

.defect-card.severity-severe {
    border-left: 4px solid var(--danger);
    background: var(--danger-light);
}

.defect-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.defect-type {
    font-weight: 600;
    color: var(--gray-800);
    text-transform: capitalize;
}

.defect-severity {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    text-transform: uppercase;
}

.severity-none .defect-severity {
    background: var(--success);
    color: var(--white);
}

.severity-minor .defect-severity {
    background: var(--warning);
    color: var(--white);
}

.severity-moderate .defect-severity {
    background: #f97316;
    color: var(--white);
}

.severity-severe .defect-severity {
    background: var(--danger);
    color: var(--white);
}

.defect-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8125rem;
    color: var(--gray-600);
}

.defect-confidence {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.confidence-bar {
    flex: 1;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
}

.defect-evidence {
    font-style: italic;
    color: var(--gray-500);
}

.no-defects {
    text-align: center;
    padding: 2rem;
    color: var(--gray-500);
    background: var(--gray-50);
    border-radius: var(--radius);
}

.new-evaluation-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    background: var(--gray-800);
    color: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.new-evaluation-btn:hover {
    background: var(--gray-900);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.new-evaluation-btn svg {
    width: 20px;
    height: 20px;
}

.footer {
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    padding: 1rem;
    text-align: center;
}

.footer p {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--gray-900);
    color: var(--white);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 300;
}

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

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

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

@media (max-width: 768px) {
    .header-content {
        padding: 0.75rem 1rem;
    }

    .logo h1 {
        font-size: 1rem;
    }

    .main-content {
        padding: 1.25rem 1rem;
    }

    .upload-section {
        margin-bottom: 1.5rem;
    }

    .upload-card,
    .final-evaluation,
    .experts-section {
        padding: 1.25rem;
    }

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

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

    .final-details {
        grid-template-columns: 1fr;
    }

    .final-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .score-badge {
        align-self: flex-end;
    }

    .experts-tabs {
        flex-direction: column;
    }

    .expert-tab {
        flex-direction: row;
        justify-content: flex-start;
        gap: 1rem;
        padding: 0.75rem 1rem;
    }

    .expert-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .expert-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

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

    .image-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .change-image-btn,
    .remove-image-btn {
        width: 100%;
        justify-content: center;
    }
}
