/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #242424;
    --bg-hover: #2a2a2a;
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --text-muted: #666;
    --accent: #4a9eff;
    --accent-hover: #6bb3ff;
    --success: #4ade80;
    --error: #f87171;
    --border: #333;
    --radius: 8px;
    --radius-lg: 12px;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.results-container {
    max-width: 1400px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.results-container header {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

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

/* Main content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
}

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

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-small:hover {
    background: var(--bg-hover);
}

/* Upload area */
.upload-area {
    width: 100%;
    max-width: 600px;
    aspect-ratio: 4/3;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.upload-content {
    text-align: center;
    padding: 2rem;
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.upload-text {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.upload-subtext {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.upload-formats {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Preview area */
.preview-area {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

#previewImage {
    max-width: 100%;
    max-height: 500px;
    border-radius: var(--radius-lg);
    object-fit: contain;
}

.preview-actions {
    display: flex;
    gap: 1rem;
}

/* Intent/description field */
.intent-field {
    width: 100%;
    max-width: 600px;
    margin-bottom: 1.5rem;
}

.intent-field label {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.intent-field .optional-label {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.85rem;
}

.intent-field textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.2s;
}

.intent-field textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.intent-field textarea::placeholder {
    color: var(--text-muted);
}

.intent-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    line-height: 1.4;
}

/* Loading area */
.loading-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    gap: 1.5rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 1.25rem;
    font-weight: 500;
}

.loading-subtext {
    color: var(--text-secondary);
}

/* Error area */
.error-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 3rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--error);
}

.error-text {
    color: var(--error);
    font-size: 1.1rem;
}

/* Results page */
section {
    width: 100%;
    margin-bottom: 3rem;
}

section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* Original image section */
.original-section {
    text-align: center;
}

.original-image-wrap {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.original-image {
    max-width: 100%;
    max-height: 500px;
    border-radius: var(--radius-lg);
    transition: opacity 0.2s;
}

.original-image:hover {
    opacity: 0.9;
}

.score-badge {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 600;
}

/* Crops grid */
.crops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.crop-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.2s, border-color 0.2s;
}

.crop-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.crop-image-wrap {
    position: relative;
    cursor: pointer;
    aspect-ratio: 4/3;
    overflow: hidden;
}

.crop-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.crop-card:hover .crop-image {
    transform: scale(1.02);
}

.crop-rank {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: var(--accent);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.crop-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.crop-score {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.score-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.score-diff {
    font-size: 0.9rem;
    font-weight: 600;
}

.score-diff.positive {
    color: var(--success);
}

.score-diff.negative {
    color: var(--error);
}

.crop-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Analysis section */
.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.analysis-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.analysis-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.analysis-card p {
    color: var(--text-primary);
    line-height: 1.7;
}

.analysis-card.highlight {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--bg-secondary), rgba(74, 158, 255, 0.1));
}

.analysis-card.highlight h3 {
    color: var(--accent);
}

/* Actions section */
.actions-section {
    text-align: center;
    padding: 2rem 0;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

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

.modal-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#modalImage {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius);
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--accent);
}

.modal-actions {
    display: flex;
    gap: 1rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--accent);
}

footer p {
    margin: 0.25rem 0;
}

.results-footer {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.privacy-note {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

/* How It Works Section */
.how-it-works {
    width: 100%;
    max-width: 900px;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.how-it-works h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.step {
    text-align: center;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    margin: 0 auto 0.75rem;
}

.step h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.step p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.how-it-works-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

@media (max-width: 768px) {
    .steps-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.25rem;
    }
}

@media (max-width: 480px) {
    .steps-grid {
        grid-template-columns: 1fr;
    }
}

/* No Improvements State */
.no-improvements-section {
    margin-bottom: 2rem;
}

.no-improvements-card {
    background: var(--bg-secondary);
    border: 1px solid var(--success);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

.no-improvements-image-wrap {
    cursor: pointer;
    border-radius: var(--radius);
    overflow: hidden;
}

.no-improvements-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s;
}

.no-improvements-image-wrap:hover .no-improvements-image {
    transform: scale(1.02);
}

.no-improvements-content h2 {
    color: var(--success);
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.no-improvements-score {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.no-improvements-score strong {
    color: var(--text-primary);
    font-size: 1.5rem;
}

.no-improvements-text {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.no-improvements-tips {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.no-improvements-tips h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.no-improvements-tips ul {
    list-style: none;
    padding: 0;
}

.no-improvements-tips li {
    color: var(--text-primary);
    padding: 0.25rem 0;
    padding-left: 1.25rem;
    position: relative;
}

.no-improvements-tips li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .no-improvements-card {
        grid-template-columns: 1fr;
    }
}

/* ===========================================
   LOGIN PAGE LAYOUT
   =========================================== */

.login-main {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 4rem;
    align-items: start;
    width: 100%;
    max-width: 1000px;
}

.login-left {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.login-right {
    position: sticky;
    top: 2rem;
}

/* Pitch section */
.pitch {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pitch-lead {
    font-size: 1.15rem;
    color: var(--text-primary);
    line-height: 1.7;
}

.pitch p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Who for / When to use sections */
.who-for,
.when-use {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.who-for h3,
.when-use h3 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.who-for p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.when-use ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.when-use li {
    color: var(--text-secondary);
    padding-left: 1.25rem;
    position: relative;
    line-height: 1.5;
}

.when-use li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 850px) {
    .login-main {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .login-right {
        position: static;
        order: -1;
    }

    .login-card {
        max-width: 100%;
    }
}

/* Login page */
.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
    margin-bottom: 3rem;
}

.login-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-desc {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    text-align: left;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.btn-full {
    width: 100%;
}

.login-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.login-note {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Features grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 800px;
}

.feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
}

.feature-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    color: var(--accent);
}

.feature-icon svg {
    width: 100%;
    height: 100%;
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* User info in header */
.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.user-email {
    color: var(--text-primary);
}

.logout-link {
    color: var(--text-muted);
    text-decoration: none;
}

.logout-link:hover {
    color: var(--text-primary);
}

/* New Results Layout - Before/After Comparison */
.comparison-section {
    margin-bottom: 3rem;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.comparison-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comparison-card.best {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--bg-secondary), rgba(74, 158, 255, 0.05));
}

.comparison-label {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.comparison-card.best .comparison-label {
    color: var(--accent);
}

.comparison-image-wrap {
    cursor: pointer;
    border-radius: var(--radius);
    overflow: hidden;
}

.comparison-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s;
}

.comparison-image-wrap:hover .comparison-image {
    transform: scale(1.02);
}

.comparison-score {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.comparison-score .score-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.comparison-score .score-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.comparison-desc {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.comparison-reasoning {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

/* New Analysis Layout */
.analysis-grid-new {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.analysis-main {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.analysis-card-new {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.analysis-card-new h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.analysis-card-new p {
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.analysis-highlight {
    background: linear-gradient(135deg, var(--bg-secondary), rgba(74, 158, 255, 0.1));
    border: 1px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.analysis-highlight h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.analysis-highlight p {
    color: var(--text-primary);
    line-height: 1.7;
}

/* Alternatives Section */
.alternatives-section {
    margin-bottom: 2rem;
}

.section-desc {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.alternatives-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.alt-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.2s;
}

.alt-card:hover {
    border-color: var(--text-muted);
}

.alt-image-wrap {
    cursor: pointer;
    aspect-ratio: 4/3;
    overflow: hidden;
}

.alt-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.alt-card:hover .alt-image {
    transform: scale(1.03);
}

.alt-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alt-score {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.alt-score .score-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.alt-desc {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Scene Overview Section */
.scene-overview {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.scene-overview p {
    color: var(--text-primary);
    font-size: 1.05rem;
    line-height: 1.7;
    font-style: italic;
}

/* Category and Aspect Badges */
.category-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.category-badge.refinement {
    background: rgba(74, 158, 255, 0.2);
    color: #4a9eff;
}

.category-badge.rebalancing {
    background: rgba(255, 159, 74, 0.2);
    color: #ff9f4a;
}

.category-badge.extraction {
    background: rgba(159, 74, 255, 0.2);
    color: #9f4aff;
}

.aspect-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.alt-badges {
    padding: 0.75rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Enhanced comparison card details */
.comparison-principle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.comparison-tradeoffs {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.recommendation-rationale {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.recommendation-rationale strong {
    color: var(--text-primary);
}

/* Enhanced Analysis Cards */
.analysis-card-new.strengths {
    border-color: rgba(74, 222, 128, 0.3);
}

.analysis-card-new.strengths h3 {
    color: var(--success);
}

.analysis-card-new.opportunities {
    border-color: rgba(255, 159, 74, 0.3);
}

.analysis-card-new.opportunities h3 {
    color: #ff9f4a;
}

.analysis-card-new.horizon {
    border-color: rgba(159, 74, 255, 0.3);
}

.analysis-card-new.horizon h3 {
    color: #9f4aff;
}

.analysis-card-new.alternatives {
    border-color: var(--border);
}

.analysis-card-new ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.analysis-card-new li {
    padding: 0.5rem 0;
    padding-left: 1.25rem;
    position: relative;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
    border-bottom: 1px solid var(--border);
}

.analysis-card-new li:last-child {
    border-bottom: none;
}

.analysis-card-new li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

.opp-principle {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.opp-solution {
    display: block;
    color: var(--accent);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Alt card principle */
.alt-principle {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Movement Suggestions Section */
.movement-section {
    margin-bottom: 2rem;
}

.movement-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.movement-card p {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.movement-card p:last-of-type {
    margin-bottom: 0;
}

.movement-card strong {
    color: var(--text-secondary);
}

.difficulty-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 1rem;
}

.difficulty-badge.easy {
    background: rgba(74, 222, 128, 0.2);
    color: var(--success);
}

.difficulty-badge.moderate {
    background: rgba(255, 159, 74, 0.2);
    color: #ff9f4a;
}

.difficulty-badge.advanced {
    background: rgba(248, 113, 113, 0.2);
    color: var(--error);
}

/* Learning Moment Section */
.learning-section {
    margin-bottom: 2rem;
}

.learning-card {
    background: linear-gradient(135deg, var(--bg-secondary), rgba(74, 158, 255, 0.08));
    border: 1px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

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

.learning-card h3::before {
    content: "💡";
}

.learning-card p {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.7;
}

/* ===========================================
   NEW RESULTS PAGE LAYOUT
   =========================================== */

/* Scene subtitle - subtle description */
.scene-subtitle {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    text-align: center;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Hero Before/After Comparison */
.hero-comparison {
    margin-bottom: 2rem;
    width: 100%;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: stretch;
    width: 100%;
}

.hero-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0; /* Prevent grid blowout */
}

.hero-card .hero-image-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-card .hero-image {
    max-height: 100%;
    object-fit: contain;
}

.hero-card.best {
    border-color: var(--accent);
}

.hero-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.hero-image-wrap {
    cursor: pointer;
    border-radius: var(--radius);
    overflow: hidden;
}

.hero-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s;
    max-width: 100%;
}

.hero-image-wrap:hover .hero-image {
    transform: scale(1.02);
}

.hero-caption {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.hero-caption strong {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.hero-principle {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Other Crops - Grid */
.other-crops {
    margin-bottom: 2.5rem;
}

.other-crops h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}

.crops-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.crop-thumb {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    transition: border-color 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}

.crop-thumb:hover {
    border-color: var(--text-muted);
    transform: translateY(-2px);
}

.thumb-badges {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    gap: 0.35rem;
    z-index: 2;
}

.category-badge.small {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
}

.aspect-badge.small {
    font-size: 0.65rem;
    padding: 0.2rem 0.45rem;
}

.thumb-image-wrap {
    cursor: pointer;
    overflow: hidden;
}

.crop-thumb img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s;
}

.thumb-image-wrap:hover img {
    transform: scale(1.03);
}

.thumb-overlay {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.thumb-overlay span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
}

.btn-download {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    text-align: center;
    transition: background 0.2s;
    margin-top: auto;
}

.btn-download:hover {
    background: var(--bg-hover);
}

/* Education Section with Tabs */
.education-section {
    margin-bottom: 2rem;
}

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Analysis Tab Content */
.analysis-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.analysis-col {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.analysis-col h4 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.75rem;
}

.analysis-col.strengths {
    border-color: rgba(74, 222, 128, 0.3);
}

.analysis-col.strengths h4 {
    color: var(--success);
}

.analysis-col.opportunities {
    border-color: rgba(255, 159, 74, 0.3);
}

.analysis-col.opportunities h4 {
    color: #ff9f4a;
}

.analysis-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.analysis-col li {
    padding: 0.5rem 0;
    padding-left: 1rem;
    position: relative;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
    border-bottom: 1px solid var(--border);
}

.analysis-col li:last-child {
    border-bottom: none;
}

.analysis-col li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

.analysis-col li .solution {
    display: block;
    color: var(--accent);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.why-crop {
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.why-crop strong {
    color: var(--accent);
}

/* Tips Tab Content */
.tip-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.tip-card:last-child {
    margin-bottom: 0;
}

.tip-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.tip-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.tip-card p:last-of-type {
    margin-bottom: 0;
}

.tip-card strong {
    color: var(--text-muted);
}

.tip-card.learning {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--bg-secondary), rgba(74, 158, 255, 0.05));
}

.tip-card.learning h4 {
    color: var(--accent);
}

.tip-card.learning h4::before {
    content: "💡 ";
}

.tip-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tip-card li {
    padding: 0.4rem 0;
    padding-left: 1rem;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.tip-card li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

/* No Crops State */
.no-crops-hero {
    margin-bottom: 2rem;
}

.no-crops-card {
    background: var(--bg-secondary);
    border: 1px solid var(--success);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

.no-crops-image-wrap {
    cursor: pointer;
    border-radius: var(--radius);
    overflow: hidden;
}

.no-crops-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s;
}

.no-crops-image-wrap:hover .no-crops-image {
    transform: scale(1.02);
}

.no-crops-content h2 {
    color: var(--success);
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.no-crops-content p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Empty state */
.empty-state {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

/* ===========================================
   CROP TABS LAYOUT
   =========================================== */

.crop-tabs-section {
    margin-bottom: 2.5rem;
}

/* Tab bar */
.crop-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.crop-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: 2px solid transparent;
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: 100px;
}

.crop-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.crop-tab.active {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    color: var(--text-primary);
}

.crop-tab.recommended .tab-label {
    color: var(--accent);
    font-weight: 600;
}

.crop-tab.recommended.active {
    background: linear-gradient(135deg, var(--bg-tertiary), rgba(74, 158, 255, 0.1));
}

.tab-label {
    font-size: 0.9rem;
    font-weight: 500;
}

.tab-aspect {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Panels */
.crop-panels {
    position: relative;
}

.crop-panel {
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.crop-panel.active {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 0;
}

.panel-image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--bg-primary);
    min-height: 400px;
    max-height: 70vh;
}

.panel-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: pointer;
    border-radius: var(--radius);
    transition: transform 0.3s;
}

.panel-image:hover {
    transform: scale(1.02);
}

.panel-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-left: 1px solid var(--border);
    background: var(--bg-secondary);
}

.panel-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.recommended-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(74, 158, 255, 0.2);
    color: var(--accent);
}

.panel-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.panel-info .principle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.panel-info .reasoning {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.panel-info .tradeoffs {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.panel-info .subject-note {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 0.75rem;
    background: rgba(255, 159, 74, 0.1);
    border-left: 3px solid #ff9f4a;
    border-radius: var(--radius);
}

.panel-info .subject-note strong {
    color: #ff9f4a;
}

.panel-info .btn {
    margin-top: auto;
}

/* Responsive crop tabs */
@media (max-width: 900px) {
    .crop-panel.active {
        grid-template-columns: 1fr;
    }

    .panel-info {
        border-left: none;
        border-top: 1px solid var(--border);
    }

    .panel-image-container {
        min-height: 300px;
        max-height: 50vh;
    }
}

@media (max-width: 600px) {
    .crop-tabs {
        gap: 0.25rem;
        padding: 0.35rem;
    }

    .crop-tab {
        padding: 0.5rem 0.75rem;
        min-width: 80px;
    }

    .tab-label {
        font-size: 0.8rem;
    }

    .panel-image-container {
        min-height: 250px;
        padding: 1rem;
    }

    .panel-info {
        padding: 1rem;
    }
}

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .hero-card {
        max-width: 100%;
    }

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

    .no-crops-card {
        grid-template-columns: 1fr;
    }

    .crops-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .crops-row {
        grid-template-columns: 1fr;
    }
}

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

    h1 {
        font-size: 1.5rem;
    }

    .results-container header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .upload-area {
        aspect-ratio: 1;
    }

    .crops-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .tabs {
        justify-content: center;
    }

    .tab {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}
