/**
 * NBA Guess - Component Styles
 * Specific styles for UI components
 */

/* ==================== HEADER ==================== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 20, 25, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    height: 64px;
}

.header-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Left side - hamburger menu */
.header-left {
    width: 88px; /* Same width as header-actions (2 icons) to center logo */
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.header-logo {
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.header-logo:hover {
    opacity: 0.8;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.header-icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.header-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* ==================== GAME CONTAINER ==================== */
.game-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: calc(100vh - 64px);
}

@media (max-width: 640px) {
    .game-container {
        padding: 1rem 0.75rem;
    }
}

/* ==================== GAME STATUS ==================== */
.game-status {
    text-align: center;
    margin-bottom: 1.5rem;
}

.guess-counter {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(180deg, var(--primary) 0%, var(--correct) 100%);
    transition: width 0.5s ease-out;
    border-radius: 3px;
}

/* ==================== HINT BADGE ==================== */
.hint-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.2));
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 24px;
    color: var(--correct);
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
    transition: all 0.3s ease;
}

.hint-badge:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}

.hint-badge-icon {
    font-size: 1.25rem;
    animation: pulse 2s ease-in-out infinite;
}

/* Hint Unlock Button (Click to Reveal) */
.hint-unlock-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.8rem;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.2));
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: #fbbf24;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.25);
}

.hint-unlock-btn:hover {
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.35);
    transform: translateY(-1px);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.25));
}

.hint-unlock-btn:active {
    transform: translateY(0);
}

.hint-unlock-icon {
    font-size: 1.25rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

/* ==================== CREATOR MESSAGE BADGE ==================== */
.creator-message-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(99, 102, 241, 0.2));
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 24px;
    color: #93c5fd;
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
    transition: all 0.3s ease;
}

.creator-message-badge:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

.creator-message-icon {
    font-size: 1.25rem;
    animation: pulse 2s ease-in-out infinite;
}

/* ==================== SEARCH SECTION ==================== */
.search-section {
    margin-bottom: 1.5rem;
}

/* ==================== MATCHING INFO SECTION ==================== */
.matching-info-section {
    text-align: center;
    margin-bottom: 1.5rem;
}

.matching-badges {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.match-badge {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.match-badge.no-match {
    background-color: #4b5563;
    color: #ffffff;
}

.match-badge.close {
    background-color: #cea60c;
    color: #1a1a2e;
}

.match-badge.match {
    background-color: #10b981;
    color: #ffffff;
}

.matching-hint-text {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin: 0;
    line-height: 1.6;
}

.guess-counter-inline {
    text-align: right;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    margin-right: 0.2rem;
}

/* ==================== SEARCH BAR ==================== */
.search-container {
    position: relative;
    margin-left: 0.2rem;
    margin-right: 0.2rem;
}

.search-input {
    width: 100%;
    height: 44px;
    padding: 0 2.75rem 0 1.25rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    color: #ffffff;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.search-input::placeholder {
    color: #9ca3af;
}

.search-input:focus {
    outline: none;
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #6b7280;
    pointer-events: none;
}

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    z-index: 50;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.search-result-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--nba-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
}

.search-result-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.search-result-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ==================== GUESS CARD ==================== */
.guess-card {
    /*background: var(--card-bg);*/
    /*border: 1px solid rgba(255, 255, 255, 0.03);*/
    /*border-radius: 20px;*/
    padding: 0.2rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.guess-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.player-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
    flex-shrink: 0;
}

.player-avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--nba-blue) 0%, var(--nba-orange) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.player-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.guess-number {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ==================== STATS GRID ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.625rem;
    /* 3D perspective container for child stat-pill flip animations */
    /*perspective: 1000px;*/
}

/* ==================== STAT PILL ==================== */
.stat-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 0.25rem;
    border-radius: 10px;
    border: none;
    height: 70px;
    position: relative;
    min-width: 0; /* Prevents content from expanding grid columns */
    overflow: hidden; /* Ensures content stays within bounds */
    background: #2d3748;
    /* 3D flip support - perspective is on parent .stats-grid */
    /*transform-style: preserve-3d;*/
    backface-visibility: visible;
}

.stat-pill-label {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 0.125rem;
    color: #ffffff; /* Default muted gray */
}

