/* 
   Integra - Enterprise Minimalist Theme 
   Priya IO Systems
*/

:root {
    /* Color Palette - Enterprise Grays & Accents */
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f2f2f2;
    /* Matches WASM Alternate Row */
    --color-bg-tertiary: #eaecee;
    /* Matches WASM Header */

    --color-text-primary: #333333;
    --color-text-secondary: #4a4a4a;
    --color-text-light: #6c757d;

    /* Brand Accents (Cyan/Blue derived from discussion) */
    --color-accent: #00ADD8;
    /* Cyan from Integra Cloud logo connection or similar */
    --color-accent-hover: #008eb0;
    --color-accent-dark: #005f73;

    /* Text Highlight */
    --color-text-highlight: #005f73;
    /* Deep Teal (Brand Dark Accent) */

    /* Status Colors */
    --color-success: #28a745;

    /* Spacing */
    --space-xs: 0.5rem;
    /* 8px */
    --space-sm: 1rem;
    /* 16px */
    --space-md: 2rem;
    /* 32px */
    --space-lg: 4rem;
    /* 64px */
    --space-xl: 8rem;
    /* 128px */

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    --font-mono: 'Courier New', monospace;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.05), 0 4px 6px rgba(0, 0, 0, 0.05);

    /* Consolidated Colors */
    --color-border-soft: #dee2e6;
    --color-bg-light: #f8f9fa;
    --color-bg-hover: #e9ecef;
    --color-text-muted: #6c757d;
    --color-charcoal: #495057;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-primary);
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* Typography Utilities */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1.2;
    margin-bottom: var(--space-sm);
}

h1 {
    font-size: 2.5rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 2rem;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: var(--space-sm);
    color: var(--color-text-secondary);
}

.text-accent {
    color: var(--color-accent);
}

.text-center {
    text-align: center;
}

.text-sm {
    font-size: 0.875rem;
}

.text-lg {
    font-size: 1.125rem;
}

.font-medium {
    font-weight: 500;
}

.brand-font {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    letter-spacing: 0;
    /* Reset spacing for serif */
}



/* Layout Utilities */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-sm);
}

.section {
    padding: var(--space-lg) 0;
}

/* Reduced spacing for mobile, larger for desktop consistency */
@media (max-width: 768px) {
    .section {
        padding: var(--space-md) 0;
    }
}

.grid {
    display: grid;
    gap: var(--space-md);
}

.grid-2 {
    grid-template-columns: 1fr;
}

/* Mobile default */
.grid-3 {
    grid-template-columns: 1fr;
}

/* Mobile default */

@media (min-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr 1fr;
    }

    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    h1 {
        font-size: 3.5rem;
    }

    h2 {
        font-size: 2.5rem;
    }
}

/* Components */

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-bg-tertiary);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: var(--space-sm) 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 700;
    font-size: 1.25rem;
    color: #666666;
}

.logo-icon {
    height: 32px;
    width: auto;
}

.nav-menu {
    display: none;
    /* Mobile hidden by default */
}

