/**
 * Styles dla strony ustawienia nicka
 * scrumonline.eu
 */

/* Główny kontener */
.set-nickname-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, 
        var(--primary-color) 0%, 
        var(--primary-dark) 100%);
}

.nickname-container {
    max-width: 800px;
    width: 100%;
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 3rem 2rem;
    box-shadow: var(--shadow-xl);
    animation: slideInUp 0.4s ease-out;
}

/* Header */
.nickname-header {
    text-align: center;
    margin-bottom: 0;
}

/* Avatar preview w nagłówku (duży) */
.nickname-avatar-preview {
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    animation: bounceIn 0.6s ease-out;
    overflow: hidden;
    border: 4px solid white;
}

.nickname-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-preview-loading {
    color: white;
    font-size: 3rem;
    font-weight: 700;
}

.nickname-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounceIn 0.6s ease-out;
}

.nickname-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.nickname-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Formularz */
.nickname-form {
    margin-bottom: 1.5rem;
}

.nickname-input {
    font-size: 1.25rem;
    padding: 1rem 1.5rem;
    text-align: center;
    font-weight: 600;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.nickname-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    transform: scale(1.02);
}

.nickname-input::placeholder {
    color: rgba(0, 0, 0, 0.35);
    font-weight: 400;
    opacity: 1;
}

.form-help {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
}

/* Przycisk */
.btn-block {
    width: 100%;
    margin-top: 0rem;
    padding: 1rem;
    font-size: 1.125rem;
}

.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Footer */
.nickname-footer {
    text-align: center;
}

.privacy-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin: 0;
}

.privacy-icon {
    font-size: 1rem;
}

/* Grid wyboru avatarów */
.avatar-selection-grid {
    display: grid;
  /*  grid-template-columns: repeat(4, minmax(0, 1fr)); */
    gap: 10px;
    margin: 1rem 0;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
    scrollbar-gutter: stable;
}

/* Loading i error w gridzie avatarów */
.avatar-loading,
.avatar-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.avatar-error {
    color: var(--error-color);
}

.avatar-option {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    background: white;
    transition: all 0.2s ease;
    box-sizing: border-box;
    min-width: 0;
    min-height: 0;
}

.avatar-option:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-color);
}

.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-option.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.avatar-checkmark {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.avatar-option.selected .avatar-checkmark {
    display: flex;
}

/* Scrollbar dla gridu avatarów */
.avatar-selection-grid::-webkit-scrollbar {
    width: 8px;
}

.avatar-selection-grid::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 4px;
}

.avatar-selection-grid::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.avatar-selection-grid::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Visually hidden (dla accessibility) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Animacje */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Dark mode */
[data-theme="dark"] .nickname-container {
    background: var(--bg-card);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .nickname-avatar-preview {
    border-color: var(--bg-card);
}

[data-theme="dark"] .nickname-input {
    background: var(--bg-secondary);
    border-color: var(--border-dark);
    color: var(--text-primary);
}

[data-theme="dark"] .nickname-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

[data-theme="dark"] .avatar-selection-grid {
    background: var(--bg-tertiary);
    border-color: var(--border-dark);
}

[data-theme="dark"] .avatar-option {
    background: var(--bg-secondary);
}

/* Responsywność */
@media (max-width: 640px) {
    .nickname-container {
        padding: 2rem 1.5rem;
    }
    
    .nickname-avatar-preview {
        width: 100px;
        height: 100px;
    }

    .avatar-preview-loading {
        font-size: 2.5rem;
    }
    
    .nickname-title {
        font-size: 1.75rem;
    }
    
    .nickname-subtitle {
        font-size: 1rem;
    }
    
    .nickname-input {
        font-size: 1.125rem;
        padding: 0.875rem 1.25rem;
    }
    
    .btn-block {
        font-size: 1rem;
        padding: 0.875rem;
    }

    .avatar-selection-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
        max-height: 220px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .set-nickname-page {
        padding: 1rem;
    }

    .nickname-container {
        padding: 1.5rem 1rem;
    }

    .nickname-avatar-preview {
        width: 90px;
        height: 90px;
        margin-bottom: 1rem;
    }

    .avatar-preview-loading {
        font-size: 2rem;
    }
    
    .nickname-icon {
        font-size: 3rem;
    }

    .avatar-selection-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        max-height: 200px;
        width: 100%;
    }
}