.stat-pill-value {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    color: #94a3b8; /* Default light gray */
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Stat Pill Status Colors - SOLID BACKGROUNDS (show color immediately) */
.stat-pill.correct {
    background-color: #10b981;
}

.stat-pill.correct .stat-pill-label {
    color: white;
}

.stat-pill.correct .stat-pill-value {
    color: #ffffff;
    font-weight: 800;
}

.stat-pill.partial {
    background-color: #cea60c;
}

.stat-pill.partial .stat-pill-label {
    color: white;
}

.stat-pill.partial .stat-pill-value {
    color: white;
    font-weight: 800;
}

.stat-pill.incorrect {
    background-color: #2d3748;
    border: 1px solid #1e293b;
}

.stat-pill.incorrect .stat-pill-label {
    color: #ffffff;
}

.stat-pill.incorrect .stat-pill-value {
    color: #94a3b8;
}

/* ==================== FLIP ANIMATIONS ==================== */
/* Flip animation class - added via JS after colors are visible */
.stat-pill.flip-animate {
    animation: flip-reveal 0.8s ease-in-out;
}

/* Single flip animation - keeps the existing background color */
@keyframes flip-reveal {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(180deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

/* All matched pills flip simultaneously - no staggered delays */

/* Arrow Indicators - Modern CSS Triangles */
.stat-pill .arrow {
    display: none;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    margin-left: 6px;
    vertical-align: middle;
}

.stat-pill .arrow.arrow-up,
.stat-pill .arrow.arrow-down {
    display: inline-block;
}

.stat-pill .arrow-up {
    border-bottom: 8px solid rgba(255, 255, 255, 0.9);
}

.stat-pill .arrow-down {
    border-top: 8px solid rgba(255, 255, 255, 0.9);
}

/* Subtle entrance animation */
.stat-pill .arrow-up,
.stat-pill .arrow-down {
    animation: arrowPulse 0.3s ease-out;
}

@keyframes arrowPulse {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}

/* Glow Effects */
.stat-pill.correct.glow {
    box-shadow: var(--shadow-glow-green);
}

.stat-pill.partial.glow {
    box-shadow: var(--shadow-glow-amber);
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1rem;
    font-weight: 500;
}

/* ==================== GAME COMPLETE ==================== */
.game-complete-banner {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
    border: 2px solid var(--correct);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
}

.game-complete-banner.lost {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(107, 114, 128, 0.2) 100%);
    border-color: var(--incorrect);
}

.game-complete-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.game-complete-message {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* ==================== BUTTONS ==================== */
.play-button {
    padding: 0.875rem 2.5rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
    transition: all 0.3s ease;
}

.play-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(16, 185, 129, 0.5);
}

.play-button:active {
    transform: translateY(0);
}

/* Yesterday's Player - Inline Reveal */
.yesterday-reveal-container {
    margin-top: 2rem;
}

.yesterday-text {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.yesterday-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.yesterday-text:hover {
    color: var(--text-primary);
}

.yesterday-player-reveal {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.yesterday-player-image {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    background: #333;
    flex-shrink: 0;
}

.yesterday-player-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.yesterday-player-initials {
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1d428a 0%, #ff6b35 100%);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
}

.yesterday-player-name {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-success {
    background: var(--correct);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ==================== LOADING ==================== */
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Disabled input state while processing */
.search-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #1a1f2e;
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast {
    position: fixed;
    top: 5rem;
    right: 1rem;
    min-width: 300px;
    max-width: 500px;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.toast-success {
    background: var(--correct);
    color: white;
}

.toast-error {
    background: #ef4444;
    color: white;
}

.toast-info {
    background: var(--primary);
    color: white;
}

/* ==================== CONFETTI ==================== */
.confetti-particle {
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    animation: confettiFall 3s ease-out forwards;
}

/* ==================== MODALS ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Mobile: Bottom Sheet Style */
@media (max-width: 640px) {
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-content {
        max-width: 100%;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        max-height: 85vh;
    }
}

/* ===================================
   Social Share Icons
   =================================== */
.social-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.social-icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.social-icon-btn:active {
    transform: translateY(0);
}

/* Instagram gradient */
.social-icon-instagram {
    background: linear-gradient(135deg, #F58529 0%, #DD2A7B 50%, #8134AF 100%);
}

/* Mobile touch optimization */
@media (max-width: 640px) {
    .social-icon-btn {
        width: 48px;
        height: 48px;
    }
}

/* Touch feedback */
@media (hover: none) {
    .social-icon-btn:active {
        transform: scale(0.95);
    }
}

/* ==================== REPLAY FEATURE ==================== */

/* Replay Section in Menu Modal */
.replay-section {
    animation: fadeIn 0.3s ease-out;
}

/* Replay Pills Container */
.replay-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Replay Date Pill */
.replay-pill {
    width: 48px;
    height: 60px;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #374151;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.replay-pill .pill-icon {
    color: white;
    margin-bottom: 2px;
}

.replay-pill .pill-date {
    color: #9ca3af;
}

/* Available (unplayed) state */
.replay-pill.available {
    background: #374151;
}

.replay-pill.available:hover {
    border-color: #8b5cf6;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
    transform: scale(1.05);
}

.replay-pill.available:active {
    transform: scale(0.98);
}

/* Completed - Won state */
.replay-pill.completed.won {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    cursor: not-allowed;
}

.replay-pill.completed.won .pill-icon {
    color: white;
}

.replay-pill.completed.won .pill-date {
    color: rgba(255, 255, 255, 0.9);
}

/* Completed - Lost state */
.replay-pill.completed.lost {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    cursor: not-allowed;
}

.replay-pill.completed.lost .pill-icon {
    color: #fca5a5;
}

.replay-pill.completed.lost .pill-date {
    color: rgba(255, 255, 255, 0.7);
}

/* Disabled state (no game available) */
.replay-pill.disabled {
    background: #1f2937;
    opacity: 0.5;
    cursor: not-allowed;
}

.replay-pill:disabled {
    cursor: not-allowed;
}

/* Replay Mode Header Indicator */
.replay-indicator {
    padding: 10px 16px;
    border-radius: 12px;
    text-align: center;
    animation: slideDown 0.3s ease-out;
}

.replay-indicator button {
    transition: color 0.2s ease;
}

.replay-indicator button:hover {
    color: #60a5fa;
}

/* Mobile adjustments for replay pills */
@media (max-width: 480px) {
    .replay-pill {
        width: 44px;
        height: 54px;
    }

    .replay-pill .pill-icon {
        font-size: 12px;
    }

    .replay-pill .pill-date {
        font-size: 10px;
    }
}

/* Custom Create Container */
.custom-create-container {
    max-width: 500px;
    margin: 0 auto;
}

.custom-create-form,
.custom-create-share {
    animation: slideDown 0.3s ease-out;
}

/* Animation for replay indicator */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
