/* ============================================================
   Предсказания от ИИ — стили фронтенда и админки
   ============================================================ */

/* ============================
   ПЕРЕМЕННЫЕ
   ============================ */

.pai-container {
    --pai-accent: #9b59b6;
    --pai-bg: #0d0d1a;
    --pai-text: #e8e8f0;
    --pai-muted: #8888a0;
    --pai-border: #2a2a3e;
    --pai-card: #16162a;
    --pai-radius: 16px;
    --pai-font: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ============================
   КОНТЕЙНЕР
   ============================ */

.pai-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 30px 20px;
    background: radial-gradient(ellipse at top, #1a1a2e 0%, #0d0d1a 100%);
    border-radius: var(--pai-radius);
    font-family: var(--pai-font);
    color: var(--pai-text);
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ============================
   ЗАГОЛОВОК
   ============================ */

.pai-header {
    margin-bottom: 25px;
}

.pai-title {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 10px;
    color: var(--pai-accent);
    text-shadow: 0 0 20px color-mix(in srgb, var(--pai-accent) 40%, transparent);
}

.pai-description {
    font-size: 14px;
    color: var(--pai-muted);
    margin: 0;
    line-height: 1.5;
}

/* ============================
   МАГИЧЕСКИЙ ШАР
   ============================ */

.pai-orb-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
    perspective: 1000px;
}

.pai-orb {
    position: relative;
    width: 240px;
    height: 240px;
    cursor: pointer;
}

.pai-orb-glow {
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--pai-accent) 30%, transparent) 0%, transparent 70%);
    animation: pai-pulse 3s ease-in-out infinite;
}

/* Орбитальные кольца */
.pai-orb-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--pai-accent) 25%, transparent);
    pointer-events: none;
}

.pai-orb-ring-1 {
    top: -15px; left: -15px; right: -15px; bottom: -15px;
    border-top-color: color-mix(in srgb, var(--pai-accent) 60%, transparent);
    animation: pai-ring-spin 8s linear infinite;
}

.pai-orb-ring-2 {
    top: -30px; left: -30px; right: -30px; bottom: -30px;
    border-right-color: color-mix(in srgb, var(--pai-accent) 50%, transparent);
    animation: pai-ring-spin-reverse 12s linear infinite;
}

.pai-orb-ring-3 {
    top: -45px; left: -45px; right: -45px; bottom: -45px;
    border-bottom-color: color-mix(in srgb, var(--pai-accent) 40%, transparent);
    border-style: dashed;
    animation: pai-ring-spin 16s linear infinite;
}

.pai-orb.thinking .pai-orb-ring-1 { animation-duration: 2s; }
.pai-orb.thinking .pai-orb-ring-2 { animation-duration: 3s; }
.pai-orb.thinking .pai-orb-ring-3 { animation-duration: 4s; }

.pai-orb-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #2a2a4e 0%, #1a1a2e 50%, #0a0a1a 100%);
    border: 2px solid color-mix(in srgb, var(--pai-accent) 30%, transparent);
    box-shadow:
        inset 0 0 60px rgba(0, 0, 0, 0.8),
        0 0 40px color-mix(in srgb, var(--pai-accent) 20%, transparent);
    overflow: hidden;
    transition: all 0.5s ease;
}

.pai-orb.thinking .pai-orb-inner {
    border-color: var(--pai-accent);
    box-shadow:
        inset 0 0 60px color-mix(in srgb, var(--pai-accent) 20%, transparent),
        0 0 60px color-mix(in srgb, var(--pai-accent) 50%, transparent);
}

