:root {
    /* Variables globales: colores reutilizables en todo el CSS */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
}


/* Reset Básico: elimina márgenes y paddings por defecto */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}


body {
    /* Configuración general de la página */
    font-family: system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
}


/* --- NAVEGACIÓN SUPERIOR --- */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}


.brand {
    font-size: 1.2rem;
    color: var(--primary-color);
}


.nav-link {
    margin-left: 1rem;
    text-decoration: none;
    color: #64748b;
    font-weight: 500;
}


.nav-link.active {
    color: var(--primary-color);
}


/* --- ENRUTAMIENTO DE LA SPA (Mostrar/ocultar vistas) --- */

.view-module {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.view-module.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* --- CONTENEDORES PRINCIPALES (Mobile First) --- */

.view-create-profile {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}


.form-container,
.card-container {
    width: 100%;
}


.input-group,
.input-group-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}


.input-group-row {
    flex-direction: row;
    gap: 0.5rem;
}


label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #475569;
}


input[type="text"],
textarea {
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    width: 100%;
}


input[type="color"] {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}


.input-group-row input {
    flex: 1;
}


hr {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    margin: 1.5rem 0;
}


button {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}


.btn-primary {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
}


.btn-primary:hover {
    background-color: var(--primary-hover);
}


.btn-secondary {
    background-color: #e2e8f0;
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: #cbd5e1;
}


/* --- TARJETA --- */

.card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}


.card-header {
    height: 120px;
    background-color: #3b82f6;
    transition: background-color 0.3s ease;
}


/* --- SELECTOR DE AVATARES --- */

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 10px;
    margin-top: 0.5rem;
}


.avatar-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}


.avatar-option:hover {
    transform: scale(1.1);
}


.avatar-option.selected {
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}


/* --- AVATAR DE LA TARJETA --- */

.avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid white;
    margin-top: -50px;
    background-color: white;
    object-fit: cover;
}


.card-body {
    padding: 1.5rem;
}


#name-preview {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}


#bio-preview {
    font-size: 0.95rem;
    color: #64748b;
}


/* --- GALERÍA --- */

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 0 2rem 2rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-grid .card {
    width: 100%;
}


/* --- MENSAJES DE ESTADO (Cargando, Éxito, Error) --- */

.status-msg {
    display: block;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.status-loading { color: #64748b; }
.status-success { color: #16a34a; }
.status-error { color: #dc2626; }


/* --- RESPONSIVE --- */

@media (min-width: 768px) {

    .view-create-profile {
        flex-direction: row;
        align-items: flex-start;
    }

    .form-container {
        flex: 1;
        position: sticky;
        top: 2rem;
    }

    .card-container {
        flex: 1;
    }
}
