:root {
    --bg-base: #020617;
    --bg-surface: rgba(15, 23, 42, 0.7);
    --bg-card: rgba(30, 41, 59, 0.4);
    --border-glow: rgba(99, 102, 241, 0.15);
    --border-glow-hover: rgba(168, 85, 247, 0.4);
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.35);
    --accent: #a855f7;
    --accent-glow: rgba(168, 85, 247, 0.35);
    --success: #10b981;
    --warning: #f59e0b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.07) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.07) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-x: hidden;
}

.container {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.header-top {
    display: flex;
    flex-direction: column; /* Put languages above credits on mobile */
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    width: 100%;
}

@media (min-width: 768px) {
    .header-top {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

/* Language Selector */
.lang-selector {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.25rem;
    border-radius: 99px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.4rem 0.9rem;
    border-radius: 99px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.lang-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--primary-glow);
}

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

header h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem; /* Adjusted for very small mobiles */
    line-height: 1.2;
    font-weight: 800;
    background: linear-gradient(135deg, #a855f7 0%, #6366f1 50%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.04em;
    margin-bottom: 0.75rem;
    filter: drop-shadow(0 4px 15px rgba(99, 102, 241, 0.2));
}

@media (min-width: 768px) {
    header h1 {
        font-size: 3.2rem;
        letter-spacing: -0.05em;
    }
}

header p {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    font-weight: 300;
    line-height: 1.5;
}

/* Search Card */
.search-card {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glow);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.search-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 20px 50px -10px rgba(99, 102, 241, 0.12), inset 0 1px 1px rgba(255, 255, 255, 0.08);
}

/* Input Area */
.input-group {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    min-height: 130px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 1.25rem;
    font-size: 1.1rem;
    color: var(--text-main);
    resize: vertical;
    outline: none;
    transition: all 0.3s ease;
    line-height: 1.6;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.4);
}

/* Jauge de force */
.strength-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: -0.25rem;
    padding: 0 0.25rem;
}

.meter-container {
    display: flex;
    gap: 4px;
    width: 160px;
    height: 6px;
}

.meter-bar {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Actions Row */
.actions-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.submit-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #ffffff;
    border: none;
    border-radius: 14px;
    padding: 1rem 2.25rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px var(--primary-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: all 0.6s ease;
}

.submit-btn:hover::before {
    left: 100%;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.35);
    filter: brightness(1.08);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.submit-btn:disabled svg {
    opacity: 0.2;
}

/* Results section */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 200px;
    animation: fadeIn 0.5s ease-out;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--accent);
    padding-left: 0.75rem;
}

.results-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
}

/* Clarification Box (Soft-Fail) */
.feedback-message {
    background: rgba(245, 158, 11, 0.07);
    border: 1px solid rgba(245, 158, 11, 0.2);
    padding: 1.25rem 1.5rem;
    border-radius: 18px;
    color: #f59e0b;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    line-height: 1.6;
    animation: slideIn 0.3s ease-out;
}

.feedback-message svg {
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.feedback-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.feedback-btn {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 0.45rem 1.1rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.feedback-btn:hover {
    background: rgba(245, 158, 11, 0.25);
    border-color: rgba(245, 158, 11, 0.5);
    transform: translateY(-1px);
}

/* Candidates Grid & Card */
.candidates-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.candidate-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

@media (min-width: 640px) {
    .candidate-card {
        flex-direction: row;
    }
}

.candidate-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.candidate-card:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(99, 102, 241, 0.25);
    transform: translateX(4px);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
}

.candidate-card:hover::after {
    opacity: 1;
}

.candidate-thumbnail {
    width: 110px;
    height: 160px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
    background: #0f172a;
    align-self: center;
}

.candidate-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.75rem;
}

.candidate-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.candidate-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.candidate-meta {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.candidate-description {
    font-size: 0.95rem;
    color: #cbd5e1;
    line-height: 1.6;
}

.candidate-reasoning {
    background: rgba(99, 102, 241, 0.08);
    border-left: 3px solid var(--primary);
    padding: 0.75rem 1.25rem;
    border-radius: 4px 14px 14px 4px;
    font-size: 0.92rem;
    color: #c7d2fe;
    line-height: 1.5;
}

/* Match Probability Badge */
.match-badge {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 99px;
    padding: 0.4rem 0.9rem;
    font-size: 0.88rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.match-high {
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.25);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.match-medium {
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.25);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.1);
}

.match-low {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.25);
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, rgba(30, 41, 59, 0.4) 25%, rgba(51, 65, 85, 0.6) 50%, rgba(30, 41, 59, 0.4) 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Footer */
footer {
    text-align: center;
    padding: 2.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.02);
    margin-top: 3rem;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Credits Badge */
.credits-badge {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
    padding: 0.35rem 0.8rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
    white-space: nowrap;
}

/* Loading State UI */
.loading-state {
    animation: fadeIn 0.4s ease;
}

.progress-bar-container {
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.progress-bar-fill {
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Footer Links */
.footer-links {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
}

@media (min-width: 768px) {
    .footer-links {
        flex-direction: row;
        gap: 1rem;
    }
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
    padding: 0.2rem 0;
}

.footer-links a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.separator {
    display: none;
    color: rgba(255, 255, 255, 0.2);
}

@media (min-width: 768px) {
    .separator {
        display: inline;
    }
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    justify-content: center;
    animation: slideIn 0.5s ease;
}

.cookie-content {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 800px;
    width: 100%;
}

@media (min-width: 768px) {
    .cookie-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.cookie-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
}

.cookie-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.cookie-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.cookie-link:hover {
    text-decoration: underline;
}

.cookie-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

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

/* Animations */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

/* Modal Glassmorphism */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 40px rgba(99, 102, 241, 0.1);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 90%;
    width: 400px;
    text-align: center;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.modal-content h2 {
    color: var(--text-main);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-family: 'Space Grotesk', sans-serif;
}

.modal-content p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.5;
}

/* Emoji Confetti System */
.emoji-confetti {
    position: fixed;
    pointer-events: none;
    z-index: 10001;
    font-size: 1.5rem;
    animation: fall 3s ease-in forwards;
}

@keyframes fall {
    0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(360deg); opacity: 0; }
}
