/* ============================================
   KyleCloud Portal — Design System
   ============================================ */

/* --- CSS Variables --- */
:root {
    /* Colors */
    --bg-primary: #05050f;
    --bg-secondary: #0a0a1a;
    --bg-tertiary: #111127;
    --bg-card: rgba(17, 17, 39, 0.6);
    --bg-card-hover: rgba(25, 25, 55, 0.8);

    --text-primary: #e8e8f0;
    --text-secondary: #8888a8;
    --text-tertiary: #5555708a;

    --accent-blue: #6366f1;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --accent-orange: #f97316;

    --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6, #06b6d4);
    --gradient-hero: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #06b6d4 100%);

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-card: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);

    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-blur: 20px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

    /* Spacing */
    --max-width: 1200px;
    --gutter: 24px;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Ambient Background --- */
.ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #6366f1, transparent 70%);
    top: -200px;
    left: -100px;
    animation: orbFloat1 20s ease-in-out infinite;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #8b5cf6, transparent 70%);
    top: 40%;
    right: -150px;
    animation: orbFloat2 25s ease-in-out infinite;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #06b6d4, transparent 70%);
    bottom: -100px;
    left: 30%;
    animation: orbFloat3 18s ease-in-out infinite;
}

@keyframes orbFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(80px, 60px) scale(1.1); }
    66% { transform: translate(-40px, 40px) scale(0.9); }
}

@keyframes orbFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-60px, -80px) scale(1.15); }
    66% { transform: translate(40px, -30px) scale(0.85); }
}

@keyframes orbFloat3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(50px, -50px) scale(1.05); }
    66% { transform: translate(-70px, 30px) scale(0.95); }
}

/* Noise overlay */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* --- Header --- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: 0 var(--gutter);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(5, 5, 15, 0.7);
    border-bottom: 1px solid var(--border-subtle);
    transition: all 0.3s var(--ease-out);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    cursor: pointer;
}

.logo-icon {
    font-size: 24px;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 100px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    font-size: 12px;
    font-weight: 500;
    color: var(--accent-green);
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

/* --- Hero --- */
.hero {
    position: relative;
    z-index: 2;
    padding: 160px var(--gutter) 80px;
    text-align: center;
}

.hero-content {
    max-width: 700px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 100px;
    background: var(--glass-bg);
    border: 1px solid var(--border-card);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 28px;
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.8s var(--ease-out) both;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-blue);
    animation: pulse 2s ease-in-out infinite;
}

.hero-title {
    font-size: clamp(40px, 8vw, 72px);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -2px;
    margin-bottom: 24px;
}

.title-line {
    display: block;
    animation: fadeInUp 0.8s var(--ease-out) both;
}

.title-line:first-child {
    font-size: 0.5em;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--text-secondary);
    animation-delay: 0.1s;
}

.title-gradient {
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation-delay: 0.2s;
}

.hero-desc {
    font-size: 17px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 48px;
    animation: fadeInUp 0.8s var(--ease-out) 0.3s both;
}

.hero-stats {
    display: inline-flex;
    align-items: center;
    gap: 32px;
    padding: 20px 36px;
    border-radius: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--border-card);
    backdrop-filter: blur(var(--glass-blur));
    animation: fadeInUp 0.8s var(--ease-out) 0.4s both;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-mono);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-divider {
    width: 1px;
    height: 36px;
    background: var(--border-card);
}

/* --- Section Common --- */
.apps-section,
.status-section {
    position: relative;
    z-index: 2;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 60px var(--gutter) 80px;
}

.section-header {
    text-align: center;
    margin-bottom: 48px;
}

.section-title {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.section-desc {
    font-size: 15px;
    color: var(--text-secondary);
}

/* --- Apps Grid --- */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

/* --- App Card --- */
.app-card {
    position: relative;
    border-radius: 16px;
    padding: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    cursor: pointer;
    transition: all 0.4s var(--ease-out);
    overflow: hidden;
    text-decoration: none;
    display: block;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-accent, var(--gradient-primary));
    opacity: 0;
    transition: opacity 0.4s var(--ease-out);
}

.app-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.app-card:hover::before {
    opacity: 1;
}

.app-card:hover .card-arrow {
    transform: translate(4px, -4px);
    opacity: 1;
}

.card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    background: var(--card-icon-bg, rgba(99, 102, 241, 0.1));
    border: 1px solid var(--card-icon-border, rgba(99, 102, 241, 0.15));
    flex-shrink: 0;
}

.card-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 100px;
}

.card-status.online {
    color: var(--accent-green);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.card-status.offline {
    color: var(--text-tertiary);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.card-status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.card-status.online .card-status-dot {
    background: var(--accent-green);
    animation: pulse 2s ease-in-out infinite;
}

.card-status.offline .card-status-dot {
    background: var(--text-tertiary);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.card-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.card-tag {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.card-arrow {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    opacity: 0.4;
    transition: all 0.3s var(--ease-out);
}

/* --- Status Grid --- */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.status-card {
    padding: 20px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.status-card-icon {
    font-size: 20px;
}

.status-card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.status-card-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
}

.status-card-indicator.online {
    color: var(--accent-green);
}

.indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-green);
    animation: pulse 2s ease-in-out infinite;
}

/* --- Footer --- */
.footer {
    position: relative;
    z-index: 2;
    padding: 32px var(--gutter);
    border-top: 1px solid var(--border-subtle);
    margin-top: 40px;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-logo {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
}

.footer-text {
    font-size: 13px;
    color: var(--text-tertiary);
}

.footer-version {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-tertiary);
}

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

.app-card {
    animation: cardFadeIn 0.6s var(--ease-out) both;
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .header-inner {
        height: 56px;
    }

    .nav-link {
        display: none;
    }

    .hero {
        padding: 120px var(--gutter) 60px;
    }

    .hero-title {
        font-size: 40px;
        letter-spacing: -1px;
    }

    .hero-desc br {
        display: none;
    }

    .hero-stats {
        flex-direction: column;
        gap: 16px;
        padding: 20px 28px;
    }

    .stat-divider {
        width: 40px;
        height: 1px;
    }

    .apps-grid {
        grid-template-columns: 1fr;
    }

    .status-grid {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 32px;
    }

    .app-card {
        padding: 20px;
    }

    .card-icon-wrap {
        width: 44px;
        height: 44px;
        font-size: 22px;
        border-radius: 12px;
    }
}