/* Блик на шаре */
.pai-orb-inner::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 30%;
    height: 25%;
    background: radial-gradient(ellipse, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* Туман в шаре — три слоя */
.pai-orb-mist {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.pai-orb-mist-1 {
    background: radial-gradient(ellipse at 30% 40%, color-mix(in srgb, var(--pai-accent) 25%, transparent) 0%, transparent 50%);
    animation: pai-mist 8s ease-in-out infinite;
    opacity: 0.6;
}

.pai-orb-mist-2 {
    background: radial-gradient(ellipse at 70% 30%, color-mix(in srgb, var(--pai-accent) 20%, transparent) 0%, transparent 45%);
    animation: pai-mist-2 10s ease-in-out infinite;
    opacity: 0.5;
}

.pai-orb-mist-3 {
    background: radial-gradient(ellipse at 50% 70%, color-mix(in srgb, var(--pai-accent) 15%, transparent) 0%, transparent 40%);
    animation: pai-mist-3 12s ease-in-out infinite;
    opacity: 0.4;
}

.pai-orb.thinking .pai-orb-mist-1 { opacity: 1; animation: pai-mist-fast 2s ease-in-out infinite; }
.pai-orb.thinking .pai-orb-mist-2 { opacity: 0.9; animation: pai-mist-fast-2 2.5s ease-in-out infinite; }
.pai-orb.thinking .pai-orb-mist-3 { opacity: 0.8; animation: pai-mist-fast-3 3s ease-in-out infinite; }

/* Звёзды */
.pai-orb-stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.pai-star {
    position: absolute;
    color: color-mix(in srgb, var(--pai-accent) 60%, white);
    font-size: 14px;
    opacity: 0;
    animation: pai-twinkle 4s ease-in-out infinite;
}

.pai-star-1 { top: 25%; left: 30%; animation-delay: 0s; }
.pai-star-2 { top: 40%; left: 65%; animation-delay: 0.5s; }
.pai-star-3 { top: 60%; left: 35%; animation-delay: 1s; }
.pai-star-4 { top: 30%; left: 55%; animation-delay: 1.5s; font-size: 10px; }
.pai-star-5 { top: 55%; left: 60%; animation-delay: 2s; font-size: 10px; }
.pai-star-6 { top: 20%; left: 50%; animation-delay: 2.5s; font-size: 12px; }
.pai-star-7 { top: 45%; left: 25%; animation-delay: 3s; font-size: 8px; }
.pai-star-8 { top: 70%; left: 50%; animation-delay: 3.5s; font-size: 12px; }
.pai-star-9 { top: 35%; left: 70%; animation-delay: 0.3s; font-size: 9px; }
.pai-star-10 { top: 65%; left: 65%; animation-delay: 1.8s; font-size: 9px; }

/* Летающие блёстки */
.pai-orb-sparkles {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

.pai-sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 6px 2px color-mix(in srgb, var(--pai-accent) 60%, white);
    opacity: 0;
    animation: pai-sparkle-float 6s ease-in-out infinite;
}

.pai-sparkle-1 { top: 20%; left: 20%; animation-delay: 0s; }
.pai-sparkle-2 { top: 30%; left: 70%; animation-delay: 0.8s; }
.pai-sparkle-3 { top: 50%; left: 15%; animation-delay: 1.5s; }
.pai-sparkle-4 { top: 60%; left: 75%; animation-delay: 2.2s; }
.pai-sparkle-5 { top: 75%; left: 30%; animation-delay: 3s; }
.pai-sparkle-6 { top: 15%; left: 45%; animation-delay: 3.8s; }
.pai-sparkle-7 { top: 80%; left: 55%; animation-delay: 4.5s; }
.pai-sparkle-8 { top: 40%; left: 85%; animation-delay: 5.2s; }

.pai-orb.thinking .pai-sparkle {
    animation: pai-sparkle-float-fast 1.5s ease-in-out infinite;
}

.pai-orb.thinking .pai-star {
    animation: pai-twinkle-fast 0.8s ease-in-out infinite;
}

/* Текст ответа внутри шара */
.pai-orb-answer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    font-size: 12px;
    line-height: 1.4;
    color: var(--pai-accent);
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    text-shadow: 0 0 10px color-mix(in srgb, var(--pai-accent) 50%, transparent);
}

.pai-orb.answered .pai-orb-answer {
    opacity: 1;
}

/* Подставка шара */
.pai-orb-base {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 20px;
    background: linear-gradient(to bottom, #2a2a3e, #1a1a2e);
    border-radius: 50%;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

/* ============================
   ФОРМА
   ============================ */

.pai-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.pai-question-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--pai-card) !important;
    border: 1px solid var(--pai-border);
    border-radius: 12px;
    color: var(--pai-text) !important;
    font-family: var(--pai-font);
    font-size: 15px;
    resize: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

.pai-question-input:focus {
    outline: none;
    border-color: var(--pai-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--pai-accent) 20%, transparent);
    color: var(--pai-text) !important;
}

.pai-question-input::placeholder {
    color: var(--pai-muted) !important;
    opacity: 1;
}

.pai-question-input::-webkit-input-placeholder { color: var(--pai-muted) !important; opacity: 1; }
.pai-question-input::-moz-placeholder { color: var(--pai-muted) !important; opacity: 1; }
.pai-question-input:-ms-input-placeholder { color: var(--pai-muted) !important; opacity: 1; }

.pai-button {
    padding: 14px 30px;
    background: linear-gradient(135deg, var(--pai-accent), color-mix(in srgb, var(--pai-accent) 70%, black));
    color: white;
    border: none;
    border-radius: 12px;
    font-family: var(--pai-font);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
}

.pai-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--pai-accent) 40%, transparent);
}

.pai-button:active:not(:disabled) {
    transform: translateY(0);
}

.pai-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Спиннер */
.pai-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: pai-spin 0.8s linear infinite;
}

/* ============================
   РЕЗУЛЬТАТ
   ============================ */

.pai-result {
    margin-top: 20px;
    padding: 20px;
    background: var(--pai-card);
    border: 1px solid var(--pai-border);
    border-left: 3px solid var(--pai-accent);
    border-radius: 12px;
    text-align: left;
    animation: pai-fade-in 0.5s ease;
}

