/* ============================================================
   Cerno · AI Engine Screening — Global Stylesheet v1.2
   ============================================================

   TABLE OF CONTENTS
   1.  CSS Custom Properties (Design Tokens)
   2.  Base Reset & Body
   3.  Glass Surfaces
   4.  Typography Helpers
   5.  Navigation Bar
   6.  Logo / Brand Block
   7.  Form Inputs & Labels
   8.  Buttons
   9.  Alert / Status Messages
   10. Risk Badges & Colors
   11. Tab Navigation
   12. Section View Transitions
   13. Relation Nodes
   14. Scrollbar
   15. Utility Classes
   16. Animations & Keyframes
   ============================================================ */

/* ── 1. Design Tokens ────────────────────────────────────── */
:root {
    --color-bg:          #0f172a;
    --color-bg-card:     rgba(15, 23, 42, 0.4);
    --color-bg-nav:      rgba(5, 7, 10, 0.85);
    --color-border:      rgba(255, 255, 255, 0.08);
    --color-border-soft: rgba(255, 255, 255, 0.05);
    --color-text:        #f1f5f9;
    --color-text-muted:  #64748b;
    --color-text-dim:    #94a3b8;
    --color-blue:        #3b82f6;
    --color-blue-hover:  #60a5fa;
    --color-emerald:     #10b981;
    --color-red:         #ef4444;
    --color-amber:       #f59e0b;
    --radius-sm:         0.75rem;
    --radius-md:         1rem;
    --radius-lg:         1.5rem;
    --radius-xl:         2rem;
    --transition-fast:   0.2s ease;
    --transition-base:   0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow:   0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-blue:       0 10px 30px rgba(59, 130, 246, 0.15);
    --shadow-card:       0 20px 40px rgba(0, 0, 0, 0.3);
}

/* ── 2. Base Reset & Body ────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--color-bg);
    background-image:
        radial-gradient(circle at top right, rgba(30, 41, 59, 0.7), transparent),
        radial-gradient(circle at bottom left, rgba(15, 23, 42, 0.8), transparent);
    color: var(--color-text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── 3. Glass Surfaces ───────────────────────────────────── */
/* Standard glass — form containers, panels */
.glass {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Elevated glass card — data cards with hover lift */
.glass-card {
    background: var(--color-bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--color-border);
    transition: all var(--transition-base);
}

.glass-card:hover {
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(15, 23, 42, 0.7);
    transform: translateY(-4px);
    box-shadow: var(--shadow-card);
}

/* ── 4. Typography Helpers ───────────────────────────────── */
.gradient-text {
    background: linear-gradient(to right, #60a5fa, #34d399);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-label {
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--color-text-muted);
}

/* ── 5. Navigation Bar ───────────────────────────────────── */
.nav-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    padding: 1rem 1.5rem;
    background: var(--color-bg-nav);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--color-border-soft);
}

