/* ===========================
   PISTO PLAY — COMPONENTS.CSS
   Shared UI Components — Fully Responsive
   =========================== */

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-full);
    font-size: var(--fs-base);
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all var(--transition-base);
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    min-height: 44px; /* Accessibility tap target */
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:active::after { opacity: 1; }

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--purple-500), var(--purple-600));
    color: var(--white);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.5);
}

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

.btn-coral {
    background: linear-gradient(135deg, var(--coral-500), var(--coral-600));
    color: var(--white);
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.4);
}

.btn-coral:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(249, 115, 22, 0.5);
}

.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-accent);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: var(--space-3) var(--space-4);
}

.btn-ghost:hover { color: var(--text-primary); }

/* Size variants — responsive */
.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--fs-lg);
    min-height: 52px;
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--fs-sm);
    min-height: 36px;
}

.btn-block {
    width: 100%;
    display: flex;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

/* Responsive button padding for medium screens */
@media (min-width: 480px) {
    .btn    { padding: var(--space-4) var(--space-6); }
    .btn-lg { padding: var(--space-5) var(--space-10); font-size: var(--fs-xl); }
    .btn-sm { padding: var(--space-2) var(--space-5); }
}

@media (min-width: 768px) {
    .btn-icon { width: 48px; height: 48px; }
}

/* ── Glass Card ── */
.glass-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    transition: all var(--transition-base);
}

.glass-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(124, 58, 237, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(124, 58, 237, 0.1);
}

/* ── Badge ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.badge-free {
    background: rgba(124, 58, 237, 0.2);
    color: var(--purple-300);
    border: 1px solid rgba(124, 58, 237, 0.3);
}

.badge-locked {
    background: rgba(249, 115, 22, 0.15);
    color: var(--coral-400);
    border: 1px solid rgba(249, 115, 22, 0.25);
}

.badge-unlocked {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

/* ── Modal — Mobile-first sheet, desktop centered ── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: var(--z-modal);
    display: flex;
    align-items: flex-end;   /* Slide-up sheet on mobile */
    justify-content: center;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: rgba(22, 15, 36, 0.92);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-2) var(--space-6) var(--space-8);
    width: 100%;
    max-width: 100%;
    position: relative;
    transform: translateY(100%);
    transition: transform var(--transition-spring);
    box-shadow: 0 -8px 48px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Drag handle */
.modal::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-full);
    margin: var(--space-3) auto var(--space-5);
}

.modal-backdrop.active .modal {
    transform: translateY(0);
}

/* Desktop: centered dialog */
@media (min-width: 600px) {
    .modal-backdrop {
        align-items: center;
        padding: var(--space-5);
    }

    .modal {
        max-width: 420px;
        border-radius: var(--radius-xl);
        padding: var(--space-8);
        transform: scale(0.95) translateY(16px);
        box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }

    .modal::before { display: none; }

    .modal-backdrop.active .modal {
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--transition-fast);
    touch-action: manipulation;
}

.modal-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.modal-icon {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: var(--space-3);
}

.modal-title {
    font-size: var(--fs-2xl);
    font-weight: 800;
    text-align: center;
    margin-bottom: var(--space-2);
}

.modal-subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: var(--space-4);
    font-size: var(--fs-sm);
}

/* ── Toast ── */
#toast-container {
    position: fixed;
    bottom: var(--space-6);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    align-items: center;
    pointer-events: none;
    width: calc(100% - 2rem);
    max-width: 400px;
}

.toast {
    background: linear-gradient(135deg, var(--dark-700), var(--dark-600));
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: var(--space-3) var(--space-5);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s var(--transition-spring) forwards;
    white-space: nowrap;
    backdrop-filter: blur(12px);
    text-align: center;
}

.toast.success { border-color: rgba(16, 185, 129, 0.4);  color: #6ee7b7; }
.toast.error   { border-color: rgba(239, 68, 68, 0.4);   color: #fca5a5; }
.toast.hiding  { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px) scale(0.9); }
    to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

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

/* ── Price Tag ── */
.price-tag {
    display: flex;
    align-items: baseline;
    gap: var(--space-1);
    justify-content: center;
}

.price-currency {
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--text-muted);
}

.price-amount {
    font-size: var(--fs-5xl);
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(90deg, var(--purple-400), var(--coral-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.price-period {
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

/* ── Divider ── */
.divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: var(--space-4) 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Player Chip ── */
.player-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.player-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple-500), var(--coral-500));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-xs);
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}

/* ── Progress Bar ── */
.progress-bar {
    height: 4px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--purple-500), var(--coral-400));
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

/* ── Input ── */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.input-label {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-secondary);
    padding-left: var(--space-1);
}

.input-field {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    color: var(--text-primary);
    font-size: var(--fs-base);
    transition: all var(--transition-fast);
    width: 100%;
    min-height: 44px;
}

.input-field::placeholder { color: var(--text-muted); }

.input-field:focus {
    border-color: var(--purple-500);
    background: rgba(124, 58, 237, 0.05);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* ── Emoji animations ── */
.emoji-float {
    display: inline-block;
    animation: floatBounce 3s ease-in-out infinite;
}

@keyframes floatBounce {
    0%, 100% { transform: translateY(0)   rotate(-2deg); }
    50%       { transform: translateY(-8px) rotate(2deg); }
}

/* ── Shimmer (loading) ── */
.shimmer {
    background: linear-gradient(90deg, var(--dark-700) 25%, var(--dark-600) 50%, var(--dark-700) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    from { background-position:  200% 0; }
    to   { background-position: -200% 0; }
}

/* ── Ripple Effect ── */
.ripple { position: relative; overflow: hidden; }

.ripple-wave {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: scale(0);
    animation: rippleAnim 0.6s linear;
    pointer-events: none;
}

@keyframes rippleAnim {
    to { transform: scale(4); opacity: 0; }
}