/* Base Styles */

/* Stroke styling for text - ensures stroke is rendered correctly */
.text-stroke {
    paint-order: stroke fill !important; 
    -webkit-paint-order: stroke fill !important;
}
:root {
    --primary-color: #3B7EA1;
    --secondary-color: #4a5568;
    --light-gray: #e2e8f0;
    --mid-gray: #a0aec0;
    --dark-gray: #4a5568;
    --white: #ffffff;
    --border-radius: 4px;
    --box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

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

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--dark-gray);
    background-color: #f7fafc;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    min-width: 1100px; /* Prevent container from getting too small */
}

header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--light-gray);
    padding-bottom: 20px;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 5px;
}

.subtitle {
    color: var(--secondary-color);
    font-style: italic;
}

main {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
    justify-content: space-between;
    flex-wrap: nowrap; /* Prevent wrapping */
    align-items: flex-start; /* Align items at the top */
}

.panel {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
}

/* Input panel (left side) */
.input-panel {
    width: 35%;
    flex-shrink: 0; /* Prevent shrinking */
    min-width: 35%; /* Enforce minimum width */
    max-width: 35%; /* Enforce maximum width */
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

/* Right side preview panel */
.preview-panel {
    width: 65%;
    height: calc(100vh - 200px);
    overflow-y: auto;
    flex-shrink: 0; /* Prevent shrinking */
    min-width: 65%; /* Enforce minimum width */
    max-width: 65%; /* Enforce maximum width */
    flex-grow: 1; /* Allow growth */
    display: block; /* Ensure it's displayed as a block */
}

/* Removing the fixed class as we're using sticky positioning instead */
/*.preview-panel.fixed {
    position: fixed;
    top: 20px;
    width: calc(100% - 440px);
    max-width: 800px;
}*/

h2 {
    font-size: 1.25rem;
    margin-bottom: 15px;
    color: var(--primary-color);
    border-bottom: 1px solid var(--light-gray);
    padding-bottom: 10px;
}

h3 {
    font-size: 1rem;
    margin: 15px 0 10px;
    color: var(--secondary-color);
}

h4 {
    font-size: 0.95rem;
    margin: 10px 0 8px;
    color: var(--secondary-color);
}

.section {
    margin-bottom: 20px;
}

.export-buttons {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* File inputs */
.file-input {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.file-input input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.file-input label {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: inline-block;
    margin-right: 10px;
}

.file-input label:hover {
    background-color: #2c6584;
}

.file-input span {
    color: var(--mid-gray);
    font-size: 0.9rem;
}

/* Data Table */
.data-table-container {
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    background-color: #edf2f7;
    padding: 8px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--light-gray);
}

.data-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--light-gray);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:nth-child(even) {
    background-color: #f8fafc;
}

/* Encoding configurations */
.encoding-config {
    background-color: #f8fafc;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    overflow: hidden;
}

.encoding-header {
    background-color: #edf2f7;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.encoding-header label {
    font-weight: 600;
    margin-left: 8px;
}

.encoding-header::after {
    content: "▼";
    position: absolute;
    right: 15px;
    font-size: 12px;
}

.encoding-header.collapsed {
    border-bottom: 1px solid var(--light-gray);
}

.encoding-header.collapsed::after {
    content: "▶";
    position: absolute;
    right: 15px;
    font-size: 12px;
}

.encoding-settings {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.setting label {
    width: 120px;
    font-size: 0.9rem;
}

.setting select,
.setting input[type="number"] {
    flex: 1;
    padding: 6px;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    min-width: 0;
}

.setting input[type="checkbox"] {
    margin-right: 5px;
}

.hidden {
    display: none;
}

/* Buttons */
.actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 10px 15px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
}

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

.btn.primary:hover {
    background-color: #2c6584;
}

.btn.secondary {
    background-color: var(--light-gray);
    color: var(--dark-gray);
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Preview area */
.preview-settings {
    margin-bottom: 15px;
    background-color: #f8fafc;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.preview-settings .mega-header {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    margin: 0;
    padding: 10px 15px;
}

.preview-settings .mega-content {
    padding: 10px 15px;
    border-top: 1px solid var(--light-gray);
}

.preview-container {
    min-height: 300px;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    padding: 20px;
    background-color: #f8fafc;
    overflow-y: auto;
}

.placeholder {
    color: var(--mid-gray);
    text-align: center;
    margin-top: 120px;
}

footer {
    text-align: center;
    font-size: 0.9rem;
    color: var(--mid-gray);
    border-top: 1px solid var(--light-gray);
    padding-top: 20px;
}

/* Mega Group Styles */
.mega-group {
    background-color: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    overflow: visible;
}

.mega-header {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 12px 15px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mega-header h3 {
    color: var(--white);
    margin: 0;
    font-size: 1.1rem;
}

.mega-header::after {
    content: "▼";
    font-size: 12px;
    margin-left: 10px;
    transition: transform 0.3s ease;
}

.mega-header.collapsed::after {
    content: "▶";
}

.mega-content {
    padding: 15px;
    border-top: 1px solid var(--light-gray);
    display: block;
    transition: max-height 0.3s ease;
    overflow: visible;
    /* Make sure no overflow issues interfere with layout */
    max-width: 100%;
}

.mega-content.collapsed {
    display: none;
    max-height: 0;
    overflow: hidden;
}