/* ==========================================================================
   Design System & Variable Declarations
   ========================================================================== */
:root {
    /* Fonts */
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Theme: Dark (Default) */
    --bg-main: #0b0f19;
    --bg-grid: rgba(255, 255, 255, 0.02);
    --bg-grid-major: rgba(255, 255, 255, 0.04);
    --bg-card: rgba(17, 24, 39, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Branding Accent Colors */
    --brand-red: #e11d48; /* Materials Accent (Structural Red) */
    --brand-red-glow: rgba(225, 29, 72, 0.2);
    --brand-cyan: #06b6d4; /* Pathology Lab Accent (Scientific Cyan) */
    --brand-cyan-glow: rgba(6, 182, 212, 0.2);
    
    /* System Colors */
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.15);
    --error: #f43f5e;
    
    /* Card Glow Intensities */
    --card-glow-opacity: 0.03;
    
    /* Layout */
    --border-radius-sm: 8px;
    --border-radius-md: 16px;
    --border-radius-lg: 24px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    /* Theme: Light */
    --bg-main: #f8fafc;
    --bg-grid: rgba(15, 23, 42, 0.025);
    --bg-grid-major: rgba(15, 23, 42, 0.045);
    --bg-card: rgba(255, 255, 255, 0.8);
    --border-color: rgba(15, 23, 42, 0.08);
    --border-hover: rgba(15, 23, 42, 0.15);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --brand-red: #dc2626;
    --brand-red-glow: rgba(220, 38, 38, 0.15);
    --brand-cyan: #0891b2;
    --brand-cyan-glow: rgba(8, 145, 178, 0.15);
    
    --card-glow-opacity: 0.02;
    --bg-card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   Reset & Core Styling
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    transition: background-color 0.5s ease, color 0.5s ease;
    position: relative;
}

/* Canvas background styles */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Blueprint Grid Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(var(--bg-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
        linear-gradient(var(--bg-grid-major) 2px, transparent 2px),
        linear-gradient(90deg, var(--bg-grid-major) 2px, transparent 2px);
    background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
    background-position: center center;
    z-index: -2;
    pointer-events: none;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--border-radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--brand-red);
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 2rem;
    max-width: 1440px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   Header Component
   ========================================================================== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 3rem;
}

.logo-container {
    display: flex;
    align-items: center;
    height: 64px;
}

.logo-img {
    height: 100%;
    width: auto;
    object-fit: contain;
    /* Invert colors for dark background, then rotate hue 180 degrees to preserve the vibrant brand red color */
    filter: invert(1) hue-rotate(180deg) brightness(1.2) contrast(1.05) drop-shadow(0 0 12px rgba(255, 255, 255, 0.05));
    transition: filter 0.3s ease;
}

[data-theme="light"] .logo-img {
    /* Restore original logo colors on light background */
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.08));
}

.theme-toggle-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.theme-toggle-btn:hover {
    border-color: var(--brand-red);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--brand-red-glow);
}

.theme-toggle-btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.5s ease;
}

/* Toggle Sun/Moon display */
.theme-toggle-btn .sun-icon {
    display: block;
}
.theme-toggle-btn .moon-icon {
    display: none;
}

[data-theme="light"] .theme-toggle-btn .sun-icon {
    display: none;
}
[data-theme="light"] .theme-toggle-btn .moon-icon {
    display: block;
}

/* ==========================================================================
   Main Hero Section (Split View)
   ========================================================================== */
.app-main {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-section {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 4rem;
    align-items: start;
    width: 100%;
}

/* ==========================================================================
   Left Column: Content & Form
   ========================================================================== */
.hero-content {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    text-align: left;
}

/* Badge Alert */
.badge {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--brand-red);
    box-shadow: var(--bg-card-shadow);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--brand-red);
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.7);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 8px rgba(225, 29, 72, 0);
    }
    100% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(225, 29, 72, 0);
    }
}

