:root {
    --cor-fundo-pagina: #f4f4f8;
    --cor-botao: #0055A4;
    --cor-texto-botao: #ffffff;
    --cor-texto-perfil: #121212;
    --fonte-principal: 'Montserrat', sans-serif;
    --sombra-padrao: 0 4px 15px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--fonte-principal);
    background-color: var(--cor-fundo-pagina);
    color: var(--cor-texto-perfil);
    line-height: 1.6;
    transition: background-color 0.3s;
}

.page-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.profile-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.profile-logo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    box-shadow: var(--sombra-padrao);
    border: 3px solid var(--cor-botao);
}

#profile-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--cor-texto-perfil);
}

#bio-description {
    font-size: 1rem;
    color: var(--cor-texto-perfil);
    opacity: 0.9;
}

main { flex-grow: 1; }

.links-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.link-button-wrapper {
    position: relative;
}

.link-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    padding: 1rem;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: 8px;
    background-color: var(--cor-botao);
    color: var(--cor-texto-botao);
    border: 2px solid var(--cor-botao);
    box-shadow: var(--sombra-padrao);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s;
}

.link-button:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.link-button.link-oculto {
    opacity: 0.5;
    background-color: #ccc;
    border-color: #ccc;
}

/* Estilos para arrastar e soltar */
.drag-handle {
    cursor: grab;
    color: white;
    opacity: 0.7;
}
.drag-handle:active {
    cursor: grabbing;
}
.sortable-ghost {
    opacity: 0.4;
    background-color: #c8ebfb;
    border-style: dashed;
}

footer {
    text-align: center;
    padding: 2rem 0 1rem 0;
    font-size: 0.9rem;
    color: var(--cor-texto-perfil);
    opacity: 0.7;
    position: relative;
}

/* Link Admin discreto */
.admin-link {
    position: absolute;
    bottom: 5px;
    right: 10px;
    font-size: 0.7rem;
    color: var(--cor-texto-perfil);
    opacity: 0.3;
    text-decoration: none;
    transition: opacity 0.3s;
    padding: 5px;
}

.admin-link:hover {
    opacity: 0.6;
}

/* --- PAINÉIS LATERAIS E ADMIN --- */
.fab-container { 
    position: fixed; 
    bottom: 25px; 
    right: 25px; 
    display: none; /* Oculto por padrão */
    flex-direction: column-reverse; 
    gap: 15px; 
    z-index: 1000; 
}

.fab-container.active {
    display: flex;
}

.overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0, 0, 0, 0.6); 
    z-index: 1001; 
    opacity: 0; 
    visibility: hidden; 
    transition: opacity 0.3s; 
}

.side-panel { 
    position: fixed; 
    top: 0; 
    right: -100%; 
    width: 100%; 
    max-width: 400px; 
    height: 100vh; 
    background-color: white; 
    color: #333; 
    z-index: 1002; 
    padding: 2rem; 
    box-shadow: -5px 0 15px rgba(0,0,0,0.1); 
    transition: right 0.4s; 
    overflow-y: auto; 
}

.fab-btn { 
    width: 60px; 
    height: 60px; 
    color: white; 
    border: none; 
    border-radius: 50%; 
    box-shadow: var(--sombra-padrao); 
    font-size: 1.5rem; 
    cursor: pointer; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
}

.settings-fab { 
    background-color: #6c757d; 
}

.add-btn { 
    background-color: #0055A4; 
}

.save-edit-btn { 
    background-color: #28a745; 
}

.overlay.active { 
    opacity: 1; 
    visibility: visible; 
}

.side-panel.active { 
    right: 0; 
}

.close-btn { 
    position: absolute; 
    top: 15px; 
    right: 20px; 
    background: none; 
    border: none; 
    font-size: 2rem; 
    color: #333; 
    cursor: pointer; 
}

.side-panel h3 { 
    margin-bottom: 1.5rem; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
}

form label { 
    font-weight: 500; 
    margin-bottom: 0.5rem; 
    font-size: 0.9rem; 
    display: block; 
    text-align: left; 
}

form input, form textarea, form select { 
    padding: 0.8rem; 
    border: 1px solid #ddd; 
    border-radius: 5px; 
    margin-bottom: 1.5rem; 
    width: 100%; 
}

/* Input de ícone com preview */
.icon-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 1rem;
}

