/*
 * result.css — Стили страницы результата и истории
 * Dark + gold theme matching common.css
 */

/* ── Result Page ── */
.result-page {
    width: 100%; max-width: var(--container);
    padding: 0 clamp(16px, 5vw, 30px);
    z-index: 10;
    display: flex; flex-direction: column;
    align-items: center; gap: clamp(16px, 3vh, 24px);
    padding-bottom: 40px;
}

/* ── Loading State ── */
.result-loading {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    min-height: 50vh; gap: 24px;
    text-align: center;
}

.loading-orb {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--gold-rgb), 0.15) 0%, transparent 70%);
    border: 1.5px solid var(--gold-border);
    display: flex; align-items: center; justify-content: center;
    animation: pulse-orb 2s ease-in-out infinite;
}

.loading-orb-inner {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--gold);
    border-right-color: var(--gold-dim);
    animation: spin-orb 1.2s linear infinite;
}

@keyframes pulse-orb {
    0%, 100% { box-shadow: 0 0 20px rgba(var(--gold-rgb), 0.1); }
    50% { box-shadow: 0 0 40px rgba(var(--gold-rgb), 0.25); }
}

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

.loading-text {
    font-family: var(--font-display);
    font-size: clamp(14px, 3.1vw, 14px);
    color: var(--text-dim);
    letter-spacing: 0.05em;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(3) infinite;
}

@keyframes dots {
    0% { content: ''; }
    33% { content: '.'; }
    66% { content: '..'; }
    100% { content: '...'; }
}

/* ── Result Content ── */
.result-content {
    width: 100%;
    animation: fadeInUp 0.6s ease;
}

.result-meta {
    text-align: center;
    margin-bottom: clamp(12px, 2vh, 20px);
}

.result-type {
    font-family: var(--font-display);
    font-size: clamp(10px, 2.2vw, 11px);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--gold-dim);
    margin-bottom: 4px;
}

.result-date {
    font-size: clamp(10px, 2.2vw, 10px);
    color: var(--text-dim);
    opacity: 0.5;
}

.result-question {
    text-align: center;
    font-family: var(--font-display);
    font-size: clamp(14px, 3.6vw, 16px);
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: clamp(16px, 3vh, 24px);
    font-style: italic;
    opacity: 0.85;
}

/* ── Cards Display ── */
.result-cards {
    display: flex;
    justify-content: center;
    gap: clamp(8px, 2vw, 14px);
    flex-wrap: wrap;
    margin-bottom: clamp(16px, 3vh, 24px);
}

.result-card {
    width: clamp(70px, 20vw, 100px);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--gold-border);
    background: rgba(var(--gold-rgb), 0.04);
    transition: transform 0.3s ease;
    position: relative;
}

.result-card:hover {
    transform: translateY(-4px);
}

.result-card img {
    width: 100%;
    height: auto;
    display: block;
}

.result-card.reversed img {
    transform: rotate(180deg);
}

.result-card-name {
    font-size: clamp(8px, 1.8vw, 9px);
    text-align: center;
    padding: 4px 2px;
    color: var(--text-dim);
    font-weight: 400;
    letter-spacing: 0.03em;
    line-height: 1.2;
}

.result-card-position {
    font-size: 8px;
    text-align: center;
    padding: 0 2px 4px;
    color: var(--gold-dim);
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── Interpretation ── */
.result-interpretation {
    width: 100%;
    padding: clamp(16px, 3vw, 24px);
    background: rgba(var(--gold-rgb), 0.04);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-xl);
}

.result-interpretation-text {
    font-family: var(--font-body);
    font-size: clamp(14px, 3.1vw, 14px);
    line-height: 1.7;
    color: var(--text-light);
    opacity: 0.9;
    white-space: pre-line;
}

.result-interpretation-text p {
    margin-bottom: 12px;
}

.result-interpretation-text p:last-child {
    margin-bottom: 0;
}

.result-interpretation-text strong,
.result-interpretation-text b {
    color: var(--gold);
    font-weight: 600;
}

.result-interpretation-text em,
.result-interpretation-text i {
    color: var(--gold-bright);
}

