:root {
    --primary-color: #4a5568;
    --secondary-color: #718096;
    --background-color: #f7fafc;
    --text-color: #2d3748;
    --border-color: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg fill='%23e2e8f0' height='800px' width='800px' version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 612.004 612.004' xml:space='preserve'%3E%3Cg transform='translate(306.002,306.002) rotate(210) scale(-.5) translate(-306.002,-306.002)'%3E%3Cg%3E%3Cpath d='M401.07,221.869c-61.167,0-110.933,49.766-110.933,110.933s49.766,110.933,110.933,110.933 s110.933-49.766,110.933-110.933S462.237,221.869,401.07,221.869z M401.07,426.669c-51.755,0-93.867-42.112-93.867-93.867 c0-51.755,42.112-93.867,93.867-93.867c51.755,0,93.867,42.112,93.867,93.867C494.937,384.557,452.825,426.669,401.07,426.669z'/%3E%3C/g%3E%3Cg%3E%3Ccircle cx='401.07' cy='332.802' r='51.2'/%3E%3C/g%3E%3Cg%3E%3Ccircle cx='93.87' cy='349.868' r='34.133'/%3E%3C/g%3E%3Cg%3E%3Cpath d='M507.473,196.268c-3.405-9.446-8.294-18.176-16.367-24.141c-8.482-6.281-18.961-9.992-30.302-9.992h-28.757 c-2.031,0-3.789-1.434-4.181-3.43l-6.827-34.133c-0.538-2.637,1.485-5.103,4.181-5.103h1.451c4.71,0,8.533-3.823,8.533-8.533 V76.802c0-4.71-3.823-8.533-8.533-8.533h-179.2c-23.646,0-42.871,19.345-42.667,43.042c0.043,4.557,3.977,8.158,8.533,8.158 h16.213l-7.322,76.868c-0.128,0-0.23-0.068-0.358-0.068h-93.867c-16.828,0-31.531,8.747-42.138,21.461 c-5.538,6.639-9.515,14.447-12.254,22.639c-2.671,7.97-4.864,16.222-5.094,19.2c-40.457,11.392-69.965,49.169-68.463,93.542 c1.596,46.933,39.236,86.519,86.05,90.308c49.323,3.985,91.494-30.421,100.002-76.484h80.828c2.543,0,4.949-1.135,6.571-3.089 c1.621-1.954,2.287-4.531,1.809-7.031c-1.493-7.868-2.244-15.949-2.244-24.013c0-70.579,57.421-128,128-128 c36.702,0,71.689,15.795,96,43.332c2.338,2.654,6.101,3.567,9.412,2.33c3.32-1.246,5.513-4.429,5.521-7.979v-29.15 C512.004,210.425,507.473,196.268,507.473,196.268z M169.587,362.882c-5.239,31.795-30.882,57.446-62.677,62.703 c-52.48,8.687-97.434-36.25-88.764-88.73c5.248-31.795,30.891-57.446,62.677-62.703 C133.303,265.465,178.256,310.402,169.587,362.882z M410.781,188.119c-3.217-0.239-6.451-0.384-9.711-0.384 c-61.005,0-113.186,37.922-134.588,91.375c-0.64,1.604-2.142,2.662-3.866,2.645c-5.888-0.043-19.516-0.102-26.718-0.137 c-2.509-0.009-4.446-2.176-4.207-4.668l14.635-153.617c0.213-2.193,2.048-3.866,4.25-3.866h148.531 c2.031,0,3.789,1.434,4.181,3.43l12.032,60.169C415.876,185.858,413.614,188.333,410.781,188.119z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-size: 200px 200px;
    background-repeat: repeat;
    opacity: 0.2;
    animation: panBackground 180s linear infinite;
    z-index: -1;
}

