/* ============================================================
   БАЗА
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0a0a0f;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.08);
    --text: #f5f5f7;
    --text-dim: #8a8a95;
    --accent: #7c5cff;
    --accent-2: #ff5ca8;
}

html, body {
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    padding: 32px 16px 48px;
}

/* Фоновое свечение */
.bg-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(600px circle at 20% 0%, rgba(124, 92, 255, 0.25), transparent 60%),
        radial-gradient(500px circle at 80% 100%, rgba(255, 92, 168, 0.18), transparent 60%);
    animation: glowShift 12s ease-in-out infinite alternate;
}

@keyframes glowShift {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(0, -20px) scale(1.05); }
}

.container {
    position: relative;
    z-index: 1;
    max-width: 480px;
    margin: 0 auto;
}

/* ============================================================
   ПРОФИЛЬ
   ============================================================ */
.profile {
    text-align: center;
    margin-bottom: 32px;
    animation: fadeUp 0.6s ease both;
}

.avatar-wrap {
    position: relative;
    width: 110px;
    height: 110px;
    margin: 0 auto 16px;
}

.avatar-wrap::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent));
    animation: spin 6s linear infinite;
    z-index: -1;
}

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

.avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--bg);
    display: block;
}

.name {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.username {
    color: var(--accent);
    font-size: 14px;
    font-weight: 500;
    margin-top: 2px;
}

.bio {
    color: var(--text-dim);
    font-size: 15px;
    margin-top: 12px;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================================
   ССЫЛКИ (карточки)
   ============================================================ */
.links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background 0.25s, transform 0.25s, border-color 0.25s;
    animation: fadeUp 0.5s ease both;
    animation-delay: var(--delay, 0s);
    will-change: transform;
}

.link:hover {
    background: var(--bg-card-hover);
    border-color: rgba(124, 92, 255, 0.4);
    transform: translateY(-2px);
}

.link:active {
    transform: translateY(0) scale(0.99);
}

.link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(124, 92, 255, 0.12);
    color: var(--accent);
    flex-shrink: 0;
    transition: background 0.25s, color 0.25s;
}

.link:hover .link-icon {
    background: var(--accent);
    color: #fff;
}

.link-title {
    flex: 1;
}

.link-arrow {
    color: var(--text-dim);
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.25s, transform 0.25s;
}

.link:hover .link-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================================
   ФУТЕР + КНОПКИ
   ============================================================ */
.footer {
    margin-top: 28px;
    text-align: center;
    animation: fadeUp 0.6s ease 0.4s both;
}

.share-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.share-btn:hover {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(124, 92, 255, 0.08);
}

.share-btn.danger {
    color: #ff8a8a;
    border-color: rgba(255, 92, 92, 0.35);
}

.share-btn.danger:hover {
    color: #fff;
    background: rgba(255, 92, 92, 0.15);
    border-color: rgba(255, 92, 92, 0.7);
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent);
    color: #fff;
    padding: 12px 22px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s;
    z-index: 100;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ============================================================
   АНИМАЦИИ
   ============================================================ */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   ФОРМА ЛОГИНА
   ============================================================ */
.login-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 24px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    text-align: center;
    animation: fadeUp 0.5s ease both;
}

.input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

/* ============================================================
   ЗАГОЛОВКИ СЕКЦИЙ
   ============================================================ */
.section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    margin-bottom: 12px;
}

/* ============================================================
   ПРОГРЕСС-БАР
   ============================================================ */
.progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
    margin: -6px 0 10px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.34, 1.2, 0.64, 1);
    animation: growBar 0.8s ease both;
    transform-origin: left;
}

