/* ===== components.css - UI Components & Effects ===== */

/* LOADERS & ANIMATIONS */
.loader {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-small {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* BUTTONS */
.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn:hover { background: var(--primary-light); transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-large { padding: 1rem 2rem; font-size: 1.1rem; }
.btn-block { width: 100%; margin-bottom: 0.75rem; }
.btn-secondary { background: var(--dark-lighter); }
.btn-danger { background: var(--danger); }
.btn-primary { background: var(--primary); }

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* TOASTS */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--dark-light);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    max-width: 280px;
    animation: slideIn 0.3s ease;
    border-right: 4px solid var(--primary);
    font-size: 0.9rem;
}

.toast.success { border-right-color: var(--secondary); }
.toast.error { border-right-color: var(--danger); }
.toast.warning { border-right-color: var(--warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* MODALS */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    inset: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--dark-light);
    padding: 2rem;
    width: 90%;
    max-width: 360px;
    border-radius: var(--radius-lg);
    position: relative;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: var(--shadow-lg);
}

.close {
    position: absolute;
    left: 15px;
    top: 12px;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--gray-light);
    transition: color 0.2s;
}

.close:hover { color: white; }

/* FEEDBACK OVERLAY */
.feedback-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(5px);
}

.feedback-overlay.show { opacity: 1; }

.feedback-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: scale(0.5);
}

.feedback-overlay.show .feedback-icon { transform: scale(1); }
.feedback-text { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; }
.feedback-overlay.correct .feedback-icon { color: var(--secondary); filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.4)); }
.feedback-overlay.correct .feedback-text { color: var(--secondary); }
.feedback-overlay.wrong .feedback-icon { color: var(--danger); filter: drop-shadow(0 0 20px rgba(239, 68, 68, 0.4)); }
.feedback-overlay.wrong .feedback-text { color: var(--danger); }
.feedback-xp { font-size: 1.25rem; font-weight: 600; color: #fbbf24; }

/* GAMIFICATION EFFECTS */
.floating-xp {
    position: fixed;
    font-family: 'Heebo', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    color: #fbbf24;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
    pointer-events: none;
    z-index: 10000;
    animation: floatUp 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes floatUp {
    0% { transform: translate(-50%, -50%) scale(0.5) rotate(-10deg); opacity: 0; }
    20% { transform: translate(-50%, -50%) scale(1.2) rotate(0deg); opacity: 1; }
    100% { transform: translate(-50%, -150px) scale(1); opacity: 0; }
}

.big-v-effect {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10rem;
    color: #10b981;
    z-index: 9999;
    opacity: 0;
    animation: popInBig 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    filter: drop-shadow(0 0 30px rgba(16,185,129,0.6));
}

@keyframes popInBig {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    40% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    80% { transform: translate(-50%, -50%) scale(0.9); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* SETTINGS SWITCHES */
.switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background-color: var(--gray); transition: 0.3s; border-radius: 100px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: 0.3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(22px); }