/* Fluid Main Title */
.main-title {
    font-family: var(--font-heading);
    font-size: clamp(2.2rem, 4vw, 3.8rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.text-gradient {
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--brand-red) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-gradient-alt {
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--brand-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.main-subtitle {
    color: var(--text-secondary);
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.6;
    max-width: 600px;
}

/* ==========================================================================
   Countdown Dashboard
   ========================================================================== */
.countdown-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    max-width: 500px;
    margin-top: 1rem;
}

.countdown-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1.2rem 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: var(--transition-smooth);
    box-shadow: var(--bg-card-shadow);
}

.countdown-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-red), var(--brand-cyan));
    opacity: 0.7;
}

.countdown-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
}

.countdown-num {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.countdown-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.2rem;
}

/* ==========================================================================
   Lead Capture Form
   ========================================================================== */
.subscription-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 2.2rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(16px);
    box-shadow: var(--bg-card-shadow);
}

.subscription-wrapper h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.subscribe-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    transition: opacity 0.3s ease;
}

.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.input-wrapper, .select-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

.subscribe-form input, 
.subscribe-form select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.9rem 1.2rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition-smooth);
    width: 100%;
    -webkit-appearance: none; /* remove default styling */
    appearance: none;
}

[data-theme="light"] .subscribe-form input,
[data-theme="light"] .subscribe-form select {
    background: rgba(255, 255, 255, 0.5);
}

.subscribe-form input:focus,
.subscribe-form select:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px var(--brand-red-glow);
}

/* Custom styling for standard select arrow */
.select-wrapper::after {
    content: '';
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
    transition: var(--transition-smooth);
}

.select-wrapper:focus-within::after {
    border-color: var(--brand-red);
    transform: translateY(-25%) rotate(-135deg);
}

/* Error Messages */
.error-msg {
    color: var(--error);
    font-size: 0.75rem;
    margin-top: 0.3rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-5px);
    transition: var(--transition-smooth);
    display: none;
}

.input-wrapper.has-error input,
.select-wrapper.has-error select {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.15);
}

.input-wrapper.has-error .error-msg,
.select-wrapper.has-error .error-msg {
    opacity: 1;
    transform: translateY(0);
    display: block;
}

/* Submit Button */
.submit-btn {
    background: var(--text-primary);
    color: var(--bg-main);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 1rem 1.8rem;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.submit-btn:hover {
    background: var(--brand-red);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--brand-red-glow);
}

.btn-arrow {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.submit-btn:hover .btn-arrow {
    transform: translateX(4px);
}

/* Success Feedback Panel */
.form-success-message {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem 0;
    animation: fadeIn 0.5s ease forwards;
}

.success-icon-box {
    width: 64px;
    height: 64px;
    background: var(--success-glow);
    border: 2px solid var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    margin-bottom: 1.2rem;
}

.success-check {
    width: 32px;
    height: 32px;
}

.form-success-message h4 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
}

.form-success-message p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 350px;
}

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

/* ==========================================================================
   Right Column: Interactive Dual Showcase
   ========================================================================== */
.hero-showcase {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.showcase-header {
    text-align: left;
}

.showcase-header h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.showcase-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.divisions-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.division-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 2.2rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
    transition: var(--transition-smooth);
    box-shadow: var(--bg-card-shadow);
}

/* Glow gradient behind the card, dynamic depending on state */
.card-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 10% 20%, transparent 60%, rgba(255, 255, 255, 0.05) 100%);
    opacity: 0.2;
    transition: var(--transition-smooth);
    z-index: 0;
    pointer-events: none;
}

.division-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--text-muted);
    transition: var(--transition-smooth);
}

.division-card h3,
.division-card p,
.division-card ul,
.division-card .division-icon-container {
    position: relative;
    z-index: 1;
}

.division-icon-container {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    margin-bottom: 1.2rem;
    transition: var(--transition-smooth);
}

.card-icon {
    width: 24px;
    height: 24px;
}

.division-card h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin-bottom: 0.6rem;
    font-weight: 600;
    transition: var(--transition-smooth);
}

.division-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    transition: var(--transition-smooth);
}