@keyframes panBackground {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(-50%, -50%);
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

h1 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.file-upload {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.file-upload button:hover {
    background: var(--secondary-color);
}

.editor-container {
    display: none;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.editor-container.visible {
    display: grid;
}

.no-file-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-color);
    font-style: italic;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-top: 2rem;
}

.xml-tree {
    padding: 1rem;
    background: var(--background-color);
    border-radius: 0.5rem;
    overflow-y: auto;
    max-height: 80vh;
    padding-left: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.tag-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.tag-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.tag-item.clicked {
    background-color: #bee3f8;
    color: #2b6cb0;
    font-weight: 500;
}

.tag-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.tag-item.empty-tag {
    font-weight: bold;
    color: var(--secondary-color);
    cursor: default;
    opacity: 0.7;
}

.tag-item.empty-tag:hover {
    background-color: transparent;
}

.tag-item.empty-tag .toggle-children {
    cursor: pointer;
}

.tag-item.empty-tag .toggle-children:hover {
    color: var(--primary-color);
}

.toggle-children {
    width: 20px;
    text-align: center;
    cursor: pointer;
    color: var(--secondary-color);
}

.toggle-children:hover {
    color: var(--primary-color);
}

.tag-editor {
    padding: 1rem;
    background: var(--background-color);
    border-radius: 0.5rem;
    overflow-y: auto;
    max-height: 80vh;
}

.tag-section {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

.tag-section.clicked {
    border-left: 4px solid #4299e1;
    background-color: #ebf8ff;
}

.tag-section.checked {
    border-left: 4px solid #718096;
    background-color: #f7fafc;
}

.attributes-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.attribute-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.attribute-item label {
    min-width: 100px;
    color: var(--secondary-color);
}

.attribute-item input {
    flex: 1;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
}

.text-content-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.text-content-item label {
    min-width: 100px;
    color: var(--secondary-color);
}

.text-content-item input {
    flex: 1;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
}

.no-edit-message {
    color: var(--secondary-color);
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

@media (max-width: 768px) {
    .editor-container {
        grid-template-columns: 1fr;
    }
    
    .xml-tree {
        max-height: 40vh;
    }
    
    .tag-editor {
        max-height: 40vh;
    }
}

.toggle-btn {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin-left: 0.5rem;
    position: relative;
}

.toggle-btn::before,
.toggle-btn::after {
    content: '';
    position: absolute;
    background-color: var(--secondary-color);
    transition: all 0.2s ease;
}

.toggle-btn::before {
    width: 2px;
    height: 12px;
    left: 9px;
    top: 4px;
}

.toggle-btn::after {
    width: 12px;
    height: 2px;
    left: 4px;
    top: 9px;
}

.toggle-btn:hover::before,
.toggle-btn:hover::after {
    background-color: var(--primary-color);
}

.toggle-btn.active::before {
    transform: rotate(90deg);
    opacity: 0;
}

.toggle-btn.active::after {
    transform: rotate(90deg);
}

.xml-tree-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-container {
    position: relative;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--background-color);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    fill: var(--text-color);
    opacity: 0.5;
}

#treeSearch {
    width: 100%;
    padding: 0.5rem 0.5rem 0.5rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--background-color);
    color: var(--text-color);
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

#treeSearch:focus {
    outline: none;
    border-color: var(--primary-color);
}

#treeSearch:focus + .search-icon {
    opacity: 1;
}

.tag-item.hidden {
    display: none;
}

/* Modern scrollbar styles */
.xml-tree::-webkit-scrollbar,
.tag-editor::-webkit-scrollbar,
.attributes-container::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.xml-tree::-webkit-scrollbar-track,
.tag-editor::-webkit-scrollbar-track,
.attributes-container::-webkit-scrollbar-track {
    background: var(--background-color);
    border-radius: 20px;
}

.xml-tree::-webkit-scrollbar-thumb,
.tag-editor::-webkit-scrollbar-thumb,
.attributes-container::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 20px;
    border: 3px solid var(--background-color);
    transition: background-color 0.2s ease;
}

.xml-tree::-webkit-scrollbar-thumb:hover,
.tag-editor::-webkit-scrollbar-thumb:hover,
.attributes-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Firefox scrollbar styles */
.xml-tree,
.tag-editor,
.attributes-container {
    scrollbar-width: thin;
    scrollbar-color: var(--secondary-color) var(--background-color);
}
