/* ===== NameMyHorse - Equestrian Theme ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-primary: #120e0a;
    --bg-secondary: #1f1812;
    --bg-card: #2a201a;
    --bg-card-hover: #352a22;
    --text-primary: #f0ebe5;
    --text-secondary: #c4b5a5;
    --text-muted: #8a7a6a;
    --accent: #c8956c;
    --accent-light: #dbb594;
    --accent-glow: rgba(200, 149, 108, 0.3);
    --gradient-1: linear-gradient(135deg, #c8956c, #a67c52);
    --gradient-2: linear-gradient(135deg, #dbb594, #c8956c);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(200, 149, 108, 0.15);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

.bg-decoration { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-circle { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.12; }
.bg-circle-1 { width: 600px; height: 600px; background: #c8956c; top: -200px; right: -200px; animation: float 20s ease-in-out infinite; }
.bg-circle-2 { width: 400px; height: 400px; background: #a67c52; bottom: -100px; left: -100px; animation: float 25s ease-in-out infinite reverse; }
.bg-circle-3 { width: 300px; height: 300px; background: #dbb594; top: 50%; left: 50%; transform: translate(-50%,-50%); animation: float 15s ease-in-out infinite; }
@keyframes float {
    0%,100% { transform: translate(0,0) scale(1); }
    33% { transform: translate(30px,-30px) scale(1.05); }
    66% { transform: translate(-20px,20px) scale(0.95); }
}

.app { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 0 24px; min-height: 100vh; display: flex; flex-direction: column; }
.header { text-align: center; padding: 40px 0 28px; }
.logo { font-size: 2.5rem; font-weight: 700; letter-spacing: -1px; background: var(--gradient-1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1.2; }
.logo-accent { background: var(--gradient-2); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.subtitle-sep { color: var(--text-muted); opacity: 0.4; }
.ai-badge-header { display: inline-flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--gradient-1); color: white; }
.upload-section { margin-bottom: 24px; }
.drop-zone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 240px; border: 2px dashed rgba(255,255,255,0.12); border-radius: var(--radius-xl); background: var(--bg-secondary); cursor: pointer; transition: var(--transition); overflow: hidden; }
.drop-zone:hover { border-color: var(--accent); background: rgba(200,149,108,0.04); }
.drop-zone.drag-over { border-color: var(--accent); background: rgba(200,149,108,0.08); box-shadow: var(--shadow-glow); }
.drop-zone.has-image { border-style: solid; border-color: rgba(200,149,108,0.3); padding: 8px; }
.upload-prompt { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 20px; }
.upload-prompt.hidden { display: none; }
.upload-icon { color: var(--text-muted); opacity: 0.6; margin-bottom: 4px; }
.upload-text { font-size: 1.1rem; font-weight: 500; color: var(--text-primary); }
.upload-hint { font-size: 0.85rem; color: var(--text-muted); opacity: 0.6; }
.upload-types { font-size: 0.75rem; color: var(--text-muted); opacity: 0.4; margin-top: 4px; }
.image-preview { width: 100%; max-height: 400px; object-fit: contain; border-radius: var(--radius-md); }
.image-preview.hidden { display: none; }
.remove-image-btn { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 50%; background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.15); color: white; cursor: pointer; transition: var(--transition); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; }
.remove-image-btn:hover { background: rgba(239,68,68,0.7); transform: scale(1.1); }
.remove-image-btn.hidden { display: none; }

.generate-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 16px 28px; margin-top: 16px; background: var(--gradient-1); color: white; border: none; border-radius: var(--radius-md); font-size: 1.05rem; font-weight: 600; font-family: inherit; cursor: pointer; transition: var(--transition); }
.generate-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 24px var(--accent-glow); }
.generate-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.api-status { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius-sm); font-size: 0.85rem; margin-bottom: 16px; }
.api-status.hidden { display: none; }
.api-status.warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.2); color: #fbbf24; }

.loading { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 40px 0; color: var(--text-secondary); }
.loading.hidden { display: none; }
.loading-text { font-size: 1rem; font-weight: 500; color: var(--text-primary); }
.loading-sub { font-size: 0.85rem; color: var(--text-muted); opacity: 0.7; }

.horse-loader { position: relative; width: 120px; height: 80px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.horse-loader svg { color: var(--accent); opacity: 0.3; animation: horse-bounce 1.5s ease-in-out infinite; }
.horse-loader .hr-1 { animation-delay: 0s; width: 36px; height: 36px; }
.horse-loader .hr-2 { animation-delay: 0.3s; width: 28px; height: 28px; }
.horse-loader .hr-3 { animation-delay: 0.6s; width: 22px; height: 22px; }
@keyframes horse-bounce {
    0%,100% { transform: translateY(0) rotate(0deg); opacity: 0.3; }
    50% { transform: translateY(-16px) rotate(15deg); opacity: 1; }
}

.error-message { display: flex; align-items: flex-start; gap: 10px; padding: 14px 18px; background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); border-radius: var(--radius-md); color: #f87171; font-size: 0.9rem; margin-bottom: 16px; }
.error-message.hidden { display: none; }

.results { animation: fadeInUp 0.5s ease-out; }
.results.hidden { display: none; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.results-header { text-align: center; margin-bottom: 24px; }
.results-title { font-size: 1.1rem; font-weight: 500; color: var(--text-secondary); }
.entity-name { color: var(--text-primary); font-weight: 600; }
.results-label { opacity: 0.8; }
.entity-description { font-size: 0.85rem; color: var(--text-muted); margin-top: 6px; font-style: italic; opacity: 0.7; }
.entity-description.hidden { display: none; }

.cards-container { display: grid; gap: 16px; }
.name-card { background: var(--bg-card); border: 1px solid rgba(255,255,255,0.06); border-radius: var(--radius-lg); padding: 28px 32px 24px; transition: var(--transition); position: relative; overflow: hidden; }
.name-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(200,149,108,0.05), transparent 60%); opacity: 0; transition: var(--transition); pointer-events: none; }
.name-card:hover { background: var(--bg-card-hover); border-color: rgba(200,149,108,0.2); transform: translateY(-2px); box-shadow: var(--shadow-card); }
.name-card:hover::before { opacity: 1; }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; z-index: 1; position: relative; }
.entity-name-text { font-size: 2rem; font-weight: 700; letter-spacing: 1px; background: var(--gradient-1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1.3; }
.card-badges { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.card-badge { font-size: 0.65rem; font-weight: 600; padding: 3px 10px; border-radius: 10px; letter-spacing: 0.5px; white-space: nowrap; }
.card-badge.recommended { background: var(--gradient-1); color: white; }
.card-badge.ai-badge { background: rgba(200,149,108,0.15); color: var(--accent-light); border: 1px solid rgba(200,149,108,0.2); }
.card-meaning { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 10px; z-index: 1; position: relative; }
.meaning-label { display: inline-block; font-size: 0.65rem; font-weight: 600; color: var(--accent-light); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 4px; opacity: 0.7; }
.card-reason { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.7; z-index: 1; position: relative; }
.reason-label { display: block; font-size: 0.65rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 4px; opacity: 0.6; }
.card-divider { height: 1px; background: linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05)); margin-bottom: 14px; z-index: 1; position: relative; }

.copy-btn { display: inline-flex; align-items: center; gap: 4px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); border-radius: 6px; color: var(--text-muted); font-size: 0.75rem; font-family: inherit; padding: 5px 12px; cursor: pointer; transition: var(--transition); margin-top: 14px; }
.copy-btn:hover { background: rgba(200,149,108,0.12); border-color: rgba(200,149,108,0.3); color: var(--accent-light); }
.copy-btn.copied { background: rgba(52,211,153,0.15); border-color: rgba(52,211,153,0.3); color: #34d399; }

.download-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; padding: 16px 20px; background: var(--bg-secondary); border: 1px solid rgba(255,255,255,0.08); border-radius: var(--radius-md); animation: fadeInUp 0.4s ease-out; }
.download-bar.hidden { display: none; }
.download-bar-left { display: flex; align-items: center; gap: 10px; color: var(--text-secondary); font-size: 0.9rem; }
.download-bar-left svg { flex-shrink: 0; color: var(--accent); }
.download-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 22px; background: var(--gradient-1); color: white; border: none; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 600; font-family: inherit; cursor: pointer; transition: var(--transition); white-space: nowrap; flex-shrink: 0; }
.download-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glow); }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; animation: fadeIn 0.2s ease-out; padding: 24px; }
.modal-overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card { background: var(--bg-card); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-lg); width: 100%; max-width: 400px; box-shadow: 0 24px 64px rgba(0,0,0,0.5); animation: modalSlideIn 0.25s ease-out; }
@keyframes modalSlideIn { from { opacity: 0; transform: translateY(20px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header { padding: 24px 24px 0; }
.modal-header h3 { font-size: 1.15rem; font-weight: 600; color: var(--text-primary); }
.modal-body { padding: 16px 24px; }
.modal-body p { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.6; }
.modal-body p strong { color: var(--accent-light); font-weight: 600; }
.modal-hint { font-size: 0.82rem !important; color: var(--text-muted) !important; margin-top: 8px; opacity: 0.7; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 24px 24px; }
.modal-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 22px; border: none; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 600; font-family: inherit; cursor: pointer; transition: var(--transition); white-space: nowrap; }
.modal-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.modal-btn-secondary { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.modal-btn-secondary:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.modal-btn-primary { background: var(--gradient-1); color: white; }
.modal-btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glow); }

.footer { margin-top: auto; text-align: center; padding: 32px 0; color: var(--text-secondary); font-size: 0.8rem; opacity: 0.5; }

@media (max-width: 600px) {
    .header { padding: 28px 0 20px; }
    .logo { font-size: 2rem; }
    .drop-zone { min-height: 200px; }
    .name-card { padding: 22px 20px 20px; }
    .entity-name-text { font-size: 1.6rem; }
    .download-bar { flex-direction: column; text-align: center; }
    .download-bar-left { justify-content: center; }
    .download-btn { width: 100%; justify-content: center; }
    .modal-footer { flex-direction: column-reverse; }
    .modal-btn { justify-content: center; }
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