/* Feature bullets */
.division-features {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.division-features li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.division-features svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Interactive Active/Hover States for Division Cards
   -------------------------------------------------------------------------- */

/* Hover triggers subtle glow and border colors */
.division-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

/* DIVISION: MATERIALES (Red themed) */
.division-card[data-division="materiales"]::after {
    background-color: var(--border-color);
}

.division-card[data-division="materiales"]:hover {
    box-shadow: 0 8px 30px -10px var(--brand-red-glow);
}

.division-card[data-division="materiales"].active {
    border-color: var(--brand-red);
    background: radial-gradient(circle at top right, var(--brand-red-glow) 0%, var(--bg-card) 60%);
}

.division-card[data-division="materiales"].active::after {
    background-color: var(--brand-red);
    box-shadow: 0 0 12px var(--brand-red);
}

.division-card[data-division="materiales"].active .division-icon-container {
    background: var(--brand-red);
    border-color: var(--brand-red);
    color: white;
    box-shadow: 0 0 12px var(--brand-red-glow);
}

.division-card[data-division="materiales"].active h3 {
    color: var(--text-primary);
}

.division-card[data-division="materiales"].active .division-features {
    color: var(--text-secondary);
}

.division-card[data-division="materiales"].active .division-features svg {
    color: var(--brand-red);
}

/* DIVISION: LABORATORIO (Cyan themed) */
.division-card[data-division="laboratorio"]::after {
    background-color: var(--border-color);
}

.division-card[data-division="laboratorio"]:hover {
    box-shadow: 0 8px 30px -10px var(--brand-cyan-glow);
}

.division-card[data-division="laboratorio"].active {
    border-color: var(--brand-cyan);
    background: radial-gradient(circle at top right, var(--brand-cyan-glow) 0%, var(--bg-card) 60%);
}

.division-card[data-division="laboratorio"].active::after {
    background-color: var(--brand-cyan);
    box-shadow: 0 0 12px var(--brand-cyan);
}

.division-card[data-division="laboratorio"].active .division-icon-container {
    background: var(--brand-cyan);
    border-color: var(--brand-cyan);
    color: var(--bg-main);
    box-shadow: 0 0 12px var(--brand-cyan-glow);
}

.division-card[data-division="laboratorio"].active h3 {
    color: var(--text-primary);
}

.division-card[data-division="laboratorio"].active .division-features {
    color: var(--text-secondary);
}

.division-card[data-division="laboratorio"].active .division-features svg {
    color: var(--brand-cyan);
}

/* ==========================================================================
   Footer Component
   ========================================================================== */
.app-footer {
    margin-top: 5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.footer-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-info strong {
    color: var(--text-primary);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
}

.footer-links a:hover {
    color: var(--brand-red);
}

.footer-icon {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Responsive Adaptability (Media Queries)
   ========================================================================== */

/* Tablets / Medium Screens */
@media (max-width: 1024px) {
    .app-container {
        padding: 1.5rem;
    }
    
    .hero-section {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .app-header {
        margin-bottom: 2rem;
    }
    
    .countdown-container {
        max-width: 100%;
    }
}

/* Mobile Screens */
@media (max-width: 600px) {
    .app-container {
        padding: 1rem;
    }
    
    .app-header {
        padding-bottom: 1.2rem;
        margin-bottom: 1.5rem;
    }
    
    .logo-container {
        height: 38px;
    }
    
    .theme-toggle-btn {
        width: 38px;
        height: 38px;
    }
    
    .theme-toggle-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .hero-section {
        gap: 2.5rem;
    }
    
    .hero-content {
        gap: 1.2rem;
    }
    
    .countdown-container {
        gap: 0.5rem;
    }
    
    .countdown-card {
        padding: 0.8rem 0.5rem;
        border-radius: var(--border-radius-sm);
    }
    
    .subscription-wrapper {
        padding: 1.5rem;
        border-radius: var(--border-radius-md);
    }
    
    .form-group-row {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    
    .divisions-grid {
        gap: 1.2rem;
    }
    
    .division-card {
        padding: 1.5rem;
        border-radius: var(--border-radius-md);
    }
    
    .division-features {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }
    
    .footer-info {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
}
