/* Component-specific styles */

/* User section */
.user-section {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.user-stats {
    display: flex;
    align-items: center;
    gap: 8px;
}

.points-display {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-brand-light);
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    color: var(--primary-brand);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.points-icon {
    font-size: 16px;
}

.tokens-display {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--tokens-bg, #9f7aea);
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    color: var(--tokens-text, #ffffff);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.tokens-icon {
    font-size: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.user-profile:hover {
    background-color: var(--background-secondary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.username {
    font-weight: 500;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.dropdown-arrow {
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform 0.2s ease, color 0.3s ease;
}

.user-profile:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* User dropdown */
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--background-surface);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 4px 20px var(--shadow-medium);
    min-width: 180px;
    z-index: 1001;
    margin-top: 8px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.user-dropdown ul {
    list-style: none;
    padding: 8px 0;
}

.user-dropdown li {
    padding: 0;
}

.user-dropdown li.divider {
    border-top: 1px solid var(--border-light);
    margin: 8px 0;
}

.user-dropdown a {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 14px;
    transition: background-color 0.2s ease, color 0.3s ease;
}

.user-dropdown a:hover {
    background-color: var(--background-secondary);
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--background-surface);
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--shadow-dark);
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    transition: background-color 0.3s ease;
}

.goto-modal-content {
    width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    transition: border-color 0.3s ease;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    transition: color 0.3s ease;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

/* Goto form */
.goto-form {
    padding: 24px;
}

.coordinate-inputs {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.input-group input {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #f93c12;
}

.goto-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #f93c12;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error states */
.error {
    color: #dc3545;
    border-color: #dc3545 !important;
}

.error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
}

/* Success states */
.success {
    color: #28a745;
    border-color: #28a745 !important;
}

.success-message {
    color: #28a745;
    font-size: 12px;
    margin-top: 4px;
}

/* Celebratory Points Popup Styles */
.points-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translateX(-50%) translateY(-50%) scale(0.7);
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 50%, #48dbfb 100%);
    border-radius: 20px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    min-width: 350px;
    max-width: 450px;
    z-index: 2000;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    cursor: pointer;
    overflow: hidden;
}

.points-popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    animation: shimmer 2s infinite;
    pointer-events: none;
}

.points-popup.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-50%) scale(1);
}

.points-popup.hide {
    opacity: 0;
    transform: translateX(-50%) translateY(-50%) scale(0.8);
    transition: all 0.3s ease-in;
}

.celebration-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    margin: 3px;
    padding: 0;
    overflow: hidden;
}

.celebration-header {
    text-align: center;
    padding: 20px 18px 12px;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(254, 202, 87, 0.1) 100%);
    position: relative;
}

.celebration-icon {
    font-size: 48px;
    animation: bounce 1s ease-in-out infinite alternate;
    display: block;
    margin-bottom: 8px;
}

.celebration-header h2 {
    margin: 0 0 12px 0;
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 50%, #48dbfb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: glow 2s ease-in-out infinite alternate;
}

.celebration-sparkles {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.sparkle {
    font-size: 20px;
    animation: sparkle 1.5s ease-in-out infinite;
    display: inline-block;
}

.sparkle:nth-child(1) { animation-delay: 0s; }
.sparkle:nth-child(2) { animation-delay: 0.5s; }
.sparkle:nth-child(3) { animation-delay: 1s; }

.celebration-content {
    padding: 0 20px 20px;
}

.words-showcase {
    margin-bottom: 16px;
}

.word-score, .bonus-score {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, rgba(72, 219, 251, 0.1) 0%, rgba(255, 107, 107, 0.1) 100%);
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: slideInBounce 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    overflow: hidden;
    position: relative;
}

.word-score.expanded {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    border-color: rgba(72, 219, 251, 0.4);
    background: linear-gradient(135deg, rgba(72, 219, 251, 0.15) 0%, rgba(255, 107, 107, 0.15) 100%);
}

.word-score:hover, .bonus-score:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.word-info, .bonus-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
    min-height: 30px;
}