/* ── Actions ── */
.result-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: clamp(8px, 2vh, 16px);
}

.btn-result {
    display: block;
    width: 100%;
    padding: clamp(14px, 2.5vh, 18px);
    background: transparent;
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-pill);
    color: var(--gold);
    font-family: var(--font-display);
    font-size: clamp(12px, 2.7vw, 13px);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: var(--transition);
}

.btn-result:hover {
    background: rgba(var(--gold-rgb), 0.08);
    border-color: var(--gold-border-active);
}

.btn-result.primary {
    background: rgba(var(--gold-rgb), 0.1);
    border-color: var(--gold-dim);
}

/* ── Error State ── */
.result-error {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    min-height: 40vh; gap: 16px;
    text-align: center;
}

.result-error-icon {
    font-size: 36px;
    opacity: 0.5;
}

.result-error-text {
    font-size: clamp(14px, 3.1vw, 14px);
    color: var(--text-dim);
}

/* ═══════════════════════════════════════
   History Page
   ═══════════════════════════════════════ */

.history-page {
    width: 100%; max-width: var(--container);
    padding: 0 clamp(16px, 5vw, 30px);
    z-index: 10;
    padding-bottom: 40px;
}

.history-title {
    text-align: center;
    margin: clamp(12px, 2vh, 20px) 0;
}

.history-title h1 {
    font-family: var(--font-display);
    font-size: clamp(16px, 4.5vw, 20px);
    font-weight: 600;
    color: var(--text-light);
    letter-spacing: 0.05em;
}

/* ── History List ── */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: clamp(10px, 3vw, 16px);
    padding: clamp(12px, 2.5vw, 16px);
    background: rgba(var(--gold-rgb), 0.04);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-xl);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    animation: fadeInUp 0.4s ease backwards;
}

.history-item:hover {
    background: rgba(var(--gold-rgb), 0.08);
    border-color: var(--gold-border-active);
}

.history-item:nth-child(1) { animation-delay: 0s; }
.history-item:nth-child(2) { animation-delay: 0.05s; }
.history-item:nth-child(3) { animation-delay: 0.1s; }
.history-item:nth-child(4) { animation-delay: 0.15s; }
.history-item:nth-child(5) { animation-delay: 0.2s; }

.history-icon {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(var(--gold-rgb), 0.08);
    border: 1px solid var(--gold-border);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-item-type {
    font-family: var(--font-display);
    font-size: clamp(13px, 3.1vw, 13px);
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 2px;
}

.history-item-question {
    font-size: clamp(11px, 2.5vw, 11px);
    color: var(--text-dim);
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-date {
    font-size: clamp(10px, 2.2vw, 10px);
    color: var(--text-dim);
    opacity: 0.5;
    white-space: nowrap;
    margin-top: 2px;
}

.history-arrow {
    width: 16px; height: 16px;
    stroke: var(--gold-dim);
    stroke-width: 2;
    fill: none;
    opacity: 0.5;
    flex-shrink: 0;
}

/* ── Empty History ── */
.history-empty {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    min-height: 40vh; gap: 16px;
    text-align: center;
}

.history-empty-icon {
    font-size: 43px;
    opacity: 0.3;
}

.history-empty-text {
    font-size: clamp(14px, 3.1vw, 14px);
    color: var(--text-dim);
    opacity: 0.6;
}

/* ── Pagination ── */
.history-pagination {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: clamp(16px, 3vh, 24px);
}

.btn-page {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-pill);
    color: var(--gold-dim);
    font-family: var(--font-display);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: var(--transition);
}

.btn-page:hover:not(:disabled) {
    background: rgba(var(--gold-rgb), 0.08);
    border-color: var(--gold-border-active);
    color: var(--gold);
}

.btn-page:disabled {
    opacity: 0.3;
    cursor: default;
}

/* History item not-ready indicator */
.history-item.processing .history-icon {
    animation: pulse-orb 2s ease-in-out infinite;
}

.history-status-badge {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: rgba(var(--gold-rgb), 0.1);
    color: var(--gold-dim);
}
