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

:root {
    --bg: #0a0e1a;
    --bg-secondary: #111827;
    --card: rgba(17, 24, 39, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --text: #f1f5f9;
    --muted: #94a3b8;
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --accent: #06b6d4;
    --accent-glow: rgba(6, 182, 212, 0.3);
    --danger: #ef4444;
    --success: #10b981;
    --gradient-1: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
    --gradient-2: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    --gradient-3: linear-gradient(135deg, #06b6d4 0%, #10b981 100%);
    --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

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

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse 80% 60% at 50% -20%, rgba(99, 102, 241, 0.15), transparent),
        radial-gradient(ellipse 60% 50% at 80% 80%, rgba(6, 182, 212, 0.1), transparent),
        radial-gradient(ellipse 50% 40% at 10% 60%, rgba(139, 92, 246, 0.08), transparent);
    pointer-events: none;
    z-index: 0;
}

/* ========== HEADER ========== */
.site-header {
    position: relative;
    z-index: 1;
    padding: 20px 24px;
    text-align: center;
    background: rgba(10, 14, 26, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--card-border);
}

.site-header h1 {
    font-size: clamp(20px, 3.5vw, 28px);
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

/* ========== HERO SECTION ========== */
.hero {
    position: relative;
    text-align: center;
    padding: 48px 20px 32px;
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 50px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: var(--primary-light);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
    animation: fadeInDown 0.6s ease;
}

.hero-badge::before {
    content: '⟁';
    font-size: 16px;
}

.hero h2 {
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 16px;
    animation: fadeInUp 0.6s ease;
}

.hero h2 .highlight {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    color: var(--muted);
    font-size: clamp(15px, 2vw, 17px);
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.6;
    animation: fadeInUp 0.6s ease 0.1s both;
}

/* ========== CONTAINER ========== */
.container {
    position: relative;
    z-index: 1;
    width: min(900px, 92%);
    margin: 0 auto;
    padding: 32px;
    background: var(--card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 80px rgba(99, 102, 241, 0.05);
    animation: fadeInUp 0.5s ease;
}

.intro {
    text-align: center;
    color: var(--muted);
    margin: 8px 0 28px;
    font-size: 15px;
    line-height: 1.6;
}

/* ========== MENU GRID ========== */
.menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.menu a {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.menu a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-1);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.menu a:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.15);
}

.menu a:hover::before {
    transform: scaleX(1);
}

.menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    font-size: 24px;
    transition: transform 0.3s ease;
}

.menu a:hover .menu-icon {
    transform: scale(1.1);
}

.icon-digits { background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.05)); }
.icon-factorial { background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(236, 72, 153, 0.05)); }
.icon-fibonacci { background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.05)); }
.icon-prime { background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05)); }
.icon-power { background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05)); }
.icon-pascal { background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.05)); }
.icon-combinations { background: linear-gradient(135deg, rgba(244, 63, 94, 0.2), rgba(244, 63, 94, 0.05)); }
.icon-binary { background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(14, 165, 233, 0.05)); }

/* ========== FORM ========== */
.form {
    display: grid;
    gap: 18px;
}

.field {
    display: grid;
    gap: 8px;
}

.field label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    letter-spacing: 0.2px;
}

.field small {
    color: var(--muted);
    font-size: 13px;
}

input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    transition: all 0.25s ease;
}

input::placeholder {
    color: rgba(148, 163, 184, 0.5);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow), 0 0 20px rgba(99, 102, 241, 0.1);
    background: rgba(0, 0, 0, 0.4);
}

/* ========== ACTIONS ========== */
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn:hover::after {
    opacity: 1;
}

.btn:active {
    transform: scale(0.97);
}

#run, .btn:not(.secondary):not(.danger) {
    background: var(--gradient-1);
    color: #fff;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--primary-glow);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.btn.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

.btn.danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(239, 68, 68, 0.4);
}

/* ========== RESULT ========== */
.result {
    margin-top: 24px;
    padding: 20px;
    min-height: 60px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    font-family: 'JetBrains Mono', monospace;
    white-space: pre-wrap;
    overflow: auto;
    line-height: 1.7;
    font-size: 14px;
    color: var(--accent);
    transition: all 0.3s ease;
    position: relative;
}

.result:empty::before {
    content: 'Hasil akan muncul di sini...';
    color: rgba(148, 163, 184, 0.4);
    font-family: 'Inter', sans-serif;
    font-style: italic;
}

.result:not(:empty) {
    border-color: rgba(6, 182, 212, 0.2);
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.05);
}

/* ========== NAVIGATION ========== */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.25s ease;
}

.nav a:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(-3px);
}

/* ========== NOTE ========== */
.note {
    margin-top: 20px;
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

/* ========== FOOTER ========== */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    color: var(--muted);
    padding: 32px 20px 28px;
    font-size: 13px;
    letter-spacing: 0.3px;
}

.footer span {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px var(--primary-glow); }
    50% { box-shadow: 0 0 40px var(--primary-glow), 0 0 60px rgba(99, 102, 241, 0.1); }
}

/* Stagger animation for menu items */
.menu a:nth-child(1) { animation: fadeInUp 0.5s ease 0.05s both; }
.menu a:nth-child(2) { animation: fadeInUp 0.5s ease 0.1s both; }
.menu a:nth-child(3) { animation: fadeInUp 0.5s ease 0.15s both; }
.menu a:nth-child(4) { animation: fadeInUp 0.5s ease 0.2s both; }
.menu a:nth-child(5) { animation: fadeInUp 0.5s ease 0.25s both; }
.menu a:nth-child(6) { animation: fadeInUp 0.5s ease 0.3s both; }
.menu a:nth-child(7) { animation: fadeInUp 0.5s ease 0.35s both; }
.menu a:nth-child(8) { animation: fadeInUp 0.5s ease 0.4s both; }

/* ========== PAGE HEADER (sub pages) ========== */
.page-header {
    text-align: center;
    margin-bottom: 8px;
}

.page-header .page-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 18px;
    font-size: 30px;
    margin-bottom: 12px;
    animation: float 3s ease-in-out infinite;
}

.page-header p {
    color: var(--muted);
    font-size: 14px;
    margin-top: 4px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 600px) {
    .container {
        padding: 24px 18px;
        margin: 16px auto;
        border-radius: 16px;
    }

    .menu {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .menu a {
        padding: 18px 12px;
        font-size: 12px;
    }

    .menu-icon {
        width: 42px;
        height: 42px;
        font-size: 20px;
    }

    .actions .btn {
        width: 100%;
    }

    .hero {
        padding: 32px 16px 20px;
    }

    .nav a {
        padding: 8px 14px;
        font-size: 13px;
    }
}

@media (max-width: 380px) {
    .menu {
        grid-template-columns: 1fr;
    }
}