/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #8A5FF5;
    --primary-hover: #7C4EEF;
    --bg-dark-primary: #0D1117;
    --bg-dark-secondary: #161B22;
    --card-background: rgba(22, 27, 34, 0.85);
    --card-border: rgba(139, 148, 158, 0.2);
    --text-color: #E6EDF3;
    --text-muted: #8B949E;
    --success-color: #28a745;
    --error-color: #dc3545;
    --font-family: 'Inter', sans-serif;
    --animation-speed: 0.3s;
}

/* Base & Reset */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: var(--font-family);
    background-color: var(--bg-dark-primary);
    color: var(--text-color);
    background-image: 
        radial-gradient(ellipse at top left, rgba(138, 95, 245, 0.1), transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(22, 27, 34, 0.5), transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Estilos para Páginas de Autenticación (Login/Register) */
.auth-container { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 100vh; padding: 20px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-header { text-align: center; margin-bottom: 30px; }
.auth-header img { height: 50px; margin-bottom: 15px; }
.auth-header h1 { font-size: 1.8rem; }
.auth-header p { color: var(--text-muted); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: var(--text-muted); }
.form-group input { width: 100%; padding: 12px 15px; background-color: var(--bg-dark-secondary); border: 1px solid var(--card-border); border-radius: 8px; color: var(--text-color); font-size: 1rem; transition: all var(--animation-speed); }
.form-group input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(138, 95, 245, 0.3); }
.button { display: inline-block; padding: 14px; border-radius: 8px; font-weight: 600; text-decoration: none; transition: all var(--animation-speed) ease; border: none; cursor: pointer; background-color: var(--primary-color); color: white; font-size: 1rem; text-align: center; }
.button:hover { background-color: var(--primary-hover); }
.button.secondary {
    background-color: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-muted);
}
.button.secondary:hover {
    background-color: var(--card-border);
    color: var(--text-color);
}
.auth-card .button, .password-form .button, .avatar-form .button { width: 100%; }
.form-footer { text-align: center; margin-top: 25px; color: var(--text-muted); }
.form-footer a { color: var(--primary-color); text-decoration: none; font-weight: 500; }
.form-footer a:hover { text-decoration: underline; }

/* Card Style (Glassmorphism) */
.card { background-color: var(--card-background); backdrop-filter: blur(10px); border: 1px solid var(--card-border); border-radius: 16px; padding: 30px; }

/* Mensajes de feedback */
.message { padding: 15px; border-radius: 8px; margin-bottom: 20px; font-weight: 500; border: 1px solid transparent; }
.message.success { background-color: rgba(40, 167, 69, 0.1); color: var(--success-color); border-color: rgba(40, 167, 69, 0.3); }
.message.error { background-color: rgba(220, 53, 69, 0.1); color: var(--error-color); border-color: rgba(220, 53, 69, 0.3); }

/* --- NUEVOS ESTILOS DASHBOARD --- */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    margin-bottom: 30px;
}
.main-logo img {
    height: 40px;
    opacity: 0.8;
    transition: opacity var(--animation-speed);
}
.main-logo:hover img {
    opacity: 1;
}

/* Menú de Perfil */
.profile-dropdown { position: relative; }
.profile-btn { display: flex; align-items: center; gap: 10px; background-color: var(--bg-dark-secondary); border: 1px solid var(--card-border); padding: 8px 12px; border-radius: 99px; cursor: pointer; transition: all var(--animation-speed); }
.profile-btn:hover { background-color: #21262d; }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--card-border); object-fit: cover; }
.profile-btn span { color: var(--text-color); font-weight: 600; }
.profile-btn svg { color: var(--text-muted); width: 16px; transition: transform var(--animation-speed); }
.profile-dropdown.active .profile-btn svg { transform: rotate(180deg); }
.dropdown-menu { position: absolute; top: calc(100% + 10px); right: 0; background-color: var(--bg-dark-secondary); border: 1px solid var(--card-border); border-radius: 12px; min-width: 200px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); overflow: hidden; z-index: 100; opacity: 0; transform: translateY(10px); visibility: hidden; transition: all var(--animation-speed) ease; }
.profile-dropdown.active .dropdown-menu { opacity: 1; transform: translateY(0); visibility: visible; }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 12px 15px; text-decoration: none; color: var(--text-muted); font-weight: 500; }
.dropdown-item:hover { background-color: var(--primary-color); color: white; }
.dropdown-item svg { width: 18px; height: 18px; }
.dropdown-item.logout { border-top: 1px solid var(--card-border); color: var(--error-color); }
.dropdown-item.logout:hover { background-color: var(--error-color); color: white; }

/* Encabezado de Vista */
.view-header { margin-bottom: 20px; }
.view-header h1 { font-size: 2rem; color: var(--text-color); }
.view-header .back-link { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text-muted); font-weight: 500; margin-bottom: 10px; transition: color var(--animation-speed); }
.view-header .back-link:hover { color: var(--text-color); }

