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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 15px;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

.header-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    margin-bottom: 10px;
}

#header-label-preview {
    transform: scale(2);
    margin: 20px;
}

main {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tab-container {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    margin-bottom: 0;
}

.tab-buttons {
    display: flex;
    background: transparent;
    border-bottom: none;
    margin-bottom: -1px;
    position: relative;
    z-index: 1;
}

.tab-button {
    flex: 1;
    background: #f8f9fa;
    color: #666;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 8px 8px 0 0;
    margin-right: 2px;
    position: relative;
    margin-bottom: 0;
    box-shadow: none;
    transform: none;
}

.tab-button:last-child {
    margin-right: 0;
}

.tab-button:hover {
    background: #e9ecef;
    color: #2c3e50;
    box-shadow: none;
    transform: none;
}

.tab-button.active {
    background: white;
    color: #2c3e50;
    border-color: #e0e0e0;
    border-bottom: 1px solid white;
    z-index: 2;
    font-weight: 600;
    box-shadow: none;
    transform: none;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: -1px;
    right: -1px;
    height: 1px;
    background: white;
    z-index: 1;
}

.tab-content {
    display: block;
    padding: 20px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
    position: relative;
    z-index: 0;
}

#batch-tab {
    display: block;
    padding: 20px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
    position: relative;
    z-index: 0;
}

.controls {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}


.label-settings {
    margin-top: 0;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.label-dimensions {
    margin-bottom: 20px;
}

.dimension-row {
    display: flex;
    gap: 15px;
    align-items: end;
}

.dimension-item {
    flex: 1;
    min-width: 0;
}

.dimension-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.dimension-item select,
.dimension-item input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.3s;
    background: white;
}

.dimension-item select:focus,
.dimension-item input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.label-settings h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.2em;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.button-group button {
    flex: 1;
    margin: 0;
}

.batch-controls {
    max-width: 800px;
    margin: 0 auto;
}

.help-section {
    margin-bottom: 30px;
}

.help-section details {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    border: 1px solid #e9ecef;
}

.help-section summary {
    cursor: pointer;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

.help-content {
    margin-top: 15px;
}

.llm-prompt {
    width: 100%;
    min-height: 200px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 15px;
    resize: vertical;
    line-height: 1.4;
}

.copy-button {
    background-color: #17a2b8;
    margin-top: 10px;
}

.copy-button:hover {
    background-color: #138496;
}

#yaml-input {
    width: 100%;
    min-height: 300px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    padding: 15px;
    resize: vertical;
    line-height: 1.4;
}

#yaml-input:focus {
    outline: none;
    border-color: #3498db;
}

/* Show fallback textarea if CodeMirror fails to load */
.codemirror-loaded #yaml-input {
    display: none;
}

.batch-options {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #2c3e50;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.batch-buttons {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.batch-buttons button {
    flex: 1;
}

.validation-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 4px;
    display: none;
}

.validation-result.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.validation-result.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.validation-result.warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.control-group input,
.control-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.3s;
    background: white;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    margin-right: 10px;
    margin-bottom: 10px;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
}

button:hover {
    background-color: #2980b9;
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
    transform: translateY(-1px);
}

#download-png {
    background-color: #27ae60;
    box-shadow: 0 2px 4px rgba(39, 174, 96, 0.2);
}

#download-png:hover {
    background-color: #219a52;
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}


.label {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #ddd;
    border-radius: 2px;
    padding: 2px;
    height: 12mm;
    width: 40mm;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transform: scale(2);
    margin: 30px;
}

