:root {
    --color-primary: #2d6a4f;
    --color-primary-hover: #1b4332;
    --color-bg: #f8f9fa;
    --color-card: #ffffff;
    --color-text: #212529;
    --color-text-muted: #6c757d;
    --color-border: #dee2e6;
    --color-success: #2d6a4f;
    --color-warning: #e9a820;
    --color-danger: #c1121f;
    --radius: 8px;
}

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

[hidden] {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

.container {
    max-width: 640px;
    margin: 2rem auto;
    padding: 0 1rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    color: var(--color-primary);
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.input-section {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.culture-select {
    margin-bottom: 1rem;
}

.culture-select label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.culture-select select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--color-primary);
    background: #f0fdf4;
}

.upload-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.upload-placeholder p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.photo-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.thumb-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}

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

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

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

.btn-secondary {
    background: var(--color-border);
    color: var(--color-text);
    margin-top: 1rem;
}

.btn-confirm {
    background: var(--color-success);
    color: white;
    width: 48%;
}

.btn-reject {
    background: var(--color-danger);
    color: white;
    width: 48%;
}

.results-section {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.status-message {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.status-message.confirmed {
    color: var(--color-success);
    font-weight: 600;
}

.status-message.confirm-needed {
    color: var(--color-warning);
    font-weight: 600;
}

.status-message.rejected {
    color: var(--color-danger);
}

.confirmation-zone {
    margin-bottom: 1rem;
}

.confirm-card {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f0fdf4;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.reference-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.confirm-species {
    font-size: 0.9rem;
    color: var(--color-text);
}

.confirm-buttons {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.conversation-zone {
    display: flex;
    flex-direction: column;
}

.conversation-scroll {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.conversation-scroll .recommendation-text,
.conversation-scroll .chat-msg {
    line-height: 1.7;
    font-size: 0.95rem;
}

.recommendation-text h3,
.recommendation-text h4 {
    color: var(--color-primary);
    margin: 1rem 0 0.5rem;
    font-size: 1.05rem;
}

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

.recommendation-text .rec-item {
    background: #f0fdf4;
    border-left: 3px solid var(--color-primary);
    padding: 0.5rem 0.75rem;
    margin: 0.75rem 0 0.25rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-weight: 600;
}

.recommendation-text .rec-num {
    color: var(--color-primary);
    font-weight: 700;
    margin-right: 0.25rem;
}

.recommendation-text .rec-detail {
    padding: 0.15rem 0 0.15rem 1.5rem;
    color: var(--color-text);
}

.recommendation-text em {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.mention-legale {
    margin-top: 1rem;
    padding: 0.75rem;
    font-size: 0.8rem;
    color: #666;
    border-left: 3px solid #e9a820;
    background: #fdf8ec;
    font-style: italic;
}

.chat-msg {
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.chat-msg.user {
    background: #e8f5e9;
    margin-left: 20%;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    border-top: none;
    color: var(--color-text);
    font-size: 0.95rem;
}

.chat-input-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.chat-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.chat-send {
    width: auto;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--color-text-muted);
}

.chat-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--color-text-muted);
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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