/* 
   PORTAL THEME v2.0 - "Nebula Glass"
   Modern, Dark, Premium Aesthetic 
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    /* --- Palette --- */
    --bg-deep: #050507;
    --bg-surface: #121217;
    
    /* Accents - Neon Boost */
    --accent-blue: #2563eb;
    --accent-purple: #9333ea;
    --accent-red: #ef4444;
    --accent-cyan: #06b6d4;
    
    /* Gradients */
    --grad-main: linear-gradient(135deg, #ef4444, #3b82f6); /* Red-Blue */
    --grad-hover: linear-gradient(135deg, #f87171, #60a5fa);

    /* Glass */
    --glass-bg: rgba(30, 30, 35, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.15);
    --glass-blur: blur(20px);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-tertiary: #52525b;

    /* Spacing & Radius */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

/* --- Reset & Base --- */
* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Outfit', sans-serif;
    background-color: #0a0510;
    /* Complication: Multi-layered background with noise */
    background-image: 
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E"),
        radial-gradient(circle at 10% 50%, rgba(220, 38, 38, 0.15), transparent 50%),
        radial-gradient(circle at 90% 20%, rgba(37, 99, 235, 0.15), transparent 50%),
        linear-gradient(135deg, #0f0518 0%, #050510 100%);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }

/* --- Ambient Effects --- */
.ambient-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.4;
    animation: solar-pulse 8s ease-in-out infinite alternate;
}

.sun-left {
    top: -100px;
    left: -200px;
    background: radial-gradient(circle, rgba(255, 170, 0, 0.4) 0%, rgba(255, 80, 0, 0.1) 70%, transparent 100%);
}

.sun-right {
    bottom: -100px;
    right: -200px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.5) 0%, rgba(147, 51, 234, 0.2) 70%, transparent 100%);
    animation-delay: -4s;
}

.sun-center-right {
    top: 30%;
    right: -300px;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, rgba(37, 99, 235, 0.05) 60%, transparent 100%);
    animation: solar-pulse 12s ease-in-out infinite alternate-reverse;
}


@keyframes solar-pulse {
    from { transform: scale(1); opacity: 0.3; }
    to { transform: scale(1.1); opacity: 0.5; }
}


/* --- Layout Wrappers --- */
.portal-container {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 10px;
}

.brand-title {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -2px;
    background: linear-gradient(to right, #ffffff 20%, #a5b4fc 50%, #ffffff 80%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    animation: shine-text 5s linear infinite;
    text-shadow: 0 10px 30px rgba(255, 255, 255, 0.1);
}


@keyframes shine-text {
    to { background-position: 200% center; }
}

.brand-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
    margin-top: 8px;
}

/* --- Primary Cards (Hero) --- */
.hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.hero-card {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 180px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
}


.hero-card:hover {
    transform: translateY(-5px);
    border-color: var(--glass-highlight);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5);
}

