/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    height: 100vh;
    overflow: hidden;
}

/* File input section */
.file-input-container {
    background: white;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    padding-top: 15vh;
}

.file-input-layout {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.file-input-box {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 900px;
    min-width: 400px;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    box-sizing: border-box;
}

.file-input-box:hover,
.file-input-box.dragover {
    border-color: #3b82f6;
    background: #f0f9ff;
}

.file-input-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.file-input-content i {
    font-size: 3rem;
    color: #64748b;
}

.file-input-content p {
    color: #64748b;
    font-size: 1.2rem;
    max-width: 400px;
    line-height: 1.5;
}

/* Example files bar */
.test-files-column {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 0.5rem;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.test-files-column h2 {
    font-size: 1rem;
}

.example-files {
    display: flex;
    gap: 1rem;
}

.example-file {
    padding: 0.5rem 1rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.example-file:hover {
    background: #e2e8f0;
    border-color: #cbd5e0;
}

/* Results layout */
#results {
    padding: 1rem;
    height: 95vh;
    display: grid;
    grid-template-areas: "results";
}

.container {
    margin: 0 auto;
    padding: 0 2rem;
    box-sizing: border-box;
}

.results {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: 250px 1fr;
    grid-template-areas:
        "results-header results-header"
        "section-list section-details";
    min-height: 0;
    gap: 1rem;
}

.results-header {
    grid-area: results-header;
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

h1 {
    color: #2c3e50;
    font-size: 2rem;
}

/* Section list */
.section-list-container {
    grid-area: section-list;
    overflow-y: auto;
    min-height: 0;
}

.section-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.section-button {
    width: 100%;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    background: white;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: all 0.2s ease;
}

.section-button:hover {
    border-color: #cbd5e0;
    background: #f8fafc;
}

.section-button[aria-pressed="true"] {
    background: #f0f9ff;
    border-color: #93c5fd;
}

.section-name {
    font-weight: 500;
    color: #1a202c;
    font-size: 1.1rem;
}

.section-size {
    color: #64748b;
    font-family: monospace;
    font-size: 0.9rem;
}

/* Section details */
.section-details {
    grid-area: section-details;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* Section overview landing screen */
.section-overview {
    padding: 2rem;
    height: 100%;
    overflow-y: auto;
}

.overview-header {
    margin-bottom: 2rem;
    text-align: center;
}

.overview-header h2 {
    color: #2c3e50;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.overview-header p {
    color: #64748b;
    font-size: 1rem;
}

.sections-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.section-overview-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.section-overview-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.section-overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-overview-header h3 {
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.section-overview-size {
    color: #64748b;
    font-family: monospace;
    font-size: 0.9rem;
    background: #e2e8f0;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.section-overview-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.section-description {
    color: #4a5568;
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
}

.section-details {
    color: #64748b;
    font-size: 0.85rem;
}

.section-detail-info {
    color: #3b82f6;
    font-weight: 500;
    font-style: normal;
}

.section-detail-error {
    color: #ef4444;
    font-style: normal;
}

.loading-info {
    color: #9ca3af;
}

.section-container {
    display: grid;
    overflow: hidden;
    min-height: 0;
    height: 100%;
    grid-template-rows: auto 1fr;
}

.section-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
    margin-bottom: 1rem;
}

/* Grid layouts for different sections */
.data-segments-container,
.code-section-grid {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) 2fr;
    grid-template-rows: 1fr;
    gap: 1rem;
    min-height: 0;
    overflow: hidden;
}

.function-section-grid,
.function-names-container {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    gap: 1rem;
    min-height: 0;
    overflow: hidden;
}

/* Scrollable content components */
.scrollable-content-container {
    display: grid;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-height: 0;
    grid-template-rows: auto 1fr;
}

.scrollable-content-header {
    padding: 0.5rem;
    border-bottom: 1px solid #ccc;
    background-color: #f5f5f5;
    font-weight: bold;
}

.scrollable-content-body {
    overflow: auto;
    min-height: 0;
}

/* List items */
.segment-item,
.function-item {
    padding: 0.5rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.segment-item:hover,
.function-item:hover {
    background-color: #f8fafc;
}

.segment-item.selected,
.function-item.selected {
    background-color: #f0f9ff;
}

.segment-header {
    display: flex;
    justify-content: space-between;
    font-family: monospace;
    font-size: 0.9em;
}

/* Graph controls */
.graph-header {
    display: flex;
}

.graph-controls {
    display: flex;
    align-items: center;
    margin-left: auto;
    gap: 0.5rem;
}

.graph-controls label {
    display: flex;
    align-items: center;
    gap: 0.3em;
}

.zoom-controls {
    display: flex;
    gap: 0.5rem;
}

.zoom-controls button {
    padding: 0.25rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

.zoom-controls button:hover {
    background: #f0f0f0;
}

/* Hex view and monospace content */
.hex-content {
    padding: 0.5rem;
    font-family: monospace;
    white-space: pre;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

th, td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f5f5f5;
    font-weight: 600;
}

tr:hover {
    background: #f9f9f9;
}

/* Utility classes */
.truncation-message {
    color: #666;
    font-style: italic;
    margin-top: 0.5rem;
    text-align: right;
    font-size: 0.9em;
}

.segment-type {
    color: #4a5568;
    font-size: 0.9em;
    background: #edf2f7;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.loading {
    padding: 1rem;
    text-align: center;
    color: #666;
}

/* Treemap visualization */
.treemap-container {
    margin-bottom: 2rem;
    padding: 0.5rem;
}

.treemap-title {
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    text-align: center;
}

.treemap-svg {
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}

.treemap-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.4;
    pointer-events: none;
    z-index: 1000;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
}

.treemap-tooltip strong {
    font-weight: 600;
    font-size: 0.9rem;
}

.treemap-tooltip em {
    font-style: italic;
    opacity: 0.9;
}

/* Responsive design */
@media (max-width: 900px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .data-segments-container,
    .code-section-grid {
        grid-template-columns: 1fr;
    }
    
    .treemap-container {
        padding: 1rem;
    }
    
    .treemap-svg {
        height: 300px;
    }
}