.label-icon {
    width: 8mm;
    height: 8mm;
    margin: 2mm;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.label-icon .icon {
    width: 100%;
    height: 100%;
    fill: #333;
}

.label-text {
    flex: 1;
    padding: 1mm;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.main-text {
    font-size: 12px;
    font-weight: bold;
    color: #000;
    line-height: 1.2;
    margin-bottom: 1px;
    display: flex;
    gap: 2px;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
}

.sub-text {
    font-size: 8px;
    color: #666;
    line-height: 1.2;
    display: flex;
    gap: 2px;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
}

.label[data-height="9"] {
    height: 9mm;
}

.label[data-height="12"] {
    height: 12mm;
}

.label[data-height="18"] {
    height: 18mm;
}

.label[data-height="24"] {
    height: 24mm;
}

.label[data-height="9"] .label-icon {
    width: 6mm;
    height: 6mm;
}

.label[data-height="9"] .main-text {
    font-size: 6px;
}

.label[data-height="9"] .sub-text {
    font-size: 4px;
}

.label[data-height="18"] .label-icon {
    width: 14mm;
    height: 14mm;
}

.label[data-height="18"] .main-text {
    font-size: 12px;
}

.label[data-height="18"] .sub-text {
    font-size: 8px;
}

.label[data-height="24"] .label-icon {
    width: 18mm;
    height: 18mm;
}

.label[data-height="24"] .main-text {
    font-size: 14px;
}

.label[data-height="24"] .sub-text {
    font-size: 10px;
}

@media (max-width: 768px) {
    .tab-content {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    
    .container {
        padding: 10px;
    }
    
    .tab-buttons {
        flex-direction: row;
    }
    
    .tab-button {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .preview-container {
        padding: 20px;
        min-height: 150px;
    }
    
    .label-settings {
        padding: 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .button-group button {
        margin-right: 0;
        margin-bottom: 10px;
    }
}

/* CodeMirror YAML Editor Styling */
.CodeMirror {
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-family: 'Fira Code', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.4;
    background: white;
    transition: border-color 0.3s;
}

.CodeMirror-focused {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.CodeMirror-gutters {
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
}

.CodeMirror-linenumber {
    color: #6c757d;
    font-size: 12px;
}

.CodeMirror-cursor {
    border-left: 2px solid #3498db;
}

/* YAML Syntax Highlighting */
.cm-comment {
    color: #6c757d;
    font-style: italic;
}

.cm-string {
    color: #28a745;
}

.cm-number {
    color: #dc3545;
}

.cm-keyword {
    color: #6f42c1;
    font-weight: bold;
}

.cm-atom {
    color: #fd7e14;
}

.cm-def {
    color: #007bff;
    font-weight: bold;
}

.cm-variable {
    color: #495057;
}

.cm-punctuation {
    color: #6c757d;
}

/* Hide original textarea when CodeMirror is active */
#yaml-input {
    display: none;
}

/* Icon Picker Styles */
.icon-picker {
    position: relative;
}

.icon-picker-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.icon-picker-selected:hover {
    border-color: #3498db;
}

.icon-picker-selected.active {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.selected-icon {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.selected-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.selected-icon span {
    font-size: 14px;
    color: #495057;
}

.icon-picker-button {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s;
}

.icon-picker-button:hover {
    background: #e9ecef;
    color: #495057;
}

.icon-picker-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #3498db;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 400px;
    overflow: hidden;
    margin-top: 4px;
}

.icon-picker-search {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
}

.icon-picker-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    margin: 0;
}

.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    padding: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.icon-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8f9fa;
    text-align: center;
}

.icon-picker-item:hover {
    background: #e9ecef;
    border-color: #3498db;
}

.icon-picker-item.selected {
    background: #e3f2fd;
    border-color: #3498db;
}

.icon-picker-item img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    margin-bottom: 4px;
}

.icon-picker-item span {
    font-size: 11px;
    color: #495057;
    line-height: 1.2;
    word-break: break-word;
}

.icon-picker-category {
    grid-column: 1 / -1;
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    margin-top: 8px;
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e9ecef;
}

.icon-picker-category:first-child {
    margin-top: 0;
}

/* Icon Upload Section */
.icon-upload-section {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    text-align: center;
}

.upload-icon-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.3s;
    margin-bottom: 8px;
}

.upload-icon-btn:hover {
    background: #218838;
}

.upload-instructions {
    color: #6c757d;
    font-size: 11px;
    line-height: 1.3;
}

.upload-instructions a {
    color: #007bff;
    text-decoration: none;
}

.upload-instructions a:hover {
    text-decoration: underline;
}

.custom-icon-category {
    background: #e8f5e8;
    border: 1px solid #28a745;
    border-radius: 4px;
    padding: 4px 8px;
    color: #155724;
    font-weight: bold;
}

.delete-icon-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.icon-picker-item {
    position: relative;
}

.icon-picker-item:hover .delete-icon-btn {
    display: flex;
}

.delete-icon-btn:hover {
    background: #c82333;
}

/* Footer Styles */
footer {
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.attribution {
    text-align: center;
    font-size: 12px;
    color: #666;
}

.attribution a {
    color: #3498db;
    text-decoration: none;
}

.attribution a:hover {
    text-decoration: underline;
}

/* Label with Controls Styles */
.label-with-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.inline-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Tooltip Icon Styles */
.tooltip-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background: #6c757d;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    line-height: 16px;
    cursor: help;
    margin-left: 6px;
    transition: background-color 0.3s;
}

.tooltip-icon:hover {
    background: #495057;
}

.small-column-btn, .small-sub-column-btn {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    font-size: 14px;
    font-weight: bold;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: none;
    transform: none;
}

.small-column-btn:hover, .small-sub-column-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    box-shadow: none;
    transform: none;
}

.small-column-btn:active, .small-sub-column-btn:active {
    background: #3498db;
    border-color: #3498db;
    color: white;
    box-shadow: none;
    transform: none;
}

.main-text-inputs {
    display: flex;
    gap: 8px;
}

.main-text-input,
.sub-text-input {
    flex: 1;
    min-width: 0;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: white;
    transition: border-color 0.3s;
}

.main-text-input:focus,
.sub-text-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.sub-text-inputs {
    display: flex;
    gap: 8px;
}

/* Old sub-column-btn styles removed - now using .small-sub-column-btn above */

.main-text-column {
    flex: 1;
    text-align: left;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    line-height: inherit;
    padding-right: 4px;
}

.sub-text-column {
    flex: 1;
    text-align: left;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    line-height: inherit;
    padding-right: 4px;
}

/* Column count displays removed */
