/* components.css */

/* =============== BUTTONS =============== */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius-small);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.98);
}

/* Ripple pseudo-element */
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, var(--primary-very-light) 10%, transparent 10.01%);
    transform: scale(10);
    opacity: 0;
    transition: transform 0.5s, opacity 0.5s;
}

.btn:active::after {
    transform: scale(0);
    opacity: 0.3;
    transition: 0s;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}

.btn-primary:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.btn-primary:active {
    background: var(--primary-dark);
    box-shadow: 0 1px 2px rgba(var(--primary-rgb), 0.15);
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-secondary);
    color: var(--primary);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--primary);
    color: white;
}

.btn-danger:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-group .btn {
    flex: 1;
}

/* =============== LOADING & TOASTS =============== */

/* Overlay для затемнения — light theme */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(254, 251, 243, 0.85);
    backdrop-filter: blur(20px);
    z-index: 999;
    display: none;
}

/* Overlay — dark theme */
[data-theme="dark"] .loading-overlay {
    background: rgba(30, 27, 20, 0.85);
}

.loading-overlay.active {
    display: block;
}

.loading {
    display: none;
    text-align: center;
    padding: 48px 32px;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-lg);
    min-width: 320px;
    max-width: 400px;
}

.loading.active {
    display: block;
}

/* iOS-style activity indicator: 12 спиц по кругу, каждая угасает по очереди */
.spinner {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 0;
    background: transparent;
    margin: 18px auto 32px;
    position: relative;
    color: var(--primary);
}

.spinner > i {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 11px;
    margin-left: -2px;
    background: currentColor;
    border-radius: 2px;
    opacity: 0.18;
    transform-origin: 2px 22px;
    animation: iosSpin 1.2s linear infinite;
}
.spinner > i:nth-child(1)  { transform: rotate(  0deg); animation-delay: -1.1s; }
.spinner > i:nth-child(2)  { transform: rotate( 30deg); animation-delay: -1.0s; }
.spinner > i:nth-child(3)  { transform: rotate( 60deg); animation-delay: -0.9s; }
.spinner > i:nth-child(4)  { transform: rotate( 90deg); animation-delay: -0.8s; }
.spinner > i:nth-child(5)  { transform: rotate(120deg); animation-delay: -0.7s; }
.spinner > i:nth-child(6)  { transform: rotate(150deg); animation-delay: -0.6s; }
.spinner > i:nth-child(7)  { transform: rotate(180deg); animation-delay: -0.5s; }
.spinner > i:nth-child(8)  { transform: rotate(210deg); animation-delay: -0.4s; }
.spinner > i:nth-child(9)  { transform: rotate(240deg); animation-delay: -0.3s; }
.spinner > i:nth-child(10) { transform: rotate(270deg); animation-delay: -0.2s; }
.spinner > i:nth-child(11) { transform: rotate(300deg); animation-delay: -0.1s; }
.spinner > i:nth-child(12) { transform: rotate(330deg); animation-delay:  0s; }

@keyframes iosSpin {
    0%   { opacity: 1; }
    100% { opacity: 0.18; }
}

/* Размер-вариант поменьше: для inline */
.spinner.spinner-sm { width: 20px; height: 20px; margin: 6px auto 12px; }
.spinner.spinner-sm > i { height: 5px; transform-origin: 1.25px 10px; }
.spinner.spinner-sm > i:nth-child(1)  { transform: rotate(  0deg); }
.spinner.spinner-sm > i:nth-child(2)  { transform: rotate( 30deg); }
.spinner.spinner-sm > i:nth-child(3)  { transform: rotate( 60deg); }
.spinner.spinner-sm > i:nth-child(4)  { transform: rotate( 90deg); }
.spinner.spinner-sm > i:nth-child(5)  { transform: rotate(120deg); }
.spinner.spinner-sm > i:nth-child(6)  { transform: rotate(150deg); }
.spinner.spinner-sm > i:nth-child(7)  { transform: rotate(180deg); }
.spinner.spinner-sm > i:nth-child(8)  { transform: rotate(210deg); }
.spinner.spinner-sm > i:nth-child(9)  { transform: rotate(240deg); }
.spinner.spinner-sm > i:nth-child(10) { transform: rotate(270deg); }
.spinner.spinner-sm > i:nth-child(11) { transform: rotate(300deg); }
.spinner.spinner-sm > i:nth-child(12) { transform: rotate(330deg); }

