@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

/* GoMap Developer Platform Theme */

:root {
    /* Mapbox-style Clean Light Theme */
    --bg-body: #ffffff;
    --bg-sidebar: #f8fafc;
    --bg-sidebar-hover: #e2e8f0;
    --bg-card: #ffffff;
    --bg-panel: rgba(255, 255, 255, 0.95);
    
    --text-primary: #0f172a; /* Slate 900 */
    --text-secondary: #64748b; /* Slate 500 */
    --text-tertiary: #94a3b8; /* Slate 400 */
    --text-code: #334155;
    
    --primary: #0066FF; /* Mapbox Blue */
    --primary-hover: #0052cc;
    --primary-dim: rgba(0, 102, 255, 0.1);
    
    --accent: #6366f1;
    
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    
    --border: #e2e8f0; /* Slate 200 */
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 12px; /* Softer corners */
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Sidebar --- */
.app-sidebar {
    width: 240px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 50;
    padding: 16px 0;
}

.app-brand {
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    margin-bottom: 24px;
}

.app-brand-logo {
    font-weight: 700;
    font-size: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.02em;
}

.app-brand-logo span { color: var(--primary); }

.sidebar-section-label {
    padding: 0 20px;
    margin-top: 24px;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-tertiary);
    letter-spacing: 0.5px;
}

.app-nav {
    flex: 1;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
    border: none;
}

.nav-item:hover {
    background-color: var(--bg-sidebar-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: #eff6ff; /* Light Blue bg */
    color: var(--primary);
    font-weight: 600;
}

.nav-item i { 
    width: 18px; 
    text-align: center; 
    font-size: 14px; 
}

/* --- Main Content --- */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg-body);
}

.app-header {
    height: 64px;
    background: var(--bg-body);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    flex-shrink: 0;
}

.page-title { 
    font-size: 16px; 
    font-weight: 600; 
    color: var(--text-primary); 
    display: flex;
    align-items: center;
    gap: 8px;
}

.api-key-display {
    font-family: var(--font-mono);
    font-size: 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.api-key-display:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

/* --- Map & Panels --- */
.map-fullscreen {
    width: 100%;
    height: 100%;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    background: #f8fafc;
}

/* Floating Panels */
.floating-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    color: var(--text-primary);
}

.map-overlay-panel {
    position: absolute;
    top: 20px; left: 20px;
    width: 340px;
    max-height: calc(100% - 40px);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.panel-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.panel-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.panel-content {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Inspector Panel (New) */
.api-inspector-panel {
    position: absolute;
    bottom: 20px; 
    right: 20px;
    left: 380px; /* Avoid left panel */
    height: 200px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.api-inspector-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.9);
}

.api-inspector-content {
    flex: 1;
    background: #0b1221;
    padding: 0;
    overflow: hidden;
    display: flex;
}

.code-block {
    flex: 1;
    padding: 16px;
    overflow: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-code);
    margin: 0;
    white-space: pre;
}

.code-label {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

/* Quick Search Chips */
.quick-search-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 8px;
    scrollbar-width: none;
}
.quick-search-scroll::-webkit-scrollbar { display: none; }

.chip {
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 100px;
    background: #f1f5f9;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.chip:hover { 
    background: #e2e8f0; 
    color: var(--text-primary); 
    transform: translateY(-1px);
}
.chip.active { 
    background: #eff6ff; 
    color: var(--primary); 
    border-color: rgba(0, 102, 255, 0.3);
}
.chip i { font-size: 11px; }

