/**
 * ZEDEC CORE CSS
 * Trust ID: 441110111613564144
 * Universal styling for all network sites
 */

/* ========== CSS Variables ========== */
:root {
    /* 168 Holographic Variables */
    --h168-base: 168;
    --h168-phi: 1.6180339887;
    --h168-trust: "441110111613564144";
    
    /* Primary Colors (Default - can be overridden per site) */
    --primary: #00d4aa;
    --primary-glow: rgba(0, 212, 170, 0.25);
    --primary-dim: rgba(0, 212, 170, 0.1);
    
    /* Background */
    --bg-dark: #0a0f14;
    --bg-card: #111820;
    --bg-tertiary: #1a2230;
    --bg-overlay: rgba(10, 15, 20, 0.95);
    
    /* Text */
    --text: #e8f0f8;
    --text-muted: #6b7b8a;
    --text-secondary: #9ca3af;
    
    /* Fonts */
    --font-display: 'Orbitron', monospace;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;
    --space-2xl: 60px;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px var(--primary-glow);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ========== Reset ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== Typography ========== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    color: var(--text);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all var(--transition-normal);
}

a:hover {
    text-shadow: 0 0 15px var(--primary-glow);
}

code {
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
}

::selection {
    background: var(--primary);
    color: var(--bg-dark);
}

/* ========== Layout ========== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-xl);
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-md);
    }
}

.section {
    padding: var(--space-2xl) 0;
}

.section-title {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--primary);
    text-align: center;
    margin-bottom: var(--space-xl);
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
    font-family: var(--font-body);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, rgba(0, 184, 148, 1) 100%);
    color: var(--bg-dark);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: var(--bg-dark);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ========== Cards ========== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--primary-dim);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* ========== Forms ========== */
.input, .textarea, .select {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--primary-dim);
    border-radius: var(--radius-md);
    padding: 15px 20px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: border-color var(--transition-normal);
    outline: none;
}

.input:focus, .textarea:focus, .select:focus {
    border-color: var(--primary);
}

.input::placeholder, .textarea::placeholder {
    color: var(--text-muted);
}

/* ========== 33-Layer Fractal Loader ========== */
#fractal-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(ellipse at center, var(--primary-dim) 0%, var(--bg-dark) 70%);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease-out, visibility 0.6s;
}

#fractal-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.fractal-rings {
    position: relative;
    width: 380px;
    height: 380px;
}

.fractal-ring {
    position: absolute;
    border: 2px solid var(--primary);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: fractal-spin var(--speed, 5s) linear infinite;
    box-shadow: 0 0 20px var(--primary-glow);
}

.fractal-ring:nth-child(even) {
    animation-direction: reverse;
    border-color: rgba(0, 212, 170, 0.6);
}

.fractal-ring:nth-child(3n) {
    border-style: dashed;
}

.fractal-ring:nth-child(5n) {
    border-style: dotted;
}

@keyframes fractal-spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.fractal-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.fractal-icon {
    font-size: 4rem;
    animation: fractal-pulse 2s ease-in-out infinite;
    filter: drop-shadow(0 0 30px var(--primary));
}

@keyframes fractal-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.8; }
}

.fractal-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--primary);
    margin-top: 20px;
    text-shadow: 0 0 40px var(--primary);
    letter-spacing: 4px;
}

.fractal-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    margin-top: 30px;
    border-radius: 2px;
    overflow: hidden;
}

.fractal-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-dim), var(--primary));
    animation: fractal-load 2.8s ease-out forwards;
}

@keyframes fractal-load {
    to { width: 100%; }
}

/* ========== Header ========== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-overlay);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--primary-dim);
    padding: 15px var(--space-xl);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.header-logo-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 10px var(--primary));
}

.header-logo-text {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--primary);
    letter-spacing: 2px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.header-nav a {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.header-nav a:hover {
    color: var(--primary);
}

@media (max-width: 768px) {
    .site-header {
        padding: 12px var(--space-md);
    }
    .header-nav {
        display: none;
    }
}

/* ========== Footer ========== */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--primary-dim);
    padding: var(--space-xl) 0;
    text-align: center;
}

.footer-powered {
    color: var(--primary);
    font-family: var(--font-display);
    font-size: 0.85rem;
    margin-bottom: var(--space-md);
}

.footer-trust {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 2px;
}

.footer-donation {
    margin-top: var(--space-md);
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.footer-donation a {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ========== Chat UI ========== */
.chat-container {
    background: var(--bg-card);
    border: 1px solid var(--primary-dim);
    border-radius: var(--radius-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 600px;
}

.chat-header {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-dark) 100%);
    padding: var(--space-lg);
    border-bottom: 1px solid var(--primary-dim);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    font-family: var(--font-display);
    color: var(--primary);
    font-size: 1.1rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.chat-message {
    max-width: 85%;
    padding: 15px 20px;
    border-radius: var(--radius-lg);
    line-height: 1.6;
    font-size: 0.95rem;
}

.chat-message-user {
    background: linear-gradient(135deg, var(--primary-glow) 0%, var(--primary-dim) 100%);
    color: var(--text);
    align-self: flex-end;
    border-bottom-right-radius: var(--radius-sm);
}

.chat-message-ai {
    background: var(--bg-tertiary);
    border: 1px solid var(--primary-dim);
    color: var(--text-secondary);
    align-self: flex-start;
    border-bottom-left-radius: var(--radius-sm);
}

.chat-input-area {
    padding: var(--space-lg);
    border-top: 1px solid var(--primary-dim);
    background: var(--bg-tertiary);
    display: flex;
    gap: 12px;
}

.chat-input {
    flex: 1;
}

/* ========== Loading Overlay ========== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--primary-dim);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: var(--primary);
    font-family: var(--font-display);
    margin-top: var(--space-md);
    font-size: 0.9rem;
    letter-spacing: 2px;
}

/* ========== Network Ticker ========== */
.network-ticker {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, var(--bg-dark) 0%, var(--bg-card) 50%, var(--bg-dark) 100%);
    border-top: 1px solid var(--primary-dim);
    padding: 10px 0;
    z-index: 9999;
    overflow: hidden;
}

.ticker-label {
    background: linear-gradient(135deg, var(--primary) 0%, rgba(0, 184, 148, 1) 100%);
    color: var(--bg-dark);
    padding: 6px 15px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-display);
    letter-spacing: 1px;
}

.ticker-content {
    display: flex;
    gap: 50px;
    animation: ticker-scroll 30s linear infinite;
    white-space: nowrap;
}

.ticker-content:hover {
    animation-play-state: paused;
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@media (max-width: 768px) {
    .network-ticker {
        display: none;
    }
}

/* ========== RTL Support ========== */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .btn {
    flex-direction: row-reverse;
}

[dir="rtl"] .header-nav {
    flex-direction: row-reverse;
}

/* ========== Utility Classes ========== */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