.pai-result-label {
    font-size: 13px;
    color: var(--pai-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pai-result-text {
    font-size: 16px;
    line-height: 1.6;
    color: var(--pai-text);
    font-style: italic;
}

/* ============================
   СООБЩЕНИЯ
   ============================ */

.pai-message {
    margin-top: 20px;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.5;
    text-align: center;
    animation: pai-fade-in 0.5s ease;
}

.pai-message.pai-error {
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: #ff9999;
}

.pai-message.pai-limit {
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid rgba(255, 170, 0, 0.3);
    color: #ffcc66;
}

.pai-message.pai-timer {
    margin-top: 10px;
    font-size: 13px;
    color: var(--pai-muted);
}

.pai-premium-link {
    text-align: center;
    margin-top: 15px;
}

.pai-premium-btn {
    display: inline-block;
    padding: 12px 25px;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 14px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.pai-premium-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4);
    color: white;
}

/* ============================
   АНИМАЦИИ
   ============================ */

@keyframes pai-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

@keyframes pai-mist {
    0%, 100% { transform: rotate(0deg) scale(1); }
    33% { transform: rotate(120deg) scale(1.1); }
    66% { transform: rotate(240deg) scale(0.95); }
}

@keyframes pai-mist-fast {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.15); }
    50% { transform: rotate(180deg) scale(0.9); }
    75% { transform: rotate(270deg) scale(1.1); }
}

@keyframes pai-twinkle {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1); }
}

@keyframes pai-twinkle-fast {
    0%, 100% { opacity: 0.2; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1.3); }
}

/* Орбитальные кольца */
@keyframes pai-ring-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pai-ring-spin-reverse {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

/* Дополнительные слои тумана */
@keyframes pai-mist-2 {
    0%, 100% { transform: rotate(0deg) scale(1); }
    33% { transform: rotate(-120deg) scale(1.08); }
    66% { transform: rotate(-240deg) scale(0.92); }
}

@keyframes pai-mist-3 {
    0%, 100% { transform: rotate(60deg) scale(1); }
    50% { transform: rotate(-180deg) scale(1.12); }
}

@keyframes pai-mist-fast-2 {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-90deg) scale(1.1); }
    50% { transform: rotate(-180deg) scale(0.95); }
    75% { transform: rotate(-270deg) scale(1.15); }
}

@keyframes pai-mist-fast-3 {
    0%, 100% { transform: rotate(60deg) scale(1); }
    50% { transform: rotate(-180deg) scale(1.2); }
}

/* Блёстки */
@keyframes pai-sparkle-float {
    0%, 100% { opacity: 0; transform: translate(0, 0) scale(0.5); }
    10% { opacity: 1; }
    50% { opacity: 0.8; transform: translate(15px, -15px) scale(1.2); }
    90% { opacity: 0.3; }
}

@keyframes pai-sparkle-float-fast {
    0%, 100% { opacity: 0; transform: translate(0, 0) scale(0.5); }
    20% { opacity: 1; }
    50% { opacity: 1; transform: translate(20px, -20px) scale(1.5); }
    80% { opacity: 0.5; }
}

@keyframes pai-spin {
    to { transform: rotate(360deg); }
}

@keyframes pai-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================
   АДАПТИВНОСТЬ
   ============================ */

@media (max-width: 480px) {
    .pai-container {
        padding: 20px 15px;
    }

    .pai-title {
        font-size: 22px;
    }

    .pai-orb {
        width: 180px;
        height: 180px;
    }

    .pai-button {
        padding: 12px 20px;
        font-size: 15px;
    }
}

/* ============================
   АДМИНКА
   ============================ */

.pai-wrap h1 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pai-prices-info {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-left: 4px solid #72aee6;
    padding: 10px 15px;
    margin: 15px 0;
    border-radius: 4px;
}

.pai-price-row td {
    padding: 8px 10px;
}

/* Карточки статистики */
.pai-stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.pai-stat-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    padding: 15px 20px;
    transition: border-color 0.3s;
}

.pai-stat-card.pai-stat-danger {
    border-color: #d63638;
    background: #fef7f7;
}

.pai-stat-label {
    font-size: 12px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.pai-stat-value {
    font-size: 20px;
    font-weight: 600;
    color: #1d2327;
}

.pai-stat-bar {
    margin-top: 10px;
    height: 6px;
    background: #f0f0f1;
    border-radius: 3px;
    overflow: hidden;
}

.pai-stat-fill {
    height: 100%;
    background: linear-gradient(to right, #00a32a, #72aee6);
    transition: width 0.5s ease;
}

.pai-stat-card.pai-stat-danger .pai-stat-fill {
    background: linear-gradient(to right, #d63638, #f86368);
}