@media (min-width: 768px) {
    .nav-menu {
        display: flex;
        gap: var(--space-md);
        align-items: center;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.875rem;
}

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

.btn-primary:hover {
    background-color: var(--color-accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.btn-secondary:hover {
    background-color: #dee2e6;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--color-bg-tertiary);
    color: var(--color-text-secondary);
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

/* Hero Section */
.hero {
    padding: var(--space-xl) 0 var(--space-lg);
    background: radial-gradient(circle at top right, var(--color-bg-secondary) 0%, #fff 70%);
}

.hero-content {
    max-width: 800px;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
    background-color: #e0f7fa;
    /* Light Cyan */
    color: var(--color-accent-dark);
}

/* Product Cards */
.product-card {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-bg-tertiary);
    border-radius: 12px;
    padding: var(--space-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-accent);
}

.card-icon {
    width: 48px;
    height: 48px;
    background: var(--color-bg-secondary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-sm);
    color: var(--color-accent);
}

.product-header {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: var(--space-sm);
}

.product-logo-inline {
    height: 32px;
    /* Adjusted to match text height roughly */
    width: auto;
    display: block;
}

.product-header h3 {
    margin-bottom: 0;
    /* Remove bottom margin to align with logo */
    font-size: 1.5rem;
    color: #666666;
}

/* Features List inside Grid */
.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: var(--color-text-secondary);
}

.feature-list li::before {
    content: "✓";
    color: var(--color-success);
    font-weight: bold;
}

/* Section specific */
.bg-light {
    background-color: var(--color-bg-secondary);
}

.compliance-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--color-bg-tertiary);
    border-radius: 8px;
    margin-top: var(--space-sm);
    font-size: 0.875rem;
    color: var(--color-text-light);
}

/* Footer */
.footer {
    background-color: #e2e6ea;
    padding: var(--space-lg) 0 var(--space-md);
    border-top: 1px solid var(--color-bg-tertiary);
}

.footer-bottom {
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    font-size: 0.875rem;
    color: var(--color-text-light);
    text-align: center;
}

@media (min-width: 768px) {
    .footer-bottom {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

/* =========================================
   WASM Viewer Specific Styles
   ========================================= */

.viewer-body {
    background: #dde2e6;
    color: var(--color-text-primary);
    height: 100vh;
    padding: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.viewer-container {
    width: 100%;
    max-width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    margin-bottom: 0;
}

.viewer-header {
    padding: 4px 10px;
    background: #eaecee;
    border-bottom: 1px solid #ced4da;
    color: var(--color-text-primary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    position: relative;
    /* For absolute centering of badge */
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 15px;
}

.viewer-header h1 {
    font-size: 1.3em;
    margin: 0;
    font-weight: 600;
}

.viewer-header .version {
    opacity: 0.88;
    font-size: 0.8em;
}

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



.validation-badge {
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 0.85em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    height: 28px;
    background: transparent;
    color: var(--color-text-primary);
}

.validation-badge:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.validation-badge.success {
    color: #28a745;
}

/* Modal Styles */
.privacy-badge {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: #e8f5e9;
    border: 2px solid #c3e6cb;
    border-radius: 20px;
    color: #2e7d32;
    font-size: 0.85em;
    white-space: nowrap;
    /* Prevent wrapping */
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #666;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}



.drag-active {
    background: #e9ecef !important;
    outline: 2px dashed var(--color-accent);
    outline-offset: -2px;
}

.file-input {
    display: none;
}

.viewer-content {
    flex: 1;
    overflow: hidden;
    display: block;
}

.panes-container {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.viewer-left-pane {
    width: 17%;
    border-right: 1px solid #ced4da;
    overflow-y: auto;
    background: #f1f3f5;
    position: relative;
    min-width: 200px;
    max-width: 60%;
    padding: 15px;
    flex: 0 0 auto;
}

.resize-handle {
    width: 10px;
    background-color: #f8f9fa;
    border-left: 1px solid #dee2e6;
    border-right: 1px solid #dee2e6;
    cursor: col-resize;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    z-index: 20;
    position: relative;
}

.resize-handle::after {
    content: "";
    width: 4px;
    height: 24px;
    border-left: 2px solid #ccc;
    border-right: 2px solid #ccc;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.resize-handle:hover,
.resize-handle.active {
    background-color: #e2e6ea;
}

.resize-handle:hover::after,
.resize-handle.active::after {
    border-color: #888;
    opacity: 0.8;
}

.viewer-right-pane {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: white;
    min-width: 0;
}

.sticky-header-container {
    flex-shrink: 0;
    border-bottom: 1px solid #ddd;
    background: white;
    z-index: 10;
}

.scrollable-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 15px 15px 15px;
    scroll-behavior: smooth;
}

.viewer-table th {
    text-align: left;
    padding: 8px;
    background: #f8f9fa;
    /* Lighter background */
    border-bottom: 2px solid #e9ecef;
    /* Softer border */
    font-weight: 400;
    /* Normal weight */
    color: #495057;
    /* Charcoal (Darker Gray) */
    position: sticky;
    top: 0;
    z-index: 5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    /* Softer shadow */
    background-clip: padding-box;
    border-right: 1px solid #ced4da;
    /* Visible column separator */
}

.viewer-table th:last-child {
    border-right: none;
}

.viewer-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9em;
}

.detail-section-header {
    padding: 15px 15px 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    min-width: 0;
    /* Enable flex shrinking for children */
}

.detail-section-header h3 {
    margin: 0;
    color: var(--color-text-primary);
    font-size: 1.0em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
    /* Take all available space, but shrink if needed */
    min-width: 0;
    margin-right: 15px;
    /* Ensure gap between title and badge */
}





.file-badge {
    font-family: var(--font-mono);
    font-size: 1em;
    padding: 2px 8px;
    /* Compact padding */
    background-color: transparent;
    /* Seamless */
    color: var(--color-text-secondary);
    border: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    vertical-align: middle;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 60%;
    /* Increased space */
    justify-content: flex-end;
    white-space: nowrap;
    /* CRITICAL */
    flex-wrap: nowrap;
    /* CRITICAL */
}

.file-badge-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 0 1 auto;
    /* Allow shrinking */
    min-width: 0;
    /* CRITICAL for flex child truncation */
    font-size: 0.9em;
    /* Match group context size */
    font-weight: 500;
    padding-bottom: 1px;
    /* Prevent underscore baseline clipping */
    line-height: 1.2;
    /* Ensure underscores are fully visible */
}

.file-badge-stats {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
    padding-left: 8px;
    border-left: 1px solid #dee2e6;
    cursor: pointer;
}

.file-badge-stats:hover {
    background-color: #e9ecef;
    border-radius: 4px;
}

.file-context-bar {
    background: #f1f3f5;
    /* Match tree view background */
    border-bottom: 1px solid #dee2e6;
    padding: 6px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 36px;
    font-size: 0.85em;
    line-height: 1;
    gap: 15px;
    position: relative;
    z-index: 10;
    flex-wrap: nowrap;
}

/* Update right pane to be a flex container column */
.viewer-right-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Constrain parent */
    height: 100%;
}

.detail-view-content {
    flex: 1;
    overflow: hidden;
    /* Remove scroll from here */
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* New: Make this the dedicated scroll container for the table */
.scrollable-content {
    flex: 1;
    overflow-y: auto;
    /* Scroll happens here */
    width: 100%;
    position: relative;
    /* Context for sticky */
}

.terms-link-header {
    margin-right: 15px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.9em;
    border-bottom: 1px dashed #ccc;
}

.terms-link-header:hover {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

.legend-box {
    margin: 0 20px 10px 20px;
    padding: 10px;
    background: #f9f9f9;
    border-left: 3px solid #495057;
    font-size: 0.85em;
    position: sticky;
    top: 50px;
    z-index: 4;
}

.validation-summary {
    margin: 10px 20px;
    padding: 12px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
}

.tree-node {
    margin-left: 0;
    white-space: nowrap;
}

.tree-node:first-child {
    margin-left: 0;
}

.group-header {
    padding: 2px 8px;
    margin: 1px 0;
    cursor: pointer;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.group-header:hover {
    background: #e9ecef;
}

.group-header.selected {
    background: #ced4da;
    /* Darker selection for visibility */
    color: var(--color-text-primary);
    font-weight: 700;
}

.group-header.selected .group-toggle {
    color: var(--color-text-primary);
}

.group-toggle {
    width: 20px;
    /* Increased width for click target */
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    /* Lighter default */
    flex-shrink: 0;
    transition: transform 0.2s ease;
    /* Smooth rotation */
}

.group-toggle svg {
    display: block;
    transition: transform 0.2s ease;
}

.group-toggle.expanded svg {
    transform: rotate(90deg);
}

/* ... existing styles ... */

.aws-link {
    padding: 6px 12px;
    background: var(--color-bg-light);
    color: var(--color-charcoal);
    border: 1px solid var(--color-border-soft);
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 12px;
    /* Increased gap */
    transition: background 0.2s;
}

.detail-section {
    margin-bottom: 20px;
}

.validation-summary h4 {
    margin-bottom: 8px;
    color: #856404;
}

.warning-item {
    padding: 8px;
    margin: 4px 0;
    background: #fffbdd;
    border-radius: 3px;
    font-size: 0.9em;
}

.viewer-table th,
.viewer-table td {
    padding: 4px 8px;
    /* Compact padding (was likely larger default) */
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    height: 32px;
    /* Enforce min-height/consistency */
    vertical-align: top;
}

.viewer-table tr:nth-child(even) {
    background-color: #f8f9fa;
    /* Lighter alternate row */
}

.viewer-table tr:hover {
    background: #e9ecef;
}

.field-value {
    color: var(--color-text-highlight);
    font-weight: 500;
}

/* ... existing styles ... */

.aws-link {
    padding: 6px 12px 6px 8px;
    /* Reduced left padding to 8px */
    background: var(--color-bg-light);
    color: var(--color-charcoal);
    border: 1px solid var(--color-border-soft);
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 12px;
    /* Slightly reduced gap to balance */
    transition: background 0.2s;
}

.message-box {
    padding: 12px;
    border-radius: 4px;
    margin: 10px 0;
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #0c5460;
}

.error,
.loading {
    text-align: center;
    padding: 30px;
    margin: 15px;
}

.error {
    background: #f8d7da;
    color: #721c24;
    border-radius: 6px;
}

.loading {
    color: var(--color-accent);
}

@media (max-width: 768px) {
    .panes-container {
        flex-direction: column;
    }

    .viewer-left-pane {
        width: 100%;
        max-width: 100%;
        height: 40%;
        border-bottom: 2px solid #dee2e6;
    }

    .resize-handle {
        display: none;
    }
}

.privacy-badge {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 4px 12px;
    font-size: 0.8em;
    border-radius: 12px;
    border: 1px solid #bbd4bc;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    margin: 0 15px;
}

.privacy-badge strong {
    font-weight: 600;
}

@media (max-width: 900px) {
    .privacy-badge span.detail {
        display: none;
    }
}

.group-context-name {
    font-family: var(--font-mono);
    font-weight: 700;
    /* Bold */
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 0 1 auto;
    max-width: 50%;
    font-size: 0.9em;
    /* Standardized size */
    padding-left: 2px;
    /* Fix clipped first char */
}


/* Consolidated Utility Classes */
.aws-link {
    padding: 6px 12px;
    background: var(--color-bg-light);
    color: var(--color-charcoal);
    border: 1px solid var(--color-border-soft);
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
}

.aws-link:hover {
    background: var(--color-bg-hover);
}

.empty-state-container {
    text-align: center;
    color: var(--color-text-muted);
    margin-top: 50px;
}

.state-icon-lg {
    font-size: 3em;
    margin-bottom: 15px;
    opacity: 0.3;
}

.state-icon-svg {
    opacity: 0.3;
    margin: 0 auto 15px auto;
    /* Centered with bottom margin */
    width: 64px;
    height: 64px;
    fill: currentColor;
}

.state-header {
    font-weight: 400;
    margin: 0;
}

.modal-header-error {
    color: #dc3545;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin: 0;
}

.modal-header-warning {
    color: #856404;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    margin-top: 20px;
    margin-bottom: 0;
}

.modal-item-error {
    background: #f8d7da;
    border-left: 3px solid #dc3545;
    padding: 8px;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.modal-item-warning {
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    padding: 8px;
    margin-bottom: 5px;
    font-size: 0.9em;
}