/* ============================================
   PIN PROTECTION STYLES
   ============================================ */

.pin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.pin-overlay.active {
    opacity: 1;
}

.pin-content {
    background: var(--tg-theme-bg-color, #1c1c1e);
    border-radius: 24px;
    padding: 40px 32px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.pin-overlay.active .pin-content {
    transform: scale(1);
}

.pin-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: white;
}

.pin-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--tg-theme-text-color, #ffffff);
    margin: 0 0 8px 0;
}

.pin-message {
    font-size: 15px;
    color: var(--tg-theme-hint-color, #8e8e93);
    margin: 0 0 32px 0;
}

.pin-input-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.pin-input {
    width: 60px;
    height: 60px;
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    border: 2px solid var(--tg-theme-button-color, #667eea);
    border-radius: 12px;
    background: var(--tg-theme-secondary-bg-color, #2c2c2e);
    color: var(--tg-theme-text-color, #ffffff);
    caret-color: transparent;
    transition: all 0.2s ease;
}

.pin-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
    transform: scale(1.05);
}

.pin-dots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
    height: 12px;
}

.pin-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--tg-theme-hint-color, #8e8e93);
    opacity: 0.3;
    transition: all 0.3s ease;
}

.pin-dot.filled {
    opacity: 1;
    background: #667eea;
    transform: scale(1.2);
}

.pin-hint {
    font-size: 13px;
    color: var(--tg-theme-hint-color, #8e8e93);
    margin: 0 0 24px 0;
}

.pin-lockout {
    padding: 24px;
    background: var(--tg-theme-secondary-bg-color, #2c2c2e);
    border-radius: 12px;
    margin-bottom: 24px;
}

.pin-lockout i {
    font-size: 48px;
    color: #FF9F0A;
    margin-bottom: 12px;
}

.pin-lockout p {
    margin: 8px 0;
    color: var(--tg-theme-text-color, #ffffff);
}

.lockout-timer {
    font-size: 18px;
    font-weight: 600;
    color: #FF9F0A;
}

.pin-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pin-btn {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pin-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.pin-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.pin-btn-secondary {
    background: var(--tg-theme-secondary-bg-color, #2c2c2e);
    color: var(--tg-theme-text-color, #ffffff);
}

.pin-btn-secondary:hover:not(:disabled) {
    background: var(--tg-theme-bg-color, #1c1c1e);
}

/* Анимация ошибки */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.pin-input-container.shake {
    animation: shake 0.5s;
}

/* Адаптация для светлой темы */
@media (prefers-color-scheme: light) {
    .pin-overlay {
        background: rgba(255, 255, 255, 0.95);
    }
    
    .pin-content {
        background: #ffffff;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    }
    
    .pin-input {
        background: #f2f2f7;
    }
    
    .pin-lockout {
        background: #f2f2f7;
    }
    
    .pin-btn-secondary {
        background: #f2f2f7;
        color: #000000;
    }
    
    .pin-btn-secondary:hover:not(:disabled) {
        background: #e5e5ea;
    }
}

/* Адаптивность */
@media (max-width: 480px) {
    .pin-content {
        padding: 32px 24px;
    }
    
    .pin-icon {
        width: 70px;
        height: 70px;
        font-size: 35px;
        margin-bottom: 20px;
    }
    
    .pin-title {
        font-size: 20px;
    }
    
    .pin-message {
        font-size: 14px;
    }
    
    .pin-input {
        width: 50px;
        height: 50px;
        font-size: 28px;
    }
}

/* Скрытие системной клавиатуры на iOS */
.pin-input {
    -webkit-user-select: none;
    user-select: none;
}
