/**
 * @file profile-modal.css
 * @description Modal de perfil do usuário - Superchart
 *
 * Contém:
 *  - .profile-overlay (backdrop)
 *  - .profile-modal (container principal)
 *  - Profile header, stats, insights, social links
 *
 * Depende de: variables.css
 */

/* ── Profile Overlay ───────────────────────────────────── */

.profile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    z-index: 9997;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: profileOverlayFadeIn 0.2s ease-out;
}

.profile-overlay.open {
    display: flex;
}

@keyframes profileOverlayFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Profile Modal ──────────────────────────────────────── */

.profile-modal {
    background: var(--auth-modal-bg);
    border: 1px solid var(--panel-border);
    width: 100%;
    max-width: 520px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    animation: profileModalSlideUp 0.3s ease-out;
}

@keyframes profileModalSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Modal Header ────────────────────────────────────────── */

.profile-modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.profile-modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.profile-modal-close:hover {
    color: var(--text);
}

/* ── Profile Avatar & Name ──────────────────────────────── */

.profile-avatar-section {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex: 1;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), rgba(98, 169, 255, 0.6));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-weight: 700;
    font-size: 28px;
    flex-shrink: 0;
    border: 2px solid var(--panel-border);
}

.profile-user-info h2 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.profile-user-tier {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(98, 169, 255, 0.15);
    color: var(--accent);
    margin-top: 4px;
}

.profile-user-tier.premium {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.profile-user-tier.enterprise {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
}

.profile-verified-badge {
    color: var(--ok);
    font-size: 14px;
    margin-left: 4px;
}

/* ── Modal Body ─────────────────────────────────────────── */

.profile-modal-body {
    padding: 24px 28px;
    background: rgba(0, 0, 0, 0.15);
    flex: 1;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
}

/* ── Stats Grid ─────────────────────────────────────────── */

.profile-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.profile-stat {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.profile-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    margin: 0;
}

.profile-stat-label {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 500;
}

/* ── Latest Insight ─────────────────────────────────────── */

.profile-section {
    margin-bottom: 20px;
}

.profile-section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px 0;
}

.profile-insight-card {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    padding: 12px;
}

.profile-insight-text {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.profile-insight-meta {
    font-size: 11px;
    color: var(--muted);
    margin-top: 8px;
}

.profile-insight-meta a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.profile-insight-meta a:hover {
    opacity: 0.8;
}

/* ── Social Links ───────────────────────────────────────── */

.profile-social-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.profile-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--surface);
    border: 1px solid var(--panel-border);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
}

.profile-social-link:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.profile-social-link.email {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
}

.profile-social-link.email:hover {
    background: rgba(244, 67, 54, 0.2);
    border-color: #f44336;
}

.profile-social-link.telegram {
    background: rgba(0, 136, 204, 0.1);
    color: #0088cc;
}

.profile-social-link.telegram:hover {
    background: rgba(0, 136, 204, 0.2);
    border-color: #0088cc;
}

.profile-social-link.twitter {
    background: rgba(29, 161, 242, 0.1);
    color: #1da1f2;
}

.profile-social-link.twitter:hover {
    background: rgba(29, 161, 242, 0.2);
    border-color: #1da1f2;
}

/* Tooltip social link */
.profile-social-link[title] {
    position: relative;
}

/* ── Modal Footer ───────────────────────────────────────── */

.profile-modal-footer {
    padding: 16px 28px;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid var(--panel-border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.profile-footer-btn {
    background: none;
    border: 1px solid var(--panel-border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.profile-footer-btn:hover {
    border-color: var(--muted);
    background: rgba(255, 255, 255, 0.04);
}

.profile-footer-btn.primary {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.profile-footer-btn.primary:hover {
    background: rgba(98, 169, 255, 0.9);
    border-color: rgba(98, 169, 255, 0.9);
}

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 640px) {
    .profile-modal {
        max-width: 100%;
        border-radius: 8px;
    }

    .profile-modal-header {
        padding: 16px 20px;
    }

    .profile-modal-body {
        padding: 16px 20px;
        max-height: calc(100vh - 200px);
    }

    .profile-modal-footer {
        padding: 12px 20px;
        flex-direction: column;
    }

    .profile-footer-btn {
        width: 100%;
        justify-content: center;
    }

    .profile-avatar {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }

    .profile-user-info h2 {
        font-size: 16px;
    }

    .profile-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* ── Loading State ──────────────────────────────────────── */

.profile-loading {
    text-align: center;
    padding: 32px 28px;
    color: var(--muted);
}

.profile-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--panel-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: profileSpinnerRotate 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes profileSpinnerRotate {
    to { transform: rotate(360deg); }
}

/* ── Error State ───────────────────────────────────────── */

.profile-error {
    text-align: center;
    padding: 32px 28px;
    color: var(--danger);
}

.profile-error-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.profile-error-text {
    font-size: 13px;
    line-height: 1.5;
}
