/* ─── DESIGN TOKENS ──────────────────────────────────────────────────────── */
:root {
    --amber:        #F5A623;
    --amber-dark:   #E08C0A;
    --amber-light:  #FFF3DC;
    --amber-glow:   rgba(245, 166, 35, 0.25);
    --bg:           #FAFAF8;
    --white:        #FFFFFF;
    --surface:      #F9FAFB;
    --text:         #1A1A1A;
    --text-muted:   #666666;
    --border:       #E8E8E4;
    --error-bg:     #FFF0F0;
    --error-border: #FFCCCC;
    --error-text:   #CC0000;
    --shadow-sm:    0 2px 8px rgba(0, 0, 0, 0.07);
    --shadow-md:    0 8px 32px rgba(0, 0, 0, 0.10);
    --radius-sm:    8px;
    --radius-md:    16px;
    --radius-lg:    24px;
    --transition:   0.25s ease;
}

/* ─── RESET ──────────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 32px;
    line-height: 1.5;
}

/* ─── AD CONTAINERS ──────────────────────────────────────────────────────── */
.ad-container {
    text-align: center;
    padding: 8px 0;
    background: var(--white);
}

.ad-top {
    border-bottom: 1px solid var(--border);
}

.ad-results {
    margin-top: 24px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.ad-footer-sticky {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    padding: 6px;
}

/* ─── HEADER ─────────────────────────────────────────────────────────────── */
.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 20px 16px;
    text-align: center;
}

.header-inner {
    max-width: 680px;
    margin: 0 auto;
}

.logo {
    font-size: 1.75rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: -0.5px;
}

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

.logo-accent {
    color: var(--amber);
}

.tagline {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 6px;
}

/* ─── MAIN LAYOUT ────────────────────────────────────────────────────────── */
.main-content {
    max-width: 680px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ─── STATUS BAR ─────────────────────────────────────────────────────────── */
.status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    flex-shrink: 0;
    transition: background var(--transition);
}

.status-dot.ready {
    background: #4CAF50;
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.5);
}

.status-dot.error {
    background: var(--error-text);
}

/* ─── ERROR BANNER ───────────────────────────────────────────────────────── */
.error-banner {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* ─── DROP ZONE ──────────────────────────────────────────────────────────── */
.drop-zone {
    background: var(--white);
    border: 2.5px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 56px 32px;
    text-align: center;
    cursor: pointer;
    transition:
        border-color var(--transition),
        background var(--transition),
        transform var(--transition),
        box-shadow var(--transition);
    box-shadow: var(--shadow-sm);
    user-select: none;
}

.drop-zone:hover,
.drop-zone:focus-visible {
    border-color: var(--amber);
    background: var(--amber-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    outline: none;
}

.drop-zone.drag-over {
    border-color: var(--amber);
    background: var(--amber-light);
    transform: scale(1.01);
    box-shadow: 0 0 0 4px var(--amber-glow), var(--shadow-md);
}

.drop-zone-content {
    pointer-events: none;
}

.drop-icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
    display: block;
}

.drop-primary {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.drop-secondary {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.drop-hint {
    font-size: 0.8rem;
    color: var(--amber-dark);
    margin-top: 10px;
    opacity: 0.8;
}

.link-style {
    color: var(--amber);
    text-decoration: underline;
    font-weight: 500;
}

/* ─── PREVIEW ────────────────────────────────────────────────────────────── */
.preview-section {
    margin-top: 20px;
}

.preview-wrapper {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: var(--border);
    max-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-img {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    display: block;
    border-radius: var(--radius-md);
}

/* ─── LOADING OVERLAY ────────────────────────────────────────────────────── */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.88);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

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

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

/* ─── RESULTS ────────────────────────────────────────────────────────────── */
.results-section {
    margin-top: 28px;
}

.results-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

.breed-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ─── BREED ITEM CARD ────────────────────────────────────────────────────── */
.breed-item {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    border-left: 4px solid transparent;
    animation: slide-in 0.4s ease both;
    transition: transform var(--transition), box-shadow var(--transition);
}

.breed-item:hover {
    transform: translateX(3px);
    box-shadow: var(--shadow-md);
}

.breed-item.top-result {
    border-left-color: var(--amber);
    background: linear-gradient(135deg, var(--amber-light) 0%, var(--white) 70%);
    box-shadow: 0 4px 20px var(--amber-glow);
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.breed-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.breed-thumb {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
    background: var(--surface);
}

.top-result .breed-thumb {
    border-color: var(--amber);
    box-shadow: 0 0 0 2px var(--amber-glow);
}

.breed-rank {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    width: 22px;
    flex-shrink: 0;
}

.top-result .breed-rank {
    color: var(--amber-dark);
}

.breed-name {
    font-weight: 600;
    flex: 1;
    font-size: 1rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breed-pct {
    font-weight: 700;
    color: var(--amber-dark);
    font-size: 1rem;
    flex-shrink: 0;
}

/* ─── PROGRESS BAR ───────────────────────────────────────────────────────── */
.bar-track {
    background: var(--border);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 999px;
    background: #bbb;
    width: 0;
    transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-fill.bar-top {
    background: linear-gradient(90deg, var(--amber), var(--amber-dark));
    box-shadow: 0 0 8px var(--amber-glow);
}

.bar-fill.animate {
    width: var(--target-width);
}

/* ─── TRY AGAIN BUTTON ───────────────────────────────────────────────────── */
.try-another {
    text-align: center;
    margin-top: 20px;
}

#try-again-btn {
    background: var(--amber);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 4px 12px var(--amber-glow);
}

#try-again-btn:hover {
    background: var(--amber-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--amber-glow);
}

#try-again-btn:active {
    transform: translateY(0);
}

/* ─── SHARE SECTION ──────────────────────────────────────────────────────── */
.share-section {
    text-align: center;
    margin: 32px 0 0;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.share-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-muted);
}

.share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn {
    padding: 10px 22px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity var(--transition), transform var(--transition);
    white-space: nowrap;
}

.share-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.share-twitter {
    background: #1DA1F2;
    color: white;
}

.share-facebook {
    background: #1877F2;
    color: white;
}

/* ─── FEATURE CARDS ──────────────────────────────────────────────────────── */
.features-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 32px;
}

.feature-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 20px 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform var(--transition), box-shadow var(--transition);
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}

.feature-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 6px;
}

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

/* ─── LANGUAGE SELECTOR ──────────────────────────────────────────────────── */
.lang-select {
    margin-top: 10px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 24px;
}

.lang-select:hover,
.lang-select:focus {
    border-color: var(--amber);
    color: var(--text);
    outline: none;
}

/* ─── FAQ SECTION ────────────────────────────────────────────────────────── */
.faq-section {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.faq-section h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
}

.faq-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 12px;
}

.faq-item h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.faq-item p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ─── FOOTER ─────────────────────────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 28px 16px 40px;
    color: var(--text-muted);
    font-size: 0.82rem;
    border-top: 1px solid var(--border);
    margin-top: 40px;
    line-height: 1.7;
}

/* ─── UTILITY ────────────────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .logo {
        font-size: 1.35rem;
    }

    .drop-zone {
        padding: 40px 20px;
    }

    .drop-icon {
        font-size: 2.75rem;
    }

    .drop-primary {
        font-size: 1.05rem;
    }

    .breed-name {
        font-size: 0.9rem;
    }

    .features-section {
        grid-template-columns: 1fr;
    }

    .breed-thumb {
        width: 38px;
        height: 38px;
    }
}