.hero-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: var(--card-gradient, var(--grad-main));
    opacity: 0.8;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.card-content h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.card-content p {
    margin: 8px 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.card-arrow {
    position: absolute;
    bottom: 24px;
    right: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.hero-card:hover .card-arrow {
    background: white;
    color: black;
    transform: rotate(-45deg);
}

/* --- Terminal Section --- */
.terminal-wrapper {
    background: #000;
    border-radius: var(--radius-lg);
    /* Complex Gradient Border with inner glow */
    padding: 1px; 
    background: linear-gradient(180deg, rgba(255, 100, 100, 0.3), rgba(100, 100, 255, 0.1));
    box-shadow: 
        0 30px 60px -12px rgba(0,0,0,0.8),
        0 0 0 1px rgba(255,255,255,0.05) inset;
    position: relative;
    overflow: hidden;
}

/* Subtle moving glow behind terminal */
.terminal-wrapper::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: conic-gradient(from 0deg, transparent 0deg, rgba(255, 255, 255, 0.05) 180deg, transparent 360deg);
    animation: rotate-glow 10s linear infinite;
    z-index: 0;
    pointer-events: none;
}

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

.terminal-inner {
    background: #0a0a0c;
    border-radius: 23px; /* Slightly smaller than wrapper */
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.terminal-header {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px;
    border-radius: 100px;
    position: relative;
    border: 1px solid rgba(255,255,255,0.1);
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
}

/* Sliding Pill background */
.terminal-header::before {
    content: '';
    position: absolute;
    top: 6px; left: 6px; bottom: 6px;
    width: calc((100% - 12px) / 3);
    background: rgba(255, 255, 255, 0.15);
    border-radius: 100px;
    transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
    /* Transform is controlled by data-mode attribute on parent */
    transform: translateX(0); 
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
}

/* Slide Positions */
.terminal-header[data-mode="lesson"]::before { transform: translateX(0%); }
.terminal-header[data-mode="hw"]::before { transform: translateX(100%); }
.terminal-header[data-mode="palace"]::before { transform: translateX(200%); }

.mode-btn {
    text-align: center;
    padding: 10px 0;
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
    user-select: none;
    position: relative;
    z-index: 2;
}

.mode-btn.active {
    color: white;
    font-weight: 600;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    background: transparent; /* managed by slider */
}

.code-inputs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.digit-box {
    width: 50px;
    height: 64px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 28px;
    font-family: 'Outfit', sans-serif;
    text-align: center;
    outline: none;
    transition: all 0.2s;
}

.digit-box:focus {
    border-color: var(--accent-blue);
    background: rgba(255,255,255,0.05);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -5px rgba(59, 130, 246, 0.3);
}

.hw-group {
    display: flex;
    gap: 12px;
    width: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s ease;
}

.hw-group.visible {
    width: 112px; /* 50 + 50 + 12 gap */
    opacity: 1;
    margin-left: 12px;
}

.action-btn {
    width: 100%;
    max-width: 300px;
    padding: 16px;
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.2);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: not-allowed;
    transition: 0.3s;
}

.action-btn.ready {
    background: linear-gradient(90deg, #ef4444, #3b82f6);
    color: white;
    cursor: pointer;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.action-btn.ready:hover {
    transform: scale(1.02);
}

/* --- Trainers Grid --- */
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 40px 0 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.1);
}

/* --- Trainers Grid (Senior Level + Staggered Animation) --- */
.trainers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.trainer-item {
    position: relative;
    background: linear-gradient(160deg, rgba(30, 30, 35, 0.6) 0%, rgba(10, 10, 15, 0.8) 100%);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 24px;
    padding: 24px;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: pointer;
    /* Entrance Animation */
    opacity: 0;
    animation: fade-up 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Stagger delays */
.trainer-item:nth-child(1) { animation-delay: 0.1s; }
.trainer-item:nth-child(2) { animation-delay: 0.2s; }
.trainer-item:nth-child(3) { animation-delay: 0.3s; }
.trainer-item:nth-child(4) { animation-delay: 0.4s; }
.trainer-item:nth-child(5) { animation-delay: 0.5s; }
.trainer-item:nth-child(6) { animation-delay: 0.6s; }

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

/* Gradient Border Effect via pseudo-element */
.trainer-item::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 1.5px; /* Border width */
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    transition: background 0.4s;
}


.trainer-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 50px -10px rgba(0,0,0,0.6);
}

.trainer-item:hover::before {
    background: var(--hover-gradient, linear-gradient(135deg, var(--accent-blue), var(--accent-purple)));
}

/* Icon Container */
.trainer-icon-box {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 20px;
    transition: 0.4s;
    border: 1px solid rgba(255,255,255,0.05);
}

.trainer-item:hover .trainer-icon-box {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1) rotate(5deg);
    border-color: rgba(255,255,255,0.2);
}

.trainer-content h4 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.trainer-content span {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: block;
}

.tag-new {
    position: absolute;
    top: 20px; right: 20px;
    background: linear-gradient(135deg, #ff5f6d, #ffc371);
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 100px;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(255, 95, 109, 0.4);
    z-index: 2;
}

/* Tablet/Mobile Adjustments */
@media (max-width: 768px) {
    .hero-grid { grid-template-columns: 1fr; }
    .hero-card { height: auto; min-height: 140px; }
    .digit-box { width: 42px; height: 56px; font-size: 24px; }
}