.nav-link {
    padding-bottom: 0.25rem;
    border-bottom: 2px solid transparent;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.nav-link:hover {
    color: white;
}

.nav-link.active {
    color: var(--color-blue-hover);
    border-bottom-color: var(--color-blue);
}

/* ── 6. Logo / Brand Block ───────────────────────────────── */
.brand-wrapper {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-name {
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: white;
    font-weight: 700;
}

.brand-dot {
    color: var(--color-blue);
}

.brand-sub {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--color-text-dim);
    white-space: nowrap;
}

/* ── 7. Form Inputs & Labels ─────────────────────────────── */
.form-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    outline: none;
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input::placeholder {
    color: #475569;
}

.form-input:focus {
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input.emerald:focus {
    border-color: var(--color-emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* OTP / Code input */
.code-input {
    letter-spacing: 0.5em;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
}

/* ── 8. Buttons ──────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: var(--color-blue);
    color: white;
    box-shadow: var(--shadow-blue);
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-blue-hover);
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(59, 130, 246, 0.25);
}

.btn-success {
    background: var(--color-emerald);
    color: white;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.15);
}

.btn-success:hover:not(:disabled) {
    background: #34d399;
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(16, 185, 129, 0.25);
}

.btn-ghost {
    background: rgba(59, 130, 246, 0.08);
    color: var(--color-blue-hover);
    border: 1px solid rgba(59, 130, 246, 0.2);
    box-shadow: none;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--color-blue);
    color: white;
    transform: translateY(-1px);
}

/* ── 9. Alert / Status Messages ──────────────────────────── */
.alert {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid;
    line-height: 1.5;
}

.alert-error {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.alert-info {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

/* ── 10. Risk Badges & Colors ────────────────────────────── */
.badge-tech {
    display: inline-block;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.1em;
    padding: 2px 10px;
    border-radius: 6px;
    text-transform: uppercase;
}

.risk-critico {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.risk-alto {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: #fcd34d;
}

.risk-moderado {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #93c5fd;
}

.risk-bajo {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
}

/* ── 11. Tab Navigation ──────────────────────────────────── */
.tab-btn {
    padding: 1rem 0;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.2em;
    color: var(--color-text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    cursor: pointer;
    text-transform: uppercase;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.tab-btn:hover {
    color: white;
}

.tab-btn.active-tab {
    color: var(--color-blue);
    border-bottom-color: var(--color-blue);
}

.tab-pane {
    animation: fadeIn 0.35s ease-out;
}

/* ── 12. Section View Transitions ────────────────────────── */
.view-section {
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.hidden-view {
    display: none;
    opacity: 0;
    transform: translateY(12px);
}

/* ── 13. Relation Nodes ──────────────────────────────────── */
.relacion-node {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.relacion-node:hover {
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(30, 41, 59, 0.8);
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* ── 14. Scrollbar ───────────────────────────────────────── */
.custom-scroll::-webkit-scrollbar {
    width: 4px;
}

.custom-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.custom-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ── 15. Utility Classes ─────────────────────────────────── */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.metodo-item:hover .line-clamp-2 {
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

/* Pulse dot indicator */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-emerald);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status-dot.red   { background: var(--color-red); }
.status-dot.blue  { background: var(--color-blue); }
.status-dot.amber { background: var(--color-amber); }

/* ── 16. Animations & Keyframes ──────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Spinner utility */
.spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--color-blue);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

/* ── 18. User / Session Badge ────────────────────────────── */

/* Anonymous demo badge — amber tone */
.user-badge-anon {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-left: 1.5rem;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-avatar.anon {
    background: linear-gradient(to top right, #d97706, #fbbf24);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.user-avatar.auth {
    background: linear-gradient(to top right, #2563eb, #60a5fa);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    color: white;
}

/* Login CTA button in nav (anonymous only) */
.btn-nav-login {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-nav-login:hover {
    background: var(--color-blue);
    color: white;
    border-color: var(--color-blue);
    transform: translateY(-1px);
}

/* ── 19. Page entrance animation ─────────────────────────── */
@keyframes pageEnter {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.page-enter {
    animation: pageEnter 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ── 20. Skeleton loader ─────────────────────────────────── */
@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.04) 25%,
        rgba(255,255,255,0.09) 50%,
        rgba(255,255,255,0.04) 75%
    );
    background-size: 800px 100%;
    animation: shimmer 1.6s infinite linear;
    border-radius: 0.5rem;
}

/* ── 21. Password toggle button ──────────────────────────── */
.input-wrapper {
    position: relative;
}

.input-wrapper .form-input {
    padding-right: 3rem;
}

.btn-eye {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0.25rem;
    transition: color var(--transition-fast);
    display: flex;
    align-items: center;
}

.btn-eye:hover { color: white; }

/* ── 22. Step progress indicator ────────────────────────── */
.step-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 2rem;
}

.step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
    border: 2px solid rgba(255,255,255,0.1);
    color: var(--color-text-muted);
    background: rgba(255,255,255,0.03);
    transition: all var(--transition-base);
    position: relative;
    z-index: 1;
}

.step-dot.active {
    border-color: var(--color-blue);
    color: white;
    background: var(--color-blue);
    box-shadow: 0 0 0 4px rgba(59,130,246,0.2);
}

.step-dot.done {
    border-color: var(--color-emerald);
    color: white;
    background: var(--color-emerald);
}

.step-line {
    flex: 1;
    height: 2px;
    background: rgba(255,255,255,0.08);
    max-width: 48px;
    transition: background var(--transition-base);
}

.step-line.done {
    background: var(--color-emerald);
}

/* ── 23. KPI counter animation ───────────────────────────── */
.kpi-value {
    display: inline-block;
    transition: all 0.3s ease;
}

/* ── 24. Toast notification ──────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-sm);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid;
    font-size: 0.8125rem;
    font-weight: 600;
    pointer-events: all;
    animation: toastIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
    max-width: 360px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.toast.success {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.toast.error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.toast.info {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(24px); }
}
