/* JSONB Operations - PostgreSQL Portfolio */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    color: #ffffff;
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    position: relative;
}
/* Portfolio Color Variables */
:root {
    --bg-primary: #181a20;
    --bg-accent: linear-gradient(135deg, #60BADB 0%, #b2becd 100%);
    --accent-color: #f5f6fa;
    --text-secondary: #b2becd;
}

/* Emoji styling to preserve colors */
.emoji {
    background: none !important;
    -webkit-background-clip: initial !important;
    -webkit-text-fill-color: initial !important;
    background-clip: initial !important;
    color: inherit;
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif !important;
    font-variant-emoji: unicode;
    margin-right: 0.5rem;
    display: inline-block;
}

/* Container */
.jsonb-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 0.6s ease-out;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

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

/* Header */
.jsonb-header {
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.jsonb-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.header-left h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #60BADB 0%, #b2becd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.header-left p {
    font-size: 1.2rem;
    opacity: 0.9;
    color: #b2becd;
}

.header-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Buttons */
.btn-refresh,
.btn-export,
.btn-return,
.execute-btn,
.try-btn,
.control-btn,
.toggle-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-refresh,
.btn-export {
    background: linear-gradient(135deg, #60BADB 0%, #4A90A4 100%);
    color: white;
}

.btn-return {
    background: linear-gradient(135deg, #353866 0%, #23263a 100%);
    color: white;
}
.return-section {
    margin-top: 40px;
    text-align: center;
    animation: fadeInUp 0.8s ease 0.3s both;
}
.btn-return {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 2px solid var(--bg-accent);
    padding: 12px 25px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Montserrat', Arial, sans-serif;
}
    
.btn-return:hover {
    background: var(--bg-accent);
    color: var(--accent-color);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(53, 56, 102, 0.4);
}

.execute-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    font-size: 16px;
    padding: 15px 30px;
}

.try-btn {
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5A52 100%);
    color: white;
    font-size: 12px;
    padding: 8px 16px;
}

.control-btn {
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.toggle-btn {
    background: linear-gradient(135deg, #FFA726 0%, #FF9800 100%);
    color: white;
}

.btn-refresh:hover,
.btn-export:hover {
    background: linear-gradient(135deg, #4A90A4 0%, #357A8C 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(96, 186, 219, 0.4);
}

.execute-btn:hover {
    background: linear-gradient(135deg, #45a049 0%, #388e3c 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
}

.try-btn:hover {
    background: linear-gradient(135deg, #EE5A52 0%, #E53E3E 100%);
    transform: translateY(-2px);
}

.control-btn:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.1));
    transform: translateY(-2px);
}

/* Stats Section */
.stats-section {
    margin-bottom: 40px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
}

.stat-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    border-color: #60BADB;
}

.stat-icon {
    font-size: 3rem;
    opacity: 0.8;
}

.stat-content h3 {
    font-size: 0.9rem;
    color: #b2becd;
    margin-bottom: 5px;
    font-weight: 500;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
    background: linear-gradient(135deg, #60BADB 0%, #b2becd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-change {
    font-size: 0.8rem;
    color: #60BADB;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.8rem;
    margin-bottom: 0;
    background: linear-gradient(135deg, #60BADB 0%, #b2becd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Operations Section */
.operations-section {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.operations-section:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.operation-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.operation-controls select {
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    font-size: 14px;
}

.operation-controls select option {
    background: #1a1a2e;
    color: #ffffff;
}

/* Operation Content */
.operation-content {
    margin-top: 25px;
}

.operation-tab {
    display: none;
}

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

.query-examples,
.manipulation-examples,
.aggregation-examples,
.indexing-examples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
}

.example-item {
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.example-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border-color: #60BADB;
}

.example-item h4 {
    color: #60BADB;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.example-item p {
    color: #b2becd;
    margin-bottom: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.query-preview {
    background: #0a0a15;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
}

.query-preview code {
    color: #60BADB;
    font-size: 0.85rem;
    white-space: pre;
}

/* Results Section */
.results-section {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.results-controls {
    display: flex;
    gap: 10px;
}

.results-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
}

.result-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: #b2becd;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-size: 14px;
    white-space: nowrap;
}

.result-tab.active,
.result-tab:hover {
    color: #60BADB;
    border-bottom-color: #60BADB;
}

.results-display {
    min-height: 300px;
}

.result-view {
    display: none;
}

.result-view.active {
    display: block;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #b2becd;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-results h3 {
    margin-bottom: 10px;
    color: #ffffff;
}

.table-container {
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.json-container,
.explain-container {
    background: #0a0a15;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.json-container pre {
    color: #60BADB;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Sample Data Section */
.sample-data-section {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 40px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.sample-data-content {
    display: none;
    margin-top: 25px;
}

.sample-data-content.active {
    display: block;
}

.data-examples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    width: 100%;
    box-sizing: border-box;
}

.data-example {
    background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

.data-example h4 {
    color: #60BADB;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.data-example pre {
    background: #0a0a15;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    color: #b2becd;
    margin: 0;
}

/* Schema Section */
.schema-section {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.schema-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
}

.schema-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: #b2becd;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-size: 14px;
    white-space: nowrap;
}

.schema-tab.active,
.schema-tab:hover {
    color: #60BADB;
    border-bottom-color: #60BADB;
}

.schema-view {
    display: none;
}

.schema-view.active {
    display: block;
}

.table-definitions,
.function-definitions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
}

.table-def,
.function-def {
    background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

.table-def h4,
.function-def h4 {
    color: #60BADB;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.table-def pre,
.function-def pre {
    background: #0a0a15;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #b2becd;
    margin: 0;
}

.index-explanations {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    width: 100%;
    box-sizing: border-box;
}

.index-explanation {
    background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

.index-explanation h4 {
    color: #60BADB;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.index-explanation p {
    color: #b2becd;
    margin-bottom: 15px;
    line-height: 1.5;
}

.index-explanation ul {
    color: #b2becd;
    padding-left: 20px;
    line-height: 1.6;
}

.index-explanation li {
    margin-bottom: 8px;
}

.index-explanation li strong {
    color: #60BADB;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 15, 35, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(96, 186, 219, 0.3);
    border-top: 3px solid #60BADB;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content h3 {
    margin-bottom: 10px;
    color: #ffffff;
}

.loading-content p {
    color: #b2becd;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .header-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .query-examples,
    .manipulation-examples,
    .aggregation-examples,
    .indexing-examples {
        grid-template-columns: 1fr;
    }
    
    .data-examples {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .jsonb-container {
        padding: 15px;
    }
    
    .jsonb-header {
        padding: 20px;
    }
    
    .header-left h1 {
        font-size: 2rem;
    }
    
    .header-left p {
        font-size: 1rem;
    }
    
    .header-right {
        flex-direction: column;
        gap: 10px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .section-header h2 {
        font-size: 1.4rem;
        line-height: 1.2;
        margin-bottom: 20px;
    }
    
    .operation-controls,
    .results-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .operations-section,
    .results-section,
    .sample-data-section,
    .schema-section {
        padding: 20px;
    }
    
    .example-item {
        padding: 15px;
    }
    
    .data-example {
        padding: 15px;
    }
    
    .table-def,
    .function-def,
    .index-explanation {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .jsonb-container {
        padding: 10px;
    }
    
    .jsonb-header {
        padding: 15px;
    }
    
    .header-left h1 {
        font-size: 1.6rem;
    }
    
    .header-left p {
        font-size: 0.9rem;
    }
    
    .section-header h2 {
        font-size: 1.2rem;
    }
    
    .operations-section,
    .results-section,
    .sample-data-section,
    .schema-section {
        padding: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        font-size: 2.5rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .btn-refresh,
    .btn-export,
    .btn-return,
    .execute-btn,
    .control-btn,
    .toggle-btn {
        padding: 10px 16px;
        font-size: 12px;
    }
    
    .execute-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .result-tab,
    .schema-tab {
        padding: 10px 15px;
        font-size: 12px;
    }
    
    .query-preview,
    .data-example pre,
    .table-def pre,
    .function-def pre {
        padding: 10px;
        font-size: 0.75rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #60BADB 0%, #4A90A4 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #4A90A4 0%, #357A8C 100%);
}