/* style.css - Adaptado a diseño imagen */

/* ==================== VARIABLES GLOBALES ==================== */
:root {
    --bg-dark: #0a0f1c;
    --bg-card: rgba(15, 23, 42, 0.85);
    --bg-display: rgba(0, 0, 0, 0.35);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: #8b5cf6;
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --text-muted: #64748b;
    --error: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --border-radius: 28px;
    --border-radius-sm: 20px;
    --transition: all 0.2s ease;
}

/* ==================== RESET Y BASE ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    line-height: 1.5;
}

.hidden { display: none !important; }

/* ==================== CONTENEDOR PRINCIPAL ==================== */
.app-container {
    width: 100%;
    max-width: 500px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--glass-shadow);
    animation: fadeSlideUp 0.4s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

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

/* ==================== HEADER ==================== */
.auth-header { text-align: center; margin-bottom: 2rem; }

h1 {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #a5b4fc, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.3rem;
}

.accent {
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.subtitle { color: var(--text-dim); font-size: 0.85rem; opacity: 0.75; }

/* ==================== FORMULARIOS AUTH ==================== */
.auth-form h2 { font-size: 1.5rem; font-weight: 600; text-align: center; margin-bottom: 1.5rem; }

.input-group { margin-bottom: 1.25rem; }

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-dim);
    letter-spacing: 0.3px;
}

input, textarea, select {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(10, 15, 30, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.switch-form { text-align: center; margin-top: 1.5rem; font-size: 0.85rem; color: var(--text-dim); }

.link { color: var(--primary-glow); cursor: pointer; font-weight: 600; transition: var(--transition); }
.link:hover { text-decoration: underline; color: #a78bfa; }

/* ==================== BOTONES ==================== */
.primary-btn, .secondary-btn, .text-btn {
    font-weight: 600;
    border-radius: 40px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
}

.primary-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-glow));
    color: white;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
    margin-top: 0.5rem;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.45);
    filter: brightness(1.05);
}

.secondary-btn {
    flex: 1;
    padding: 0.8rem 1rem;
    font-size: 0.88rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-main);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.text-btn {
    background: transparent;
    color: var(--primary-glow);
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    text-decoration: underline;
}

.text-btn:hover { color: #c084fc; }
button:active { transform: scale(0.98); }

/* ==================== DASHBOARD NAV ==================== */
.dashboard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.8rem 1.2rem;
    border-radius: 60px;
    margin-bottom: 1.8rem;
    text-align: left;
}

.user-info { display: flex; gap: 0.5rem; align-items: center; font-size: 0.85rem; color: var(--text-dim); }

.username-badge {
    background: var(--primary);
    padding: 0.2rem 0.6rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.75rem;
    color: white;
}

/* ==================== DISPLAY DE CONTRASEÑA ==================== */
.generator-card {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--border-radius-sm);
    padding: 1.4rem;
    margin-bottom: 1.8rem;
}

.output-area {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

#password-output {
    flex: 1;
    background: transparent;
    border: none;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
    color: var(--text-main);
    padding: 0;
    outline: none;
    cursor: default;
    width: auto;
}

@media (max-width: 768px) { #password-output { font-size: 16px; } }

/* Botón copiar — cuadrado redondeado */
.icon-btn {
    flex-shrink: 0;
    background: rgba(99, 102, 241, 0.2);
    border: none;
    border-radius: 12px;
    padding: 9px 13px;
    font-size: 1.05rem;
    color: #a78bfa;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.icon-btn:hover { background: var(--primary); color: white; transform: scale(1.05); }

/* ==================== MEDIDOR DE FUERZA ==================== */
.strength-meter-container { margin-bottom: 0.3rem; }

.strength-meter {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 0.45rem;
}

.bar {
    height: 100%;
    width: 0%;
    transition: width 0.35s ease, background-color 0.35s ease;
    border-radius: 10px;
    background: var(--error);
}

#strength-text { font-size: 0.75rem; color: var(--text-dim); display: block; opacity: 0.8; }

/* ==================== CONTROLES ==================== */
.controls {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-top: 1.4rem;
}

/* Slider: label arriba con badge, track abajo */
.range-group {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

/* El HTML tiene: <label>Longitud: <span id="length-val">16</span></label>
   El label ocupa toda la fila con space-between gracias a flex */
.range-group > label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0;
    width: 100%;
}

#length-val {
    background: var(--primary);
    padding: 2px 11px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
}

input[type="range"] {
    width: 100%;
    height: 5px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 5px;
    cursor: pointer;
    accent-color: var(--primary);
    border: none;
    padding: 0;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.7);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.7);
}