.word-text {
    font-size: 22px;
    font-weight: 700;
    color: #2d3748;
    letter-spacing: 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.bonus-text {
    font-size: 18px;
    font-weight: 600;
    color: #9f7aea;
    letter-spacing: 1px;
}

.word-multiplier {
    font-size: 11px;
    font-weight: 600;
    color: #f56500;
    background: rgba(254, 202, 87, 0.3);
    padding: 3px 8px;
    border-radius: 8px;
    margin-top: 4px;
    border: 1px solid rgba(254, 202, 87, 0.5);
}

.word-points, .bonus-points {
    font-size: 24px;
    font-weight: 800;
    color: #38a169;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: pointsPulse 2s ease-in-out infinite;
    align-self: flex-start;
    margin-top: 2px;
}

.bonus-points {
    color: #9f7aea;
}

/* Word Definition Styles */
.word-definition {
    width: 100%;
    margin-top: 6px;
}

.definition-preview {
    font-size: 12px;
    color: #4a5568;
    font-style: italic;
    margin-top: 4px;
    opacity: 0.8;
    line-height: 1.3;
    max-height: 16px;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.definition-preview.definition-unavailable {
    color: #a0a0a0;
    opacity: 0.6;
}

.definition-full {
    display: none;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(72, 219, 251, 0.3);
    backdrop-filter: blur(3px);
    animation: definitionExpand 0.3s ease-out;
}

.definition-loading {
    font-size: 11px;
    color: #666;
    font-style: italic;
    opacity: 0.7;
}

.definition-content {
    font-size: 13px;
    line-height: 1.4;
}

.definition-text {
    color: #2d3748;
    margin-bottom: 4px;
    font-weight: 500;
}

.definition-part-of-speech {
    font-size: 11px;
    color: #9f7aea;
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.definition-example {
    font-size: 12px;
    color: #4a5568;
    font-style: italic;
    opacity: 0.8;
    border-left: 2px solid rgba(72, 219, 251, 0.3);
    padding-left: 8px;
    margin-top: 6px;
}

.definition-error {
    font-size: 11px;
    color: #a0a0a0;
    font-style: italic;
    opacity: 0.6;
}

.points-celebration {
    text-align: center;
    padding: 16px;
    background: linear-gradient(135deg, #feca57 0%, #ff9ff3 100%);
    border-radius: 16px;
    margin: 12px 0;
    animation: celebrationPulse 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.points-celebration::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    animation: rotate 3s linear infinite;
    pointer-events: none;
}

.points-earned {
    font-size: 48px;
    font-weight: 900;
    color: #744210;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 4px;
    animation: bounceIn 0.8s ease-out 0.3s both;
}

.points-label {
    font-size: 16px;
    font-weight: 600;
    color: #744210;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: fadeInUp 0.6s ease-out 0.5s both;
}

.words-formed {
    text-align: center;
    margin-top: 12px;
    font-size: 16px;
    color: #4a5568;
    font-weight: 600;
    animation: fadeInUp 0.6s ease-out 0.7s both;
    opacity: 0;
}

/* Celebration Animations */
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes bounce {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-10px) scale(1.1); }
}

@keyframes glow {
    0% { text-shadow: 0 0 5px rgba(255, 107, 107, 0.3); }
    100% { text-shadow: 0 0 20px rgba(255, 107, 107, 0.6), 0 0 30px rgba(254, 202, 87, 0.4); }
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.7; }
    50% { transform: scale(1.3) rotate(180deg); opacity: 1; }
}

@keyframes slideInBounce {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    60% {
        opacity: 1;
        transform: translateY(-5px) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes pointsPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes celebrationPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 15px rgba(254, 202, 87, 0.3); }
    50% { transform: scale(1.02); box-shadow: 0 8px 25px rgba(254, 202, 87, 0.5); }
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes definitionExpand {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
        max-height: 0;
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        max-height: 200px;
    }
}

/* Staggered animations for word scores */
.word-score:nth-child(1) { animation-delay: 0.1s; }
.word-score:nth-child(2) { animation-delay: 0.2s; }
.word-score:nth-child(3) { animation-delay: 0.3s; }
.word-score:nth-child(4) { animation-delay: 0.4s; }
.word-score:nth-child(5) { animation-delay: 0.5s; }

.bonus-score {
    animation-delay: 0.6s;
}

/* Game Notification Styles */
.game-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    max-width: 400px;
    min-width: 300px;
    z-index: 3000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    cursor: pointer;
}

.game-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.game-notification.hide {
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease-in;
}

.notification-content {
    display: flex;
    align-items: flex-start;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.notification-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    pointer-events: none;
}

/* Notification Type Styles */
.notification-error .notification-content {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.9) 0%, rgba(220, 38, 38, 0.9) 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

.notification-warning .notification-content {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.9) 0%, rgba(217, 119, 6, 0.9) 100%);
    border-color: rgba(245, 158, 11, 0.3);
}

.notification-info .notification-content {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9) 0%, rgba(37, 99, 235, 0.9) 100%);
    border-color: rgba(59, 130, 246, 0.3);
}

.notification-success .notification-content {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.9) 0%, rgba(22, 163, 74, 0.9) 100%);
    border-color: rgba(34, 197, 94, 0.3);
}

.notification-icon {
    font-size: 20px;
    margin-right: 12px;
    flex-shrink: 0;
    margin-top: 2px;
}

.notification-message {
    flex: 1;
    color: white;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.notification-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    margin-left: 12px;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: scale(1.1);
}

/* Animation for notification content */
.game-notification.show .notification-content {
    animation: notificationBounce 0.6s ease-out;
}

@keyframes notificationBounce {
    0% {
        transform: scale(0.9);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .game-notification {
        right: 10px;
        left: 10px;
        max-width: none;
        min-width: auto;
    }
}