/* 1. VARIABLES: Nuestra paleta de colores Dark Mode Premium */
:root {
    --bg-color: #0d1117;          /* Fondo oscuro profundo */
    --text-color: #e6edf3;        /* Texto claro, no blanco puro para no cansar la vista */
    --text-muted: #8b949e;        /* Texto secundario/gris */
    --accent-color: #2f81f7;      /* Azul estilo Twitter/X */
    --glass-bg: rgba(22, 27, 34, 0.65); /* Fondo semitransparente para el cristal */
    --glass-border: rgba(255, 255, 255, 0.1);
    --danger-color: #f85149;      /* Rojo para eliminar */
    --like-color: #f91880;        /* Rosa brillante para los likes */
}

/* 2. RESET Y TIPOGRAFÍA */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    /* Evita el destello azul en móviles al tocar la pantalla */
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    /* Comportamiento de "app nativa" sin rebotes raros al hacer scroll */
    overscroll-behavior-y: none; 
}

/* 3. ENCABEZADO GLASSSMORPHISM */
.glass-header {
    position: fixed; /* Se queda pegado arriba */
    top: 0;
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);         /* El efecto de cristal borroso */
    -webkit-backdrop-filter: blur(12px); /* Para Safari */
    border-bottom: 1px solid var(--glass-border);
    z-index: 1000;
}

.glass-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* 4. CONTENEDOR PRINCIPAL */
#app-container {
    padding-top: 60px; /* Deja espacio para que el header no tape el contenido */
    max-width: 600px;  /* Ancho máximo para que se vea bien en PC, estilo columna central */
    margin: 0 auto;    /* Centrado en pantalla grande */
    min-height: 100vh;
    position: relative;
}

/* 5. SISTEMA DE VISTAS (SPA) */
.view {
    display: none; /* Por defecto todo oculto */
    animation: fadeIn 0.3s ease; /* Transición suave al cambiar de pantalla */
}

.view.active {
    display: block; /* Solo la clase "active" se muestra */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 6. BOTÓN FLOTANTE (FAB) */
.fab-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(47, 129, 247, 0.4); /* Sombra brillante */
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 100;
}

.fab-button:active {
    transform: scale(0.95); /* Efecto de "hundimiento" al tocar */
}

@media (min-width: 640px) {
    /* En PC acercamos el botón al borde de la caja central */
    .fab-button {
        right: calc(50% - 280px);
    }
}

/* 7. FORMULARIO NUEVO POST */
.new-post-container {
    padding: 20px;
}

#post-input {
    width: 100%;
    height: 150px;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.25rem;
    resize: none;
    outline: none; /* Quita el borde azul molesto al hacer foco */
    margin-bottom: 20px;
}

#post-input::placeholder {
    color: var(--text-muted);
}

.new-post-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--glass-border);
    padding-top: 15px;
}

#char-counter {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.primary-button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 999px; /* Botón en forma de pastilla */
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.primary-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cancel-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
}

/* 8. TARJETAS DE POSTS (Feed) */
.post-card {
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
    background: transparent;
    transition: background 0.2s;
}

.post-card:active {
    background: rgba(255, 255, 255, 0.05); /* Feedback visual al tocar un post */
}

.post-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.post-author {
    font-weight: 600;
    color: var(--text-color);
}

.post-date {
    color: var(--text-muted);
}

.post-content {
    font-size: 1.1rem;
    margin-bottom: 12px;
    word-break: break-word; /* Evita que palabras muy largas rompan el diseño */
}

.post-actions {
    display: flex;
    gap: 20px;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 8px 0; /* Aumenta el área táctil del botón para dedos */
}

.action-btn.like-btn.liked {
    color: var(--like-color);
}

.action-btn.delete-btn {
    margin-left: auto; /* Empuja este botón todo a la derecha */
}

.action-btn.delete-btn:hover {
    color: var(--danger-color);
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}