/* Generar — ancho completo */
#generate-btn { width: 100%; margin-top: 0; }

/* Guardar — secundario ancho completo */
#save-local {
    width: 100%;
    border-radius: 40px;
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#save-local:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* ==================== BÓVEDA ==================== */
.vault-section {
    border-top: 1px solid var(--glass-border);
    padding-top: 1.5rem;
}

.vault-section h3 {
    font-size: 1.15rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.vault-grid {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.vault-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.vault-item:hover { background: rgba(255, 255, 255, 0.05); }

.vault-info { flex: 1; word-break: break-word; }
.vault-info strong { font-size: 0.9rem; color: var(--text-main); display: block; }
.vault-user { font-size: 0.72rem; color: var(--text-dim); opacity: 0.75; margin-left: 4px; }

.vault-actions-buttons { display: flex; gap: 0.5rem; align-items: center; }

.copy-pass-btn, .delete-vault-btn {
    background: rgba(0, 0, 0, 0.35);
    border: none;
    border-radius: 20px;
    padding: 0.28rem 0.65rem;
    font-size: 0.7rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-dim);
}

.copy-pass-btn:hover { background: var(--primary); color: white; }
.delete-vault-btn:hover { background: var(--error); color: white; }

.empty-msg { text-align: center; color: var(--text-muted); padding: 2rem; font-style: italic; font-size: 0.9rem; }

.vault-grid::-webkit-scrollbar { width: 4px; }
.vault-grid::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); border-radius: 10px; }
.vault-grid::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

.vault-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tertiary-btn {
    background: rgba(99, 102, 241, 0.1);
    border: 1px dashed var(--primary);
    color: var(--primary-glow);
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.tertiary-btn:hover {
    background: var(--primary);
    color: white;
    border-style: solid;
}

/* ==================== MODAL ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.active { display: flex; }

.modal-card {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 28px;
    padding: 2rem 1.8rem;
    width: 90%;
    max-width: 390px;
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.6);
    animation: fadeSlideUp 0.2s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

.modal-card h3 { font-size: 1.4rem; margin-bottom: 1rem; text-align: center; color: #a78bfa; }

.modal-fields { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.modal-fields input { background: rgba(0, 0, 0, 0.4); border-radius: 16px; }

.modal-actions { display: flex; gap: 0.75rem; }
.modal-actions button { flex: 1; }
.modal-actions .primary-btn { margin-top: 0; padding: 0.75rem; }
.modal-actions .secondary-btn { padding: 0.75rem; }


/* ==================== RESPONSIVE ==================== */
@media (max-width: 520px) {
    .app-container { padding: 1.4rem; border-radius: 22px; }
    .dashboard-nav { flex-direction: column; gap: 0.5rem; align-items: flex-start; border-radius: 20px; }
    .vault-item { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .vault-actions-buttons { align-self: flex-end; }
    .modal-card { padding: 1.4rem; }
    #password-output { font-size: 1rem; }
}

input[readonly] { cursor: default; }

/* ==================== FIJAR FOOTER AL FONDO ==================== */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;          /* altura mínima = toda la ventana */
    margin: 0;
    padding: 1rem;
}

/* El contenedor principal ocupa el espacio disponible */
#auth-screen, #main-app-content {
    flex: 1;                    /* empuja el footer hacia abajo si hay poco contenido */
}

/* El footer queda al final sin necesidad de margin-top */
.social-footer {
    margin-top: 1rem;
    text-align: center;
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
    font-size: 0.8rem;
    color: var(--text-dim);
    /* No necesita margin-top: auto porque el flex ya lo maneja */
}
