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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: #333;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 300;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.upload-section {
    margin-bottom: 40px;
}

.upload-area {
    background: white;
    border: 3px dashed #667eea;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.upload-area.dragover {
    border-color: #764ba2;
    background: #f0f4ff;
    transform: scale(1.02);
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: #667eea;
    margin-bottom: 20px;
}

.upload-area h3 {
    margin-bottom: 10px;
    color: #333;
    font-weight: 500;
}

.upload-area p {
    color: #666;
    font-size: 0.9rem;
}

#fileInput {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.crd-explorer-container {
    margin-top: 20px;
}

.search-section {
    padding: 20px;
    border-bottom: 1px solid #e0e4e7;
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
}

.tabs-container {
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.search-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 10px 16px;
    border: 2px solid #e0e4e7;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

.search-filter {
    padding: 10px 12px;
    border: 2px solid #e0e4e7;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.search-filter:focus {
    outline: none;
    border-color: #667eea;
}

.clear-search {
    padding: 10px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.clear-search:hover {
    background: #5a67d8;
}

.clear-search:disabled {
    background: #a0aec0;
    cursor: not-allowed;
}

.collapse-button {
    padding: 10px 16px;
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-left: 8px;
}

.collapse-button:hover {
    background: #38a169;
}

.collapse-button:disabled {
    background: #a0aec0;
    cursor: not-allowed;
}

.toggle-upload-button {
    padding: 10px 16px;
    background: #ed8936;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-right: 12px;
}

.toggle-upload-button:hover {
    background: #dd6b20;
}

.toggle-upload-button:disabled {
    background: #a0aec0;
    cursor: not-allowed;
}

.upload-wrapper {
    transition: all 0.3s ease;
    overflow: hidden;
}

.upload-wrapper.hidden {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}

.search-highlight {
    background-color: #fef3cd;
    color: #856404;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.tree-node.search-hidden {
    display: none;
}

.tree-node.search-match {
    background: rgba(102, 126, 234, 0.04);
    border-left: 4px solid #667eea;
    border-radius: 4px;
    margin: 3px 0;
    padding: 4px 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
    transition: all 0.2s ease;
}

.tree-node.search-match:hover {
    background: rgba(102, 126, 234, 0.06);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}

.tree-node.search-match .property-header {
    font-weight: 500;
}

.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    overflow-x: auto;
}

.tab {
    padding: 15px 25px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab:hover {
    background: #e9ecef;
}

.tab.active {
    background: white;
    border-bottom-color: #667eea;
    color: #667eea;
    font-weight: 500;
}

.tab-content {
    padding: 30px;
    min-height: 400px;
}

.crd-info {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.crd-title {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #333;
}

.crd-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

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

.meta-label {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.meta-value {
    font-weight: 500;
    color: #333;
}

.schema-tree {
    margin-top: 20px;
}

.tree-node {
    margin-left: 20px;
    border-left: 2px solid #e9ecef;
    padding-left: 15px;
    margin-bottom: 10px;
}

.tree-node:last-child {
    border-left-color: transparent;
}

.property-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 10px;
    justify-content: space-between;
}

.property-header .property-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0; /* Don't shrink the left side */
    min-width: 0; /* Allow text truncation */
}

.property-header .property-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1; /* Allow the right side to take remaining space */
    justify-content: flex-end; /* Align path to the right */
    min-width: 0; /* Allow truncation if needed */
}

.property-header:hover {
    background: #e9ecef;
}

.expand-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.expand-icon.expanded {
    transform: rotate(90deg);
}

.property-name {
    font-weight: 600;
    color: #333;
}

.property-path {
    background: #e9ecef;
    color: #495057;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-weight: 400;
    border: 1px solid #ced4da;
    flex-shrink: 0;
}

.property-type {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.property-required {
    background: #dc3545;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
}

.property-description {
    color: #666;
    font-size: 0.9rem;
    margin-top: 8px;
    line-height: 1.5;
    padding: 10px 15px;
    background: white;
    border-radius: 4px;
    border-left: 3px solid #667eea;
}

.property-children {
    margin-top: 10px;
    display: none;
}

.property-children.expanded {
    display: block;
}

.property-details {
    margin-top: 10px;
    padding: 10px 15px;
    background: #f8f9ff;
    border-radius: 4px;
    font-size: 0.85rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.detail-label {
    color: #666;
    font-weight: 500;
}

.detail-value {
    color: #333;
    font-family: 'Courier New', monospace;
}

.error-message {
    background: #fee;
    color: #c53030;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #c53030;
    margin-top: 20px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.copyright-notice {
    position: fixed;
    bottom: 20px;
    right: 54px;
    background: rgba(255, 255, 255, 0.8);
    padding: 6px 12px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 100;
    display: flex;
    align-items: center;
    height: 24px;
    box-sizing: border-box;
}

.copyright-notice a {
    font-size: 12px;
    color: #666;
    text-decoration: none;
    transition: color 0.2s ease;
    line-height: 1;
}

.copyright-notice a:hover {
    color: #333;
}

.licenses-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.licenses-link:hover {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    transform: scale(1.1);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80%;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-weight: 500;
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 25px;
    max-height: 400px;
    overflow-y: auto;
}

.library-item {
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.library-item:last-child {
    margin-bottom: 0;
}

.library-item h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.2rem;
}

.library-item p {
    margin: 5px 0;
    color: #555;
    line-height: 1.4;
}

.library-item a {
    color: #667eea;
    text-decoration: none;
    word-break: break-all;
}

.library-item a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    .upload-area {
        padding: 40px 20px;
    }

    .tab-content {
        padding: 20px;
    }

    .crd-meta {
        grid-template-columns: 1fr;
    }

    .copyright-notice {
        bottom: 15px;
        right: 45px;
        padding: 4px 8px;
        height: 20px;
    }

    .copyright-notice a {
        font-size: 10px;
    }

    .licenses-link {
        bottom: 15px;
        right: 15px;
        width: 20px;
        height: 20px;
        font-size: 12px;
    }

    .modal-content {
        width: 95%;
    }

    .modal-header {
        padding: 15px 20px;
    }

    .modal-body {
        padding: 20px;
    }
}