/* profile.css - VERSÃO COMPLETA E REVISADA */

/* 1. Variáveis e Reset */
:root {
    --accent: #2ecc71;       /* Verde principal */
    --accent-hover: #27ae60;
    --accent-rgb: 46, 204, 113;
    --surface: #121212;      /* Fundo profundo */
    --card: #1e1e1e;         /* Fundo dos cards */
    --text-main: #ffffff;    /* Branco principal */
    --text-dim: #b0b0b0;     /* Cinza claro para leitura */
    --danger: #e74c3c;
    --gold: #f1c40f;
}

html, body {
    background-color: var(--surface);
    color: var(--text-main);
    overflow-y: auto;
    min-height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

/* 2. Layout Principal */
.layout-wrapper {
    padding-top: 100px; 
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start; 
    padding-bottom: 80px;
    box-sizing: border-box;
}

.profile-container {
    width: 100%;
    max-width: 850px;
    margin: 0 20px;
    position: relative; 
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 3. Cabeçalho do Perfil */
.profile-header {
    display: flex;
    align-items: center;
    gap: 40px;
    margin-bottom: 30px;
}

.avatar-container {
    position: relative;
    width: 150px;
    height: 150px;
    flex-shrink: 0;
}

.avatar-label {
    cursor: pointer;
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--accent);
    background: #1a1a1a;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.2);
}

.avatar-label:hover {
    transform: scale(1.03);
    border-color: #fff;
    box-shadow: 0 0 30px rgba(var(--accent-rgb), 0.4);
}

.avatar-label img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-hover-icon {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.avatar-label:hover .avatar-hover-icon { opacity: 1; }

/* 4. Texto e Bio */
.user-meta { flex: 1; }

#display-name {
    color: #ffffff; /* Corrigido para branco total */
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 5px;
    outline: none;
    border-radius: 8px;
    padding: 4px 8px;
    transition: 0.2s;
    border: 1px solid transparent;
}

#display-name:hover { background: rgba(255, 255, 255, 0.05); }
#display-name:focus { color: var(--accent); background: rgba(0,0,0,0.2); border-color: var(--accent); }

.badge {
    display: inline-block;
    padding: 5px 15px;
    background: var(--accent);
    color: #000;
    font-weight: 800;
    font-size: 0.7rem;
    border-radius: 6px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.editable-bio {
    color: #eeeeee; /* Corrigido: Cinza quase branco para bio */
    font-size: 1rem;
    line-height: 1.6;
    padding: 8px;
    border-radius: 6px;
    transition: 0.3s;
    min-height: 1.5em;
    cursor: text;
}

.editable-bio:hover { background: rgba(255, 255, 255, 0.05); }
.editable-bio:focus { outline: none; background: rgba(0,0,0,0.3); color: #ffffff; }

.join-date { display: block; color: var(--text-dim); font-size: 0.9rem; opacity: 0.6; }

/* 5. Divisores e Grupos */
.divider {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
    margin: 40px 0;
}

.option-group h3 {
    color: #ffffff; /* Corrigido: "Minhas Obras" etc agora em branco */
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
    border-left: 3px solid var(--accent);
    padding-left: 12px;
}

/* 6. Grid de Ações */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.action-card {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: 0.3s;
}

.action-card:hover {
    background: #222;
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.action-card .icon {
    font-size: 1.6rem;
    background: rgba(255, 255, 255, 0.04);
    min-width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

/* Garante que o texto dentro dos cards de ação (Redefinir Senha etc) seja visível */
.action-card strong {
    display: block;
    color: #ffffff; 
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.action-card p {
    color: var(--text-dim);
    margin: 0;
}

.action-card.danger:hover { border-color: var(--danger); }

/* 7. SEÇÃO DE OBRAS */
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.work-card {
    position: relative;
    display: block;
    background: var(--card);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.05);
    text-decoration: none;
}

.work-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

.work-thumb img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
    transition: 0.5s ease;
}

.work-card:hover .work-thumb img { transform: scale(1.05); }

.vote-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.8rem;
    color: white;
    z-index: 5;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.pages-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: white;
    z-index: 5;
    backdrop-filter: blur(4px);
}

.work-info-overlay {
    padding: 12px;
    background: var(--card);
}

.work-info-overlay h4 {
    margin: 0;
    font-size: 0.9rem;
    color: #ffffff; /* Corrigido: Título da obra em branco */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.work-stats-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 5px;
}

/* 8. Convite de Criador */
.creator-invite-card {
    background: linear-gradient(145deg, rgba(46, 204, 113, 0.05), transparent);
    border: 1px dashed rgba(46, 204, 113, 0.3);
    border-radius: 20px;
    padding: 30px;
    transition: 0.3s;
}

.creator-invite-card:hover {
    border-style: solid;
    border-color: var(--accent);
    background: rgba(46, 204, 113, 0.08);
}

.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.channel-item {
    background: rgba(0,0,0,0.2);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.03);
    color: #ffffff;
}

/* 9. Modais e Status */
.status-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
    z-index: 9999;
}
.status-bar.active { transform: scaleX(1); }

.custom-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}
.custom-modal-overlay.active { opacity: 1; visibility: visible; }

.custom-modal {
    background: #121212;
    border: 1px solid #222;
    padding: 32px;
    border-radius: 20px;
    max-width: 420px;
    width: 90%;
    text-align: center;
}

.custom-modal h3 { color: #ffffff; margin-bottom: 12px; }
.custom-modal p { color: var(--text-dim); margin-bottom: 20px; }

.btn-modal {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: 0.2s;
}
.btn-confirm { background: var(--accent); color: #000; }
.btn-confirm:hover { background: var(--accent-hover); }
.btn-cancel { background: transparent; color: #fff; border: 1px solid #333; }
.btn-cancel:hover { background: rgba(255,255,255,0.05); }

/* --- Botão de Sair (Logout) --- */
.profile-footer {
    display: flex;
    justify-content: center;
    margin-top: 50px;
    padding-bottom: 20px;
}

.btn-logout {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(231, 76, 60, 0.4);
    padding: 14px 60px;
    border-radius: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.2);
    transform: translateY(-2px);
}

/* --- Modal de Exclusão com Confirmação --- */
.custom-modal .modal-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-input-password {
    width: 100%;
    padding: 14px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #ffffff !important; /* Corrigido: Texto digitado sempre branco */
    border-radius: 10px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.modal-input-password:focus {
    outline: none;
    border-color: var(--danger);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-confirm.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-confirm.btn-danger:hover {
    background: #c0392b;
}

/* --- 10. Mobile Adaptação (Consolidado) --- */
@media (max-width: 600px) {
    .profile-header { 
        flex-direction: column; 
        text-align: center; 
        gap: 20px; 
    }
    
    .avatar-container { 
        width: 120px; 
        height: 120px; 
    }

    #display-name {
        font-size: 1.8rem;
    }
    
    .actions-grid { 
        grid-template-columns: 1fr; 
    }
    
    .works-grid { 
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); 
        gap: 12px; 
    }
    
    .btn-logout { 
        width: 100%; 
        padding: 16px; 
    }

    .modal-buttons {
        flex-direction: column; 
    }

    .btn-modal {
        width: 100%;
    }

    .btn-cancel {
        order: 2;
    }

    .btn-confirm {
        order: 1;
    }
}