/* ============================================
   SecurCorp HR Portal CTF — Corporate Blue Theme
   ============================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #080c14;
    --bg-secondary: #0d1220;
    --bg-tertiary: #111827;
    --bg-card: #0f1629;
    --bg-input: #0a0f1c;

    --blue-primary: #3b82f6;
    --blue-dim: #2563eb;
    --blue-glow: rgba(59, 130, 246, 0.15);
    --blue-subtle: rgba(59, 130, 246, 0.06);

    --cyan-primary: #06b6d4;
    --cyan-glow: rgba(6, 182, 212, 0.12);

    --violet-primary: #a78bfa;
    --violet-glow: rgba(167, 139, 250, 0.1);

    --text-primary: #e8f0fe;
    --text-secondary: #8da3c0;
    --text-dim: #4a6080;

    --border-color: rgba(59, 130, 246, 0.12);
    --border-active: rgba(59, 130, 246, 0.35);

    --red-primary: #ef4444;
    --green-primary: #22c55e;

    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Space Grotesk', sans-serif;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    --shadow-glow: 0 0 30px rgba(59, 130, 246, 0.06);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.5);
}

html, body {
    min-height: 100%;
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
}

/* --- Background Effects --- */
.ambient-glow {
    position: fixed;
    top: -20%;
    right: -10%;
    width: 60%;
    height: 60%;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(ellipse, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
}

.dot-pattern {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image: radial-gradient(rgba(59, 130, 246, 0.04) 1px, transparent 1px);
    background-size: 24px 24px;
}

/* --- App Container --- */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 760px;
    margin: 0 auto;
    padding: 0 0 40px;
    min-height: 100vh;
}

/* --- Header --- */
.header {
    padding: 20px 24px 0;
    margin-bottom: 24px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    flex-shrink: 0;
    filter: drop-shadow(0 2px 10px rgba(59, 130, 246, 0.35));
}

.logo-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--blue-primary), var(--cyan-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.logo-subtitle {
    display: block;
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    margin-top: 1px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green-primary);
    box-shadow: 0 0 8px var(--green-primary);
    animation: pulse-dot 2s ease-in-out infinite;
}

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

.status-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--green-primary);
    letter-spacing: 0.5px;
}

/* --- Main area --- */
.main-area {
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Challenge Banner --- */
.challenge-banner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(6, 182, 212, 0.04));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-glow);
}

.challenge-icon {
    font-size: 22px;
    flex-shrink: 0;
    margin-top: 2px;
}

.challenge-info {
    flex: 1;
    min-width: 0;
}

.challenge-label {
    display: block;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    color: var(--blue-primary);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.challenge-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.challenge-difficulty {
    flex-shrink: 0;
    text-align: right;
}

.diff-label {
    display: block;
    font-size: 9px;
    color: var(--text-dim);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 6px;
    font-weight: 600;
}

.diff-bars {
    display: flex;
    gap: 3px;
    justify-content: flex-end;
}

.diff-bar {
    width: 14px;
    height: 4px;
    border-radius: 2px;
    background: var(--text-dim);
    opacity: 0.2;
}

.diff-bar.active {
    background: var(--blue-primary);
    opacity: 1;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
}

/* --- Upload Card --- */
.upload-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.upload-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    background: rgba(59, 130, 246, 0.03);
}

.upload-header svg {
    color: var(--blue-primary);
    flex-shrink: 0;
}

.cv-textarea {
    width: 100%;
    min-height: 220px;
    padding: 18px;
    background: var(--bg-input);
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.7;
    resize: vertical;
    transition: background 0.2s ease;
}

.cv-textarea::placeholder {
    color: var(--text-dim);
    font-family: var(--font-body);
    font-style: italic;
}

.cv-textarea:focus {
    background: rgba(59, 130, 246, 0.03);
}

.upload-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.char-count {
    font-size: 12px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.3px;
}

.char-count.warning { color: #f59e0b; }
.char-count.danger { color: var(--red-primary); }

.submit-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--blue-dim), var(--blue-primary));
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.25);
    letter-spacing: 0.2px;
    min-width: 120px;
    justify-content: center;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(59, 130, 246, 0.35);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- Processing --- */
.processing {
    display: none;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    animation: fade-in 0.25s ease;
}

.processing.visible {
    display: flex;
}

.processing-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--blue-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    animation: spin 3s linear infinite;
}

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

.processing-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.processing-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.typing-dots {
    display: flex;
    gap: 5px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--blue-dim);
    animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* --- Result Card --- */
.result-card {
    display: none;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 22px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.06), rgba(59, 130, 246, 0.04));
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-left: 3px solid var(--green-primary);
    border-radius: var(--radius-md);
    animation: fade-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.result-card.visible {
    display: flex;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--green-primary);
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.result-body {
    flex: 1;
    min-width: 0;
}

.result-message {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    word-wrap: break-word;
}

.result-nombre {
    color: var(--green-primary);
    font-family: 'JetBrains Mono', monospace;
}

.result-sub {
    font-size: 12.5px;
    color: var(--text-dim);
    margin-bottom: 14px;
}

.result-exp {
    padding: 12px 14px;
    background: rgba(59, 130, 246, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.result-exp-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--blue-primary);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.result-exp-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    word-wrap: break-word;
}

/* --- Footer --- */
.page-footer {
    text-align: center;
    padding-top: 4px;
}

.page-footer span {
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.3px;
}

/* --- Error Toast --- */
.error-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 22px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    color: var(--red-primary);
    font-family: var(--font-body);
    font-size: 13px;
    z-index: 1000;
    animation: toast-in 0.3s ease-out;
    max-width: 380px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

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

/* --- Responsive --- */
@media (max-width: 640px) {
    .header { padding: 14px 16px 0; }
    .main-area { padding: 0 16px; }

    .challenge-banner {
        flex-wrap: wrap;
        gap: 10px;
    }

    .challenge-difficulty {
        flex-basis: 100%;
        text-align: left;
    }

    .diff-bars { justify-content: flex-start; }

    .upload-footer {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .submit-btn { width: 100%; justify-content: center; }
}
