/* ==========================================================================
   Autobot API Wrapper & Gateway - Cyberpunk Glass Design System
   Path: /style.css
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Outfit:wght@400;500;600;700;800&family=Noto+Sans+Thai:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #07090e;
    --bg-card: rgba(15, 12, 28, 0.45);
    --border-glass: rgba(255, 255, 255, 0.05);
    
    --primary: #a855f7; /* Neon Purple */
    --primary-glow: rgba(168, 85, 247, 0.4);
    --secondary: #ec4899; /* Hot Pink */
    --secondary-glow: rgba(236, 72, 153, 0.4);
    --accent: #3b82f6; /* Electric Blue */
    
    --text-main: #f3f4f6;
    --text-muted: #8b8f9c;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Outfit', 'Noto Sans Thai', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 5% 15%, rgba(168, 85, 247, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 95% 75%, rgba(236, 72, 153, 0.08) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Scrollbar Style */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ==========================================================================
   Header Styles
   ========================================================================== */
header {
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-glass);
    backdrop-filter: blur(15px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo i {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 24px;
    filter: drop-shadow(0 0 6px var(--primary-glow));
}

.trial-badge {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: var(--secondary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.15);
    animation: pulseGlow 2s infinite alternate;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 5px rgba(236, 72, 153, 0.1); border-color: var(--border-glass); }
    100% { box-shadow: 0 0 15px rgba(236, 72, 153, 0.3); border-color: rgba(236, 72, 153, 0.4); }
}

/* ==========================================================================
   Main Grid Layout
   ========================================================================== */
.app-container {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 30px;
}

@media (max-width: 1100px) {
    .app-container {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Glass Cards / Panels
   ========================================================================== */
.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 24px;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    transition: var(--transition-smooth);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.08);
}

.panel-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.panel-title i {
    color: var(--primary);
    text-shadow: 0 0 6px var(--primary-glow);
}

/* ==========================================================================
   Input Form Styles
   ========================================================================== */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    color: white;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition-smooth);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Slider Controls */
.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-val {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    min-width: 24px;
}

/* Button Cyber Style */
.btn-cyber {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    border-radius: 14px;
    color: white;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
    margin-top: 10px;
}

.btn-cyber:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 25px rgba(168, 85, 247, 0.55);
    filter: brightness(1.1);
}

.btn-secondary-outline {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: var(--text-main);
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary-outline:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Status Indicators */
.status-box {
    margin-top: 15px;
    padding: 12px;
    border-radius: 12px;
    font-size: 13px;
    display: none;
    line-height: 1.4;
}

.status-box.success {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.2);
    color: var(--primary);
}

.status-box.loading {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(236, 72, 153, 0.1);
    border: 1px solid rgba(236, 72, 153, 0.2);
    color: var(--secondary);
}

/* Spinner Loader */
.spin-loader {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Analytics Dashboard Metrics Grid
   ========================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 25px;
}

@media (max-width: 850px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.metric-card {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
}

.metric-card.requests::before { background: var(--primary); }
.metric-card.latency::before { background: var(--accent); }
.metric-card.success-rate::before { background: #10b981; }
.metric-card.cost::before { background: var(--secondary); }

.metric-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.metric-value {
    font-size: 22px;
    font-weight: 800;
    color: white;
}

.metric-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.trend-up { color: #10b981; }
.trend-down { color: #ef4444; }

/* ==========================================================================
   Playground & Console Panel (Terminal Theme)
   ========================================================================== */
.playground-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

@media (max-width: 768px) {
    .playground-split {
        grid-template-columns: 1fr;
    }
}

.console-box {
    background: #040509;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    height: 380px;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.console-header {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.console-dots {
    display: flex;
    gap: 6px;
}

.console-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.console-dot.red { background-color: #ef4444; }
.console-dot.yellow { background-color: #f59e0b; }
.console-dot.green { background-color: #10b981; }

.console-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    font-family: 'Fira Code', monospace;
}

.console-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.5;
}

/* Input pane specifics */
.console-body textarea {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #e2e8f0;
    font-family: inherit;
    font-size: inherit;
    resize: none;
}

/* Output JSON syntax highlighting colors */
.json-key { color: #f472b6; }
.json-value { color: #38bdf8; }
.json-string { color: #34d399; }
.json-number { color: #fbbf24; }
.json-boolean { color: #a78bfa; }

/* ==========================================================================
   Tab-controlled Code Snippet Viewer
   ========================================================================== */
.snippet-panel {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 25px;
}

.snippet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.snippet-tabs {
    display: flex;
    gap: 6px;
}

.snippet-tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Fira Code', monospace;
    transition: var(--transition-smooth);
}

.snippet-tab-btn.active {
    background: rgba(168, 85, 247, 0.08);
    border-color: rgba(168, 85, 247, 0.2);
    color: var(--primary);
}

.code-container {
    background: #020306;
    border-radius: 12px;
    padding: 16px;
    position: relative;
    max-height: 220px;
    overflow-y: auto;
}

.code-container pre {
    font-family: 'Fira Code', monospace;
    font-size: 12.5px;
    color: #cbd5e1;
    white-space: pre-wrap;
    word-break: break-all;
}

.btn-copy {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-copy:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

/* Copy notification tip */
.copy-tooltip {
    position: absolute;
    right: 50px;
    top: 14px;
    background: #10b981;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    opacity: 0;
    transition: var(--transition-smooth);
    pointer-events: none;
}
.copy-tooltip.show {
    opacity: 1;
}

/* ==========================================================================
   Logs Table
   ========================================================================== */
.table-panel {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 20px;
    overflow: hidden;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    text-align: left;
}

th {
    padding: 12px 16px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge.ok {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.badge.err {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.empty-state h3 {
    color: white;
    font-size: 20px;
    margin-bottom: 8px;
    font-weight: 700;
}

.empty-state p {
    font-size: 14px;
    max-width: 400px;
}

/* ==========================================================================
   CSS Print Configuration
   ========================================================================== */
@media print {
    body {
        background-color: white !important;
        color: black !important;
        background-image: none !important;
    }
    
    header, .glass-panel:first-child, .btn-cyber, .right-controls, .trial-badge, .btn-copy, .console-box:first-child, .snippet-panel {
        display: none !important;
    }
    
    .app-container {
        display: block !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .glass-panel.main-content {
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        page-break-inside: avoid;
        margin-bottom: 30px !important;
    }
    
    .metric-card {
        background: none !important;
        border: 1px solid #ddd !important;
        color: black !important;
    }
    
    .metric-value {
        color: black !important;
    }
    
    table {
        color: black !important;
    }
    
    th, td {
        border-bottom: 1px solid #ddd !important;
        color: black !important;
    }
}