/* Grid de Licencias */
.licenses-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 20px; }
.license-card { background-color: var(--bg-dark-secondary); border: 1px solid var(--card-border); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
.license-card-header { padding: 20px; background-color: rgba(0,0,0,0.2); }
.key-tag { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; margin-bottom: 8px; display: block; }
.license-key-wrapper { display: flex; align-items: center; justify-content: space-between; }
.license-key-wrapper code { font-family: 'Courier New', monospace; font-size: 1.1rem; color: var(--primary-color); overflow-wrap: anywhere; }
.copy-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; transition: color var(--animation-speed); }
.copy-btn:hover { color: var(--text-color); }
.copy-btn.copied { color: var(--success-color); }
.license-card-body { padding: 20px; display: flex; gap: 20px; flex-grow: 1; }
.stat { display: flex; align-items: center; gap: 12px; }
.stat svg { color: var(--text-muted); width: 24px; height: 24px; flex-shrink: 0; }
.stat span { font-size: 0.9rem; color: var(--text-muted); display: block; }
.stat strong { font-size: 1.2rem; color: var(--text-color); }
.ip-list { font-size: 0.9rem; color: var(--text-color); font-family: 'Courier New', monospace; word-break: break-all; }
.license-card-footer { padding: 15px 20px; background-color: rgba(0,0,0,0.2); border-top: 1px solid var(--card-border); display: flex; justify-content: space-between; align-items: center; }
.license-card-footer small { color: var(--text-muted); font-size: 0.8rem; }
.clear-ips-btn { text-decoration: none; color: var(--primary-color); font-weight: 600; font-size: 0.9rem; }
.no-licenses { text-align: center; padding: 50px; }
.no-licenses h3 { font-size: 1.5rem; margin-bottom: 10px; }
.no-licenses p { color: var(--text-muted); margin-bottom: 25px; }

/* Tarjeta de Añadir Licencia */
.add-license-card { text-decoration: none; background-color: transparent; border: 2px dashed var(--card-border); display: flex; align-items: center; justify-content: center; text-align: center; color: var(--text-muted); transition: all var(--animation-speed); }
.add-license-card:hover { border-color: var(--primary-color); color: var(--primary-color); background-color: rgba(138, 95, 245, 0.05); }
.add-license-content svg { width: 48px; height: 48px; margin-bottom: 15px; }
.add-license-content h3 { font-size: 1.3rem; color: var(--text-color); margin-bottom: 5px; }

/* Perfil y Seguridad */
.grid-profile { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }
.card h2 { font-size: 1.5rem; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid var(--card-border); }
.profile-details { display: flex; flex-direction: column; gap: 20px; }
.detail-item label { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 5px; display: block; }
.detail-item p { font-size: 1.1rem; font-weight: 500; background-color: var(--bg-dark-secondary); padding: 10px 15px; border-radius: 8px; word-break: break-all; }
.password-form .button { margin-top: 10px; }

/* Formulario de Avatar */
.avatar-form { text-align: center; }
.avatar-preview { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; margin-bottom: 20px; border: 4px solid var(--card-border); }
.avatar-form input[type="file"] { border: 1px solid var(--card-border); padding: 10px; border-radius: 8px; background-color: var(--bg-dark-secondary); }
.form-note { font-size: 0.8rem; color: var(--text-muted); margin: 10px 0; }

/* --- ESTILOS MEJORADOS PARA URL PERSONALIZADA --- */
.license-card-vanity {
    padding: 20px;
    background-color: rgba(0,0,0,0.2);
    border-top: 1px solid var(--card-border);
}

.license-card-vanity label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 12px;
}

.vanity-url-group {
    display: flex;
    align-items: center;
    background-color: var(--bg-dark-secondary);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    transition: all var(--animation-speed);
    margin-bottom: 10px;
}
.vanity-url-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(138, 95, 245, 0.3);
}
.vanity-url-prefix {
    font-family: 'Courier New', monospace;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 12px 0 12px 15px;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vanity-url-group input {
    border: none;
    background: none;
    padding: 12px 15px 12px 5px;
    flex-grow: 1;
    min-width: 50px;
    font-family: 'Courier New', monospace;
    color: var(--text-color);
}
.vanity-url-group input:focus {
    box-shadow: none;
    outline: none;
}
.vanity-form .button {
    width: 100%;
}

.vanity-feedback {
    margin-top: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    height: 1.2em; /* Para evitar saltos en el layout */
    text-align: center;
}
.vanity-feedback.success { color: var(--success-color); }
.vanity-feedback.error { color: var(--error-color); }

/* MENSAJE PARA PLANES SIN PERMISO */
.vanity-upgrade-notice {
    text-align: center;
    padding: 15px;
}
.vanity-upgrade-notice p {
    color: var(--text-muted);
    margin: 0 0 10px;
}


@media (max-width: 768px) { .grid-profile { grid-template-columns: 1fr; } }