/* Inline-вариант (для кнопок/toast'ов): тот же круг, размер 14px */
.spinner-inline {
    display: inline-block;
    width: 14px;
    height: 14px;
    position: relative;
    vertical-align: middle;
    color: currentColor;
}
.spinner-inline > i {
    position: absolute;
    top: 0;
    left: 50%;
    width: 1.5px;
    height: 4px;
    margin-left: -0.75px;
    background: currentColor;
    border-radius: 1px;
    opacity: 0.2;
    transform-origin: 0.75px 7px;
    animation: iosSpin 1.2s linear infinite;
}
.spinner-inline > i:nth-child(1)  { transform: rotate(  0deg); animation-delay: -1.1s; }
.spinner-inline > i:nth-child(2)  { transform: rotate( 30deg); animation-delay: -1.0s; }
.spinner-inline > i:nth-child(3)  { transform: rotate( 60deg); animation-delay: -0.9s; }
.spinner-inline > i:nth-child(4)  { transform: rotate( 90deg); animation-delay: -0.8s; }
.spinner-inline > i:nth-child(5)  { transform: rotate(120deg); animation-delay: -0.7s; }
.spinner-inline > i:nth-child(6)  { transform: rotate(150deg); animation-delay: -0.6s; }
.spinner-inline > i:nth-child(7)  { transform: rotate(180deg); animation-delay: -0.5s; }
.spinner-inline > i:nth-child(8)  { transform: rotate(210deg); animation-delay: -0.4s; }
.spinner-inline > i:nth-child(9)  { transform: rotate(240deg); animation-delay: -0.3s; }
.spinner-inline > i:nth-child(10) { transform: rotate(270deg); animation-delay: -0.2s; }
.spinner-inline > i:nth-child(11) { transform: rotate(300deg); animation-delay: -0.1s; }
.spinner-inline > i:nth-child(12) { transform: rotate(330deg); animation-delay:  0s; }

.loading .section-title {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: center;
    display: block;
}

.loading .text-gray {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    max-width: 280px;
    margin: 0 auto;
    text-align: center;
}

.toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-dark);
    color: white;
    padding: 12px 20px;
    /* 09.10.2026: left:50% сжимал тост до половины экрана, а «таблетка» на длинном
       тексте (отказ с объяснением) рисовала круг поверх кнопок. Ширина — по тексту,
       не шире экрана без полей; скругление — как у карточек. */
    width: max-content;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    border-radius: 18px;
    font-weight: 600;
    z-index: 1001;
    animation: slideDown 0.3s ease-out;
    text-align: center;
    line-height: 1.3;
}

.toast.error {
    background: var(--primary);
}

/* =============== MODALS =============== */

/* Success Modal */
.success-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 99999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(254, 251, 243, 0.85);
    backdrop-filter: blur(20px);
}

[data-theme="dark"] .modal-overlay {
    background: rgba(30, 27, 20, 0.85);
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 32px 24px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.modal-icon {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.modal-message {
    font-size: 16px;
    line-height: 1.5;
    margin: 0 0 24px 0;
    color: var(--text-secondary);
}

.modal-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 500;
}

/* =============== VIDEO MODAL =============== */
.video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.video-modal {
    background: var(--surface);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.video-header {
    background: var(--primary);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.video-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.close-video-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--border-radius-small);
    transition: var(--transition-fast);
}

.close-video-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.video-content {
    padding: 20px;
}

/* === OTP code input (authorization) === */
.otp-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 8px 0 16px;
}
.otp-cell {
    width: 56px;
    height: 64px;
    text-align: center;
    font-size: 28px;
    font-weight: 600;
    line-height: 1;
    color: #2A2A2A;
    border: 2px solid var(--border);
    border-radius: 14px;
    background: #F7F6F4;
    outline: none;
    caret-color: var(--primary);
    transition: border-color 0.18s ease, transform 0.12s ease, background 0.18s ease, box-shadow 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
    -webkit-user-select: text;
    user-select: text;
}
.otp-cell:focus {
    border-color: var(--primary);
    background: #fff;
    transform: scale(1.04);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}
.otp-cell.filled {
    border-color: var(--primary);
    background: #fff;
}
.otp-cell.error {
    border-color: #E55;
    background: #FFF3F3;
    animation: otp-shake 0.32s ease;
}
@keyframes otp-shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}
@media (max-width: 360px) {
    .otp-row { gap: 8px; }
    .otp-cell { width: 50px; height: 58px; font-size: 24px; }
}

