/* 
 * TSun Info - Professional Design System
 * Hand-crafted with logic and precision.
 */

:root {
    /* Color Palette - Dark & Premium */
    --bg-core: #050505;
    --bg-surface: #0f0f0f;
    --bg-surface-hover: #1a1a1a;
    --bg-glass: rgba(20, 20, 20, 0.7);

    --primary-hue: 16;
    /* Orange-Red */
    --primary: hsl(var(--primary-hue), 100%, 50%);
    --primary-dim: hsl(var(--primary-hue), 100%, 30%);
    --primary-glow: hsla(var(--primary-hue), 100%, 50%, 0.3);

    --accent-cyan: #00f2ff;
    --accent-purple: #bd00ff;

    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --text-dim: #505050;

    --border-light: rgba(255, 255, 255, 0.1);
    --border-active: rgba(255, 69, 0, 0.5);

    --success: #00ff9d;
    --error: #ff2a6d;

    /* Spacing & Layout */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;

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

    /* Animation */
    --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
    --ease-in-out: cubic-bezier(0.645, 0.045, 0.355, 1);
}

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

body {
    background-color: var(--bg-core);
    color: var(--text-main);
    font-family: var(--font-ui);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #fff;
}

/* Background Effects */
.bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background:
        radial-gradient(circle at 15% 50%, rgba(255, 69, 0, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(189, 0, 255, 0.05), transparent 25%);
    pointer-events: none;
}

.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
    mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
    pointer-events: none;
}

/* Layout Containers */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-md);
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.brand-logo {
    font-size: 1.5rem;
    animation: pulse-fire 3s infinite;
}

.brand-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: var(--bg-surface-hover);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    color: var(--primary);
    border: 1px solid var(--primary-dim);
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: var(--space-sm);
    background: var(--bg-surface);
    padding: 6px;
    border-radius: var(--radius-lg);
    width: fit-content;
    /* Removed auto margins as parent centers it now */
    border: 1px solid var(--border-light);
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 24px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s var(--ease-out);
    position: relative;
    overflow: hidden;
}

.nav-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    color: var(--bg-core);
    background: var(--text-main);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

/* Content Sections */
.tab-content {
    display: none;
    animation: fade-in-up 0.5s var(--ease-out);
}

.tab-content.active {
    display: block;
}

/* Search Interface */
.search-interface {
    max-width: 600px;
    margin: 0 auto var(--space-lg);
    text-align: center;
}

.search-title {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
    background: linear-gradient(to right, #fff, #a0a0a0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.search-subtitle {
    color: var(--text-muted);
    margin-bottom: var(--space-md);
    font-size: 1.1rem;
}

.input-group {
    position: relative;
    display: flex;
    gap: var(--space-xs);
}

.search-input {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    background: var(--bg-surface-hover);
}

.action-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 32px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.action-btn:hover {
    background: #ff5e00;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px var(--primary-glow);
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.data-card {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    transition: transform 0.3s var(--ease-out), border-color 0.3s ease;
}

.data-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-active);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-light);
}

.card-title {
    font-size: 1.1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-icon {
    color: var(--primary);
}

/* Info Rows */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.info-value {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-main);
    text-align: right;
}

.info-value.highlight {
    color: var(--primary);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-region {
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 242, 255, 0.2);
}

.badge-rank {
    background: rgba(255, 69, 0, 0.1);
    color: var(--primary);
    border: 1px solid rgba(255, 69, 0, 0.2);
}

/* Outfit Display */
.outfit-container {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.outfit-image {
    max-width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.outfit-container:hover .outfit-image {
    transform: scale(1.05);
}

/* Loading State */
.loading-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid var(--text-dim);
    border-radius: 50%;
    display: inline-block;
    position: relative;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

.loader::after {
    content: '';
    box-sizing: border-box;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-bottom-color: var(--primary);
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Animations */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-fire {
    0% {
        text-shadow: 0 0 10px rgba(255, 69, 0, 0.5);
    }

    50% {
        text-shadow: 0 0 20px rgba(255, 69, 0, 0.8), 0 0 30px rgba(255, 140, 0, 0.6);
    }

    100% {
        text-shadow: 0 0 10px rgba(255, 69, 0, 0.5);
    }
}

/* Footer */
.main-footer {
    padding: var(--space-md);
    text-align: center;
    color: var(--text-dim);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-light);
    margin-top: auto;
}

.footer-link {
    color: var(--text-muted);
    margin: 0 10px;
    position: relative;
}

.footer-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.footer-link:hover::after {
    width: 100%;
}

/* API Docs Specifics */
.docs-container {
    max-width: 900px;
    margin: 0 auto;
}

.endpoint-block {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    overflow: hidden;
}

.endpoint-header {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--border-light);
}

.method {
    font-family: var(--font-mono);
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.method.get {
    background: rgba(0, 255, 157, 0.1);
    color: var(--success);
}

.method.post {
    background: rgba(255, 184, 0, 0.1);
    color: #ffb800;
}

.path {
    font-family: var(--font-mono);
    color: var(--text-main);
}

.endpoint-body {
    padding: 20px;
}

.code-snippet {
    background: #000;
    padding: 15px;
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: #a0a0a0;
    overflow-x: auto;
    border: 1px solid var(--border-light);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-tabs {
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 4px;
    }

    .nav-btn {
        padding: 8px 16px;
        white-space: nowrap;
    }

    .input-group {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
        padding: 16px;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
}
/* JSON Viewer Styles */
.json-viewer {
    max-height: 600px;
    overflow: auto;
    background: #000;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.json-code {
    margin: 0;
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    color: #a0a0a0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* JSON Syntax Highlighting */
.json-key {
    color: #00f2ff; /* Cyan for keys */
    font-weight: 600;
}

.json-string {
    color: #00ff9d; /* Green for string values */
}

.json-number {
    color: #bd00ff; /* Purple for numbers */
}

.json-boolean {
    color: var(--primary); /* Orange for booleans */
    font-weight: 700;
}

.json-null {
    color: #ff2a6d; /* Pink/red for null */
    font-style: italic;
}

/* Copy Button */
.copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.copy-btn svg {
    width: 16px;
    height: 16px;
}

/* Scrollbar Styling for JSON Viewer */
.json-viewer::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.json-viewer::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.json-viewer::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.json-viewer::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
