/* VARIABLES DE DISEÑO */
:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --accent-color: #10b981; 
    --accent-hover: #059669;
    --border-color: #e2e8f0;
    --input-bg: #ffffff;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    --secondary-text: #64748b;
}

/* MODO NOCHE */
body.dark-mode {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-color: #f1f2f6;
    --border-color: #334155;
    --input-bg: #334155;
    --shadow: 0 10px 30px rgba(0,0,0,0.4);
    --secondary-text: #94a3b8;
}

/* BASE */
body { 
    font-family: 'Inter', -apple-system, sans-serif; 
    background-color: var(--bg-color); 
    color: var(--text-color);
    margin: 0; display: flex; flex-direction: column; align-items: center;
    min-height: 100vh; padding: 10px; transition: all 0.4s ease;
    box-sizing: border-box;
}

/* CONTENEDOR PRINCIPAL */
.card { 
    background: var(--card-bg); padding: 30px 20px; border-radius: 24px; 
    box-shadow: var(--shadow); width: 100%; max-width: 1300px;
    text-align: center; border: 1px solid var(--border-color); margin-top: 10px;
    box-sizing: border-box; transition: background 0.4s ease;
}

h1 { font-weight: 800; font-size: 2.5rem; letter-spacing: -1.5px; color: var(--accent-color); margin-top: 0; }

/* FORMULARIOS (INDEX Y LOGIN) */
input[type="text"], input[type="password"] { 
    width: 100%; max-width: 500px; padding: 18px; border: 2px solid var(--border-color); 
    border-radius: 16px; font-size: 1rem; background: var(--input-bg); color: var(--text-color); 
    outline: none; transition: 0.3s; box-sizing: border-box;
}
input[type="text"]:focus, input[type="password"]:focus { border-color: var(--accent-color); }
#wordCounter {
    text-align: right;
    font-size: 0.85rem;
    margin-top: 5px;
    width: 100%;
    max-width: 600px;
}

.error-msg { color: #ff4757; font-weight: bold; margin: 10px 0; }
.success-msg { color: #10b981; font-weight: bold; margin: 10px 0; }

/* BOTÓN REDIMENSIONADO */
input[type="submit"] { 
    margin-top: 20px; 
    width: auto; 
    min-width: 200px; 
    padding: 14px 35px; 
    background: var(--accent-color); 
    color: white; 
    border: none; 
    border-radius: 14px; 
    cursor: pointer; 
    font-size: 1rem; 
    font-weight: 700;
    transition: 0.3s ease;
}

input[type="submit"]:hover { 
    background: var(--accent-hover); 
    transform: translateY(-2px);
}

/* Alineación del formulario para centrar el botón pequeño */
#creceForm {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* NUBE DE PALABRAS */
.muro { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin: 40px 0; }
.palabra-nube { 
    display: inline-block; 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.5s ease; 
    cursor: pointer; 
    text-transform: lowercase;
    user-select: none; /* Evita que se seleccione el texto al hacer muchos clics */
}
.palabra-nube:hover { transform: scale(1.3) translateY(-5px); color: var(--accent-color) !important; }
.palabra-nube.brillando { text-shadow: 0 0 30px var(--accent-color); transform: scale(1.5); color: #fff !important; }

/* BOTON FLOTANTE MODO NOCHE */
#darkModeToggle {
    position: fixed; bottom: 25px; right: 25px; width: 60px; height: 60px;
    border-radius: 20px; border: none; cursor: pointer; font-size: 1.5rem; 
    background: var(--accent-color); color: white; box-shadow: 0 10px 20px rgba(0,0,0,0.2); z-index: 999;
}

/* --- SECCIÓN ADMIN Y LOGIN --- */
.login-container {
    display: flex; justify-content: center; align-items: center; min-height: 60vh;
}

.admin-table { 
    width: 100%; border-collapse: collapse; margin-top: 30px; text-align: left; 
}
.admin-table th { 
    padding: 15px; color: var(--secondary-text); font-size: 0.8rem; 
    text-transform: uppercase; border-bottom: 2px solid var(--border-color); 
}
.admin-table td { padding: 15px; border-bottom: 1px solid var(--border-color); font-size: 0.9rem; }

/* PAGINACIÓN */
.pagination { margin-top: 30px; display: flex; justify-content: center; gap: 8px; }
.page-link { 
    padding: 10px 18px; border-radius: 10px; border: 1px solid var(--border-color); 
    text-decoration: none; color: var(--text-color); transition: 0.3s;
}
.page-link.active { background: var(--accent-color); color: white; border-color: var(--accent-color); }

.btn-danger { 
    background: #ef4444; color: white; padding: 8px 12px; border-radius: 8px; 
    text-decoration: none; font-size: 0.8rem; font-weight: bold; 
}

/* RESPONSIVO PC */
@media (min-width: 768px) {
    body { padding: 30px; }
    .card { padding: 50px; margin-top: 20px; }
    h1 { font-size: 3.5rem; }
}