.icon-input-wrapper input {
    margin-bottom: 0;
    flex: 1;
}

.icon-preview {
    width: 50px;
    height: 50px;
    border: 2px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #333;
    background: #f9f9f9;
}

.icon-help {
    color: var(--cor-botao);
    margin-left: 8px;
    font-size: 1rem;
    text-decoration: none;
    transition: opacity 0.3s;
}

.icon-help:hover {
    opacity: 0.7;
}

.btn-icon-picker {
    background-color: #6c757d !important;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-icon-picker:hover {
    background-color: #5a6268 !important;
}

form textarea { 
    resize: vertical; 
}

.side-panel input[type="color"] { 
    padding: 0; 
    height: 40px; 
    background: none; 
    border: none; 
}

form button { 
    padding: 0.8rem 1.5rem; 
    border: none; 
    border-radius: 50px; 
    cursor: pointer; 
    font-weight: 500; 
    color: white; 
    background-color: #0055A4; 
    width: 100%; 
}

.btn-resetar { 
    background-color: #6c757d; 
    margin-top: 10px; 
}

.side-panel hr { 
    border: none; 
    border-top: 1px solid #eee; 
    margin: 2rem 0; 
}

#loading-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(255, 255, 255, 0.9); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    z-index: 2000; 
}

.spinner { 
    border: 8px solid #f3f3f3; 
    border-top: 8px solid var(--cor-botao); 
    border-radius: 50%; 
    width: 60px; 
    height: 60px; 
    animation: spin 1s linear infinite; 
}

@keyframes spin { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
}

.link-edit-controls { 
    position: absolute; 
    top: 50%; 
    right: -50px; 
    transform: translateY(-50%); 
    z-index: 5; 
    display: none; 
    gap: 8px;
    background-color: rgba(0,0,0,0.4);
    padding: 5px 8px;
    border-radius: 20px;
}

.link-button-wrapper.edit-mode .link-edit-controls { 
    display: flex; 
    align-items: center; 
}

.link-edit-btn { 
    background: none; 
    color: white; 
    border: none; 
    width: 25px; 
    height: 25px; 
    font-size: 0.9rem; 
    cursor: pointer; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
}

#password-prompt-side { 
    text-align: left; 
}

#password-prompt-side h3, #password-prompt-side p { 
    text-align: center; 
}

#password-prompt-side input { 
    width: 100%; 
    padding: 0.8rem; 
    border: 1px solid #ccc; 
    border-radius: 5px; 
    margin-bottom: 1rem; 
    font-size: 1rem; 
}

#btn-confirmar-senha-side { 
    width: 100%; 
    padding: 0.9rem; 
    font-size: 1rem; 
    font-weight: bold; 
}

#mensagem-erro-side { 
    text-align: center; 
    margin-top: 1rem; 
    color: #dc3545; 
}

/* Responsividade */
@media (max-width: 768px) {
    .link-edit-controls {
        right: 5px;
        padding: 3px 5px;
    }
    
    .side-panel {
        max-width: 100%;
    }
    
    .admin-link {
        position: static;
        display: block;
        margin-top: 1rem;
    }
    
    .icon-modal-content {
        width: 95%;
        max-height: 90vh;
    }
}

/* === MODAL DE ÍCONES === */
.icon-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.icon-modal.active {
    display: flex;
}

.icon-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.icon-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.icon-modal-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333;
}

.icon-modal-header .close-btn {
    position: static;
    margin: 0;
}

.icon-search-container {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
}

.icon-search-container input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.icon-categories {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.category-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.category-btn:hover {
    background: #f0f0f0;
}

.category-btn.active {
    background: var(--cor-botao);
    color: white;
    border-color: var(--cor-botao);
}

.icon-grid {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    overflow-y: auto;
    max-height: 400px;
}

.icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8f9fa;
}

.icon-item:hover {
    border-color: var(--cor-botao);
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.icon-item i {
    font-size: 2rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.icon-item span {
    font-size: 0.7rem;
    color: #666;
    text-align: center;
    word-break: break-word;
}

.icon-item.selected {
    border-color: var(--cor-botao);
    background: var(--cor-botao);
}

.icon-item.selected i {
    color: white;
}

.icon-item.selected span {
    color: white;
    font-weight: bold;
}