@keyframes growBar {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* ============================================================
   ПОСЛЕДНИЕ КЛИКИ / ЖУРНАЛ
   ============================================================ */
.recent {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: fadeUp 0.5s ease both;
}

.recent-row {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.recent-row:last-child {
    border-bottom: none;
}

.recent-row:hover {
    background: var(--bg-card-hover);
}

.recent-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.recent-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-meta {
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   ТАБЫ (админка)
   ============================================================ */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    padding: 10px 14px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ============================================================
   УВЕДОМЛЕНИЯ
   ============================================================ */
.ok, .err {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 14px;
}
.ok  {
    background: rgba(126, 231, 135, 0.1);
    color: #7ee787;
    border: 1px solid rgba(126, 231, 135, 0.3);
}
.err {
    background: rgba(255, 92, 92, 0.1);
    color: #ff8a8a;
    border: 1px solid rgba(255, 92, 92, 0.3);
}

/* ============================================================
   ФОРМЫ (админка)
   ============================================================ */
.card-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-form label {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 8px;
}

.card-form select.input {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
                      linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 32px;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

/* ============================================================
   СТРОКИ ССЫЛОК (админка)
   ============================================================ */
.admin-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: fadeUp 0.4s ease both;
}

.admin-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-row-main strong {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-row-main small {
    color: var(--text-dim);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    font-family: inherit;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.icon-btn:hover:not(:disabled) {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(124, 92, 255, 0.08);
}

.icon-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.icon-btn.danger:hover:not(:disabled) {
    color: #fff;
    border-color: rgba(255, 92, 92, 0.7);
    background: rgba(255, 92, 92, 0.15);
}

/* ============================================================
   СЕКРЕТ 2FA
   ============================================================ */
.secret-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 15px;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-top: 10px;
    text-align: center;
    user-select: all;
    word-break: break-all;
}

/* ============================================================
   ШАПКА СТАТИСТИКИ
   ============================================================ */
.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: fadeUp 0.5s ease both;
}

.stat-total-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
}

.stat-total-value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--accent);
    line-height: 1.1;
    margin-top: 2px;
}

/* ============================================================
   МОБИЛКА
   ============================================================ */
@media (max-width: 480px) {
    body { padding: 24px 14px 40px; }
    .avatar-wrap { width: 92px; height: 92px; }
    .name { font-size: 21px; }
    .link { padding: 14px 16px; font-size: 14.5px; }
    .link-icon { width: 34px; height: 34px; }
    .tabs { gap: 4px; }
    .tab { padding: 9px 11px; font-size: 13px; }
    .admin-row { padding: 8px 10px; gap: 6px; }
    .icon-btn { width: 28px; height: 28px; font-size: 13px; }
    .card-form { padding: 16px; }
    .stat-header { padding: 16px 18px; }
    .stat-total-value { font-size: 26px; }
}

/* ============================================================
   УВАЖЕНИЕ К НАСТРОЙКАМ АНИМАЦИЙ
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
/* ============================================================
   FOOTER-LINK (маленькая ссылка в футере)
   ============================================================ */
.footer-link {
    font-size: 12px;
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ============================================================
   COOKIE-БАННЕР
   ============================================================ */
.cookie-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 200;
    max-width: 560px;
    margin: 0 auto;
    padding: 16px 18px;
    background: rgba(20, 20, 28, 0.92);
    border: 1px solid var(--border);
    border-radius: 14px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    pointer-events: none;
}

.cookie-banner.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.cookie-text {
    flex: 1;
    min-width: 200px;
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

.cookie-text a {
    color: var(--accent);
    text-decoration: none;
}

.cookie-text a:hover {
    text-decoration: underline;
}

.cookie-banner .share-btn {
    flex-shrink: 0;
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 500;
}

.cookie-banner .share-btn:hover {
    background: #6a4ef0;
    border-color: #6a4ef0;
    color: #fff;
}

@media (max-width: 480px) {
    .cookie-banner {
        padding: 14px 16px;
        gap: 10px;
    }
    .cookie-text { font-size: 12.5px; }
    .cookie-banner .share-btn { width: 100%; }
}

/* ============================================================
   ЮРИДИЧЕСКИЕ СТРАНИЦЫ (privacy.php)
   ============================================================ */
.legal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px 22px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: fadeUp 0.5s ease both;
}

.legal h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-top: 20px;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.legal h2:first-child { margin-top: 0; }

.legal p,
.legal li {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.65;
}

.legal p + p { margin-top: 10px; }

.legal ul {
    margin: 8px 0 0 18px;
    padding: 0;
}

.legal li { margin-bottom: 6px; }

.legal strong { color: var(--text); font-weight: 500; }

.legal code {
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 13px;
    color: var(--accent);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (max-width: 480px) {
    .legal { padding: 20px 16px; }
    .legal h2 { font-size: 14px; }
    .legal p, .legal li { font-size: 13.5px; }
}