* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    margin: 0;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    margin-top: 10px;
    font-size: 1.1em;
    opacity: 0.9;
}

.warning {
    background: #ff9800;
    color: #fff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.loading {
    text-align: center;
    color: white;
    padding: 40px;
}

.spinner {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

#main {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.column {
    display: flex;
    flex-direction: column;
}

.column > :not(:first-child) {
    margin-top: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-info {
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

.picker-input-row, .input-row, .right-align-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.picker-input-row > :not(:first-child), .input-row > :not(:first-child) {
    margin-left: 8px;
}

.expand {
    flex: 1;
}

.hidden {
    display: none !important;
}

.right-align-row {
    justify-content: flex-end;
}

.space-below {
    margin-bottom: 15px;
}

fieldset {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin: 0;
}

legend {
    font-weight: bold;
    padding: 0 10px;
    color: #667eea;
}

input[type="text"], input[type="number"], select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

input[type="text"]:focus, input[type="number"]:focus, select:focus {
    outline: none;
    border-color: #667eea;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s, transform 0.1s;
}

button:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-1px);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

#split-button {
    background: #4caf50;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
}

#split-button:hover:not(:disabled) {
    background: #45a049;
}

#lod-list {
    display: grid;
    grid-template-columns: 49px 49px 49px auto auto auto auto auto auto;
    gap: 8px;
    align-items: center;
}

.lod-list-header {
    font-weight: bold;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
}

.lod-list-header:first-child {
    grid-column-start: 4;
}

#lod-list input[type="text"] {
    width: 100%;
}

#lod-list button {
    padding: 6px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-button {
    width: 20px;
    height: 20px;
    cursor: pointer;
    padding: 0;
    background: transparent;
    border: none;
}

.icon-button:hover {
    opacity: 0.7;
}

.icon-button.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#toolbar-view {
    border-top: 2px solid #e0e0e0;
    margin-top: 20px;
    padding-top: 20px;
}

#text-output {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 15px;
    border-radius: 6px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    margin-top: 15px;
}

#text-output pre {
    margin: 4px 0;
    padding: 4px 0;
}

.msg-timestamp {
    font-weight: bold;
    color: #858585;
}

.msg-timestamp::before {
    content: "[";
}

.msg-timestamp::after {
    content: "] ";
}

.msg-debug {
    color: #858585;
}

.msg-info {
    color: #d4d4d4;
}

.msg-warn {
    color: #ffa500;
}

.msg-error {
    color: #f48771;
}

#progress-container {
    margin-top: 15px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

#progress-text {
    text-align: center;
    margin-top: 8px;
    color: #666;
    font-size: 14px;
}

.error {
    color: #f44336;
    font-weight: bold;
}

#lod-list-help {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

@media (max-width: 768px) {
    #app {
        padding: 10px;
    }

    header h1 {
        font-size: 2em;
    }

    #lod-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .lod-list-header {
        display: none;
    }

    .picker-input-row, .input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .picker-input-row > :not(:first-child), .input-row > :not(:first-child) {
        margin-left: 0;
        margin-top: 8px;
    }
}
