/* ============================================
   JARVIS Portal — Dark HUD Theme
   ============================================ */

:root {
    --bg: #0a0e17;
    --bg-card: #111827;
    --bg-card-hover: #1a2332;
    --border: #1e293b;
    --border-hover: #334155;
    --text: #e2e8f0;
    --text-dim: #64748b;
    --text-muted: #475569;
    --accent: #22d3ee;
    --accent-glow: rgba(34, 211, 238, 0.15);
    --accent-dim: #0e7490;
    --green: #34d399;
    --green-glow: rgba(52, 211, 153, 0.3);
    --red: #f87171;
    --red-glow: rgba(248, 113, 113, 0.3);
    --amber: #fbbf24;
    --amber-glow: rgba(251, 191, 36, 0.3);
    --font-display: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-display);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* Background effects */
.grid-bg {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(34, 211, 238, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 211, 238, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.scanline {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.4;
    animation: scanline 4s ease-in-out infinite;
    z-index: 100;
    pointer-events: none;
}

@keyframes scanline {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(100vh); opacity: 0.1; }
}

/* Header */
header {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(10, 14, 23, 0.95), rgba(10, 14, 23, 0.8));
    backdrop-filter: blur(20px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon svg {
    width: 40px;
    height: 40px;
    animation: rotate-slow 20s linear infinite;
}

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

.logo-text h1 {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent-glow);
}

.subtitle {
    font-size: 0.75rem;
    color: var(--text-dim);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--green);
    transition: color 0.3s;
}

.header-status.warn {
    color: var(--amber);
}

.header-status.warn .pulse-dot {
    background: var(--amber);
    box-shadow: 0 0 8px var(--amber-glow);
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.status-label {
    white-space: nowrap;
}

/* Main Grid */
main {
    position: relative;
    z-index: 10;
    flex: 1;
    padding: 2.5rem 2rem;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* Tile Base */
.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.25s ease;
    cursor: default;
    overflow: hidden;
}

a.tile {
    cursor: pointer;
}

a.tile:hover, a.tile:focus-visible {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--border-hover);
}

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

a.tile.protected:hover {
    border-color: var(--accent-dim);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 0 0 20px var(--accent-glow);
}

/* Tile Parts */
.tile-status {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
}

.dot {
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.3s;
}

.dot.online {
    background: var(--green);
    box-shadow: 0 0 8px var(--green-glow);
}

.dot.offline {
    background: var(--red);
    box-shadow: 0 0 8px var(--red-glow);
}

.dot.unknown {
    background: var(--text-muted);
}

.tile-icon {
    font-size: 2rem;
    line-height: 1;
    transition: transform 0.25s ease;
}

.tile-content h2 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.tile-content p {
    font-size: 0.8rem;
    color: var(--text-dim);
    line-height: 1.4;
}

.tile-badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    margin-top: 0.25rem;
}

.tile-badge.public {
    background: rgba(52, 211, 153, 0.1);
    color: var(--green);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.tile-badge.locked {
    background: rgba(34, 211, 238, 0.1);
    color: var(--accent);
    border: 1px solid rgba(34, 211, 238, 0.2);
}

.tile-badge.internal {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-dim);
    border: 1px solid rgba(100, 116, 139, 0.2);
}

/* Footer */
footer {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Animations */
.tile {
    animation: fadeUp 0.5s ease both;
}
.tile:nth-child(1) { animation-delay: 0.05s; }
.tile:nth-child(2) { animation-delay: 0.1s; }
.tile:nth-child(3) { animation-delay: 0.15s; }
.tile:nth-child(4) { animation-delay: 0.2s; }
.tile:nth-child(5) { animation-delay: 0.25s; }
.tile:nth-child(6) { animation-delay: 0.3s; }

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

/* Mobile */
@media (max-width: 640px) {
    header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
        padding: 1.25rem 1.25rem;
    }

    main {
        padding: 1.5rem 1.25rem;
    }

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

    .tile {
        padding: 1.25rem;
    }

    footer {
        flex-direction: column;
        gap: 0.25rem;
        padding: 0.75rem 1.25rem;
    }
}