/* Search & Inputs */
.search-box {
    padding: 16px;
    background: transparent;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group i {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    z-index: 1;
}

.form-control {
    width: 100%;
    padding: 10px 12px 10px 36px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: white;
    outline: none;
    font-family: var(--font-sans);
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    background: rgba(0,0,0,0.4);
}

.form-control::placeholder {
    color: var(--text-tertiary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tabs */
.tabs {
    display: flex;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
}

.tab {
    padding: 12px 0;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* List Items */
.list-item {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.1s;
}
.list-item:hover {
    background: rgba(255,255,255,0.03);
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
    transition: all 0.2s;
}
.badge:hover { opacity: 0.9; }
.badge-blue { background: #e0f2fe; color: #0284c7; border-color: #bae6fd; }
.badge-green { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.badge-orange { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }

/* Syntax Highlighting Sim */
.hl-key { color: #93c5fd; }
.hl-string { color: #86efac; }
.hl-number { color: #fca5a5; }

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* --- Dashboard Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    padding: 20px;
}

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

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* Quick Access Grid */
.quick-access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.style-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.style-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.style-preview {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.style-info {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.style-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.style-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Info Widget */
.info-widget {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.info-widget-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.info-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s;
}

.info-link:hover {
    background: var(--bg-sidebar);
}

/* --- Analytics Styles --- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); padding: 24px; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: all 0.2s; }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-label { color: var(--text-secondary); font-size: 13px; font-weight: 600; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.5px; }
.stat-trend { font-size: 13px; margin-top: 8px; display: flex; align-items: center; gap: 4px; font-weight: 500; }
.trend-up { color: var(--success); }
.trend-down { color: var(--success); } 
.trend-neutral { color: var(--text-secondary); }

.chart-container { background: var(--bg-card); padding: 24px; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); height: 400px; position: relative; }

/* --- Access Tokens Styles --- */
.token-key { font-family: var(--font-mono); background: #f1f5f9; padding: 6px 10px; border-radius: 6px; color: var(--text-primary); border: 1px solid var(--border); font-size: 13px; }

.token-key-display {
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.2s;
}
.token-key-display:hover {
    border-color: var(--primary);
}

/* Tables */
.card { background: var(--bg-card); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); padding: 24px; margin-bottom: 24px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-title { font-size: 16px; font-weight: 700; margin: 0; color: var(--text-primary); }

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table th { text-align: left; padding: 12px 16px; background: #f8fafc; color: var(--text-secondary); font-size: 12px; font-weight: 600; text-transform: uppercase; border-bottom: 1px solid var(--border); }
.data-table td { padding: 16px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text-primary); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-input { width: 100%; padding: 10px 12px; background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-md); font-size: 14px; color: var(--text-primary); outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }

/* Custom Select */
.select-wrapper { position: relative; }
.select-arrow { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); pointer-events: none; font-size: 12px; }

/* Modal Polish */
.modal-overlay {
    display: none; /* Hidden by default - Critical */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 9999; /* Highest z-index */
    align-items: center;
    justify-content: center;
}

/* When active, use flex to center */
.modal-overlay.active {
    display: flex;
}

.modal { 
    background: #ffffff; 
    padding: 0; 
    border-radius: var(--radius-lg); 
    box-shadow: var(--shadow-xl); 
    border: 1px solid rgba(255,255,255,0.1); 
    display: flex; /* Flexbox for header/body/footer */
    flex-direction: column;
    overflow: hidden;
    position: relative; /* For internal absolute positioning */
    max-width: 95vw;
    max-height: 95vh;
    animation: modalPop 0.2s ease-out forwards;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-sm { width: 480px; }
.modal-md { width: 640px; }
.modal-lg { width: 900px; }

.modal-header {
    padding: 24px 24px 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}

.modal-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.modal-body {
    padding: 0 24px;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    margin-top: 24px;
}

.btn-text {
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    border: 1px solid transparent;
    transition: all 0.2s;
}
.btn-text:hover {
    color: var(--text-primary);
    background: #f1f5f9;
}

/* Token Modal Specifics - Override previous if needed */
#createModal .modal { width: 480px; } 

/* Studio Modal Specifics */
#studio-create-modal .modal { width: 900px; height: 600px; display: grid; grid-template-columns: 360px 1fr; }

.btn-close { width: 32px; height: 32px; border-radius: 6px; border: none; background: transparent; color: var(--text-tertiary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; margin-right: -8px; margin-top: -8px; }
.btn-close:hover { background: #f1f5f9; color: var(--text-primary); }

/* --- Studio Create Modal (Mapbox Style) --- */
.studio-modal {
    width: 900px;
    height: 600px;
    display: grid;
    grid-template-columns: 360px 1fr;
    padding: 0;
    background: #ffffff;
    overflow: hidden;
}

.studio-modal-sidebar {
    padding: 32px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.studio-modal-map {
    background: #f1f5f9;
    position: relative;
}

/* Selection Cards */
.option-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.option-card:hover {
    border-color: var(--primary);
    background: #f8fafc;
}

.option-card.active {
    border-color: var(--primary);
    background: #eff6ff;
    box-shadow: 0 0 0 1px var(--primary);
}

.option-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-secondary);
}
.option-card.active .option-icon {
    background: var(--primary);
    color: white;
}

/* Configuration Pills */
.config-row {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    font-size: 13px;
}
.config-label {
    width: 100px;
    color: var(--text-secondary);
    font-weight: 500;
}
.pill-group {
    display: flex;
    background: #f1f5f9;
    padding: 2px;
    border-radius: 100px;
}
.pill-btn {
    padding: 4px 12px;
    border-radius: 100px;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.pill-btn.active {
    background: #ffffff;
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Footer Buttons */
.studio-footer {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 24px;
}
