/* ALERTS */
.error, .success {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 440px;
    width: calc(100% - 32px);
    padding: 12px 16px;
    border-radius: 12px;
    display: none;
    font-size: 13px;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.error {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    color: #fff;
}
.success {
    background: linear-gradient(135deg, #51cf66, #37b24d);
    color: #fff;
}

/* CARD */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 18px;
    padding: 20px 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    margin-bottom: 16px;
}

/* PROGRESS BAR */
.progress-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
}
.progress-step {
    flex: 1;
    height: 3px;
    background: rgba(91, 127, 234, 0.2);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}
.progress-step.active::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #5b7fea, #6b63b5);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #5b7fea, #6b63b5);
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    margin-right: 8px;
}

/* FORM */
.form-group {
    margin-bottom: 14px;
}
label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #1d1d1f;
}
input {
    width: 100%;
    padding: 11px 13px;
    border: 2px solid #f0f0f0;
    border-radius: 11px;
    font-size: 15px;
    background: #fafafa;
    color: #1d1d1f;
    transition: all 0.2s;
}
input:focus {
    outline: none;
    border-color: #5b7fea;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(91, 127, 234, 0.1);
}

/* BUTTONS */
.btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #5b7fea, #6b63b5);
    color: #fff;
    border: 0;
    border-radius: 11px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(91, 127, 234, 0.3);
}
.btn:active {
    transform: scale(0.98);
}
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.btn-secondary {
    background: #fff;
    color: #5b7fea;
    border: 2px solid #5b7fea;
    box-shadow: none;
}
.btn-group {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.btn-group .btn {
    margin-top: 0;
    flex: 1;
}

/* STEPS (регистрация, пополнение и т.п.) */
.step {
    display: none !important;
}
.step.active {
    display: flex !important;
    flex-direction: column;
    height: 100%;
}

/* BALANCE CARD */
.balance-card {
    background: linear-gradient(135deg, #5b7fea, #6b63b5);
    border-radius: 16px;
    padding: 24px 18px;
    margin-bottom: 16px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.balance-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}
.balance-label {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}
.balance {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -2px;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}
.balance-subtitle {
    font-size: 12px;
    opacity: 0.8;
    position: relative;
    z-index: 1;
}

/* STATS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
.stat-card {
    background: #fafafa;
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
}
.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #5b7fea;
    margin-bottom: 4px;
}
.stat-label {
    font-size: 11px;
    color: #86868b;
    font-weight: 500;
}

/* INFO CARD */
.info-card {
    background: #fafafa;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
}
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e5e5e7;
    font-size: 13px;
}
.info-row:last-child {
    border: 0;
}
.info-label {
    color: #86868b;
    font-weight: 500;
}
.info-value {
    color: #1d1d1f;
    font-weight: 600;
}

/* PIN – ОВЕРЛЕЙНЫЕ ЭКРАНЫ (вход и настройка) */
#pin-setup-screen,
#pin-login-screen {
    position: fixed;
    inset: 0;
    display: none !important;
    justify-content: center;
    align-items: center;
    padding: 16px;
    z-index: 900;
    overflow: hidden;
}

/* включение PIN из JS через .active */
#pin-setup-screen.active,
#pin-login-screen.active {
    display: flex !important;
}

/* карточка PIN */
.pin-card {
    max-width: 420px;
    width: 100%;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 18px;
    padding: 20px 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* верх PIN */
.pin-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.pin-title {
    justify-content: center;
    font-size: 20px;
    margin-bottom: 4px;
}

.pin-subtitle {
    margin-bottom: 10px;
    font-size: 13px;
}

/* точки */
.pin-dots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 12px auto;
}
.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e5e5e7;
}
.pin-dot.filled {
    background: linear-gradient(135deg, #5b7fea, #6b63b5) !important;
    transform: scale(1.1);
}

/* клавиатура – крупнее и плотнее */
.pin-keyboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    row-gap: 10px;
    column-gap: 14px;
    max-width: 280px;
    margin: 6px auto 8px;
}
.pin-key {
    width: 64px;
    height: 64px;
    font-size: 26px;
    font-weight: 400;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(91, 127, 234, 0.2);
    border-radius: 50%;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
}
.pin-key:active {
    background: rgba(91, 127, 234, 0.2);
    border-color: #5b7fea;
    transform: scale(0.92);
    box-shadow: 0 0 0 4px rgba(91, 127, 234, 0.1);
}
.pin-key-delete {
    font-size: 24px;
    color: #ff3b30;
}
.pin-later-link {
    display: block;
    margin-top: 12px;
    font-size: 14px;
    color: #5b7fea;
    text-decoration: none;
}
.pin-later-link:active {
    opacity: 0.7;
}


/* FILE UPLOAD */
.file-upload {
    border: 2px dashed #5b7fea;
    border-radius: 16px;
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    background: linear-gradient(
        135deg,
        rgba(91, 127, 234, 0.05),
        rgba(107, 99, 181, 0.05)
    );
}
.file-upload:hover {
    border-color: #6b63b5;
    background: linear-gradient(
        135deg,
        rgba(91, 127, 234, 0.1),
        rgba(107, 99, 181, 0.1)
    );
}
.file-upload input {
    display: none;
}
.file-icon {
    font-size: 56px;
    margin-bottom: 12px;
}
.file-name {
    margin-top: 8px;
    font-size: 13px;
    color: #86868b;
    font-weight: 500;
}

.camera-preview {
    max-width: 100%;
    max-height: 30vh;
    border-radius: 14px;
    margin-bottom: 10px;
}

/* превью фото паспорта/селфи */
.photo-preview-container {
    position: relative;
    width: 100%;
    max-height: 45vh;
    overflow: hidden;
    border-radius: 16px;
    background: #808080;
}
.photo-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    display: flex;
    justify-content: center;
}
.change-photo-btn {
    background: rgba(255,255,255,0.95);
    color: #1d1d1f;
    border: 0;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.change-photo-btn:active {
    transform: scale(0.95);
}

/* TAB BAR */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 8px 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 12px;
}
.tab-item.active {
    background: rgba(91, 127, 234, 0.1);
}
.tab-icon {
    font-size: 24px;
    margin-bottom: 4px;
}
.tab-item.active .tab-icon {
    transform: scale(1.1);
}
.tab-label {
    font-size: 10px;
    font-weight: 600;
    color: #86868b;
}
.tab-item.active .tab-label {
    color: #5b7fea;
}

/* ВКЛАДКИ-КАБИНЕТ (Главная / История / Профиль) */
.screen {
    display: none;
    flex: 1 1 auto;
    overflow-y: auto; /* скролл только внутри экрана */
}
.screen.active {
    display: block;
}

/* Шаги регистрации: карточка может скроллиться внутри */
.step .card {
    max-height: calc(100vh - 170px); /* шапка + отступы */
    overflow-y: auto;
}
