/* Custom CSS for Design Explorer - Version 2.0 */

/* Force browser to reload fonts by adding cache-busting */

/* Font imports */
@font-face {
    font-family: 'LXGW Bright GB';
    src: url('/assets/font/LXGWBrightGB-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'LXGW Bright GB';
    src: url('/assets/font/LXGWBrightGB-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'LXGW Bright GB';
    src: url('/assets/font/LXGWBrightGB-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'LXGW Bright GB';
    src: url('/assets/font/LXGWBrightGB-LightItalic.ttf') format('truetype');
    font-weight: 300;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'LXGW Bright GB';
    src: url('/assets/font/LXGWBrightGB-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'LXGW Bright GB';
    src: url('/assets/font/LXGWBrightGB-MediumItalic.ttf') format('truetype');
    font-weight: 500;
    font-style: italic;
    font-display: swap;
}

/* Global styles */
body {
    font-family: 'LXGW Bright GB', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    background-color: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
}

/* Debug: Add a border to all div elements to confirm CSS is loaded */
div {
    /* border: 1px solid red !important; */
}

/* Apply font to all text elements */
* {
    font-family: inherit !important;
}

/* Ensure specific elements use the font */
p, span, div, a, button, input, select, label, h1, h2, h3, h4, h5, h6, th, td {
    font-family: 'LXGW Bright GB', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

/* Logo and title */
.logo-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.logo-title > div {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 48px;
    width: auto;
}

.app-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.025em;
}

/* GitHub link */
.github-container {
    margin-top: 0.5rem;
    margin-left: 0;
}

.github-link {
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.github-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* Acknowledgment */
.acknowledge-container {
    margin-top: 0.25rem;
    margin-left: 0;
    font-size: 0.8rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.acknowledge-link {
    color: #3b82f6;
    text-decoration: none;
    transition: all 0.2s ease;
}

.acknowledge-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* Info box */
.info-box {
    background-color: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 100%;
    box-sizing: border-box;
}

.justify-text {
    margin: 0;
    color: #0c4a6e;
    font-size: 0.9rem;
    line-height: 1.8;
    white-space: pre-line;
    font-weight: 400;
}

/* Hello user */
.hello {
    background-color: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.hi-user {
    color: #92400e;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Radio items */
.radio-items {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 100%;
    box-sizing: border-box;
    text-align: left;
}

/* Form elements */
.form-label {
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.5rem;
    display: block;
}

/* Dropdowns */
.color-by-label, .sort-by-label {
    font-weight: 600;
    color: #334155;
    margin-right: 0.75rem;
    display: inline-flex;
    align-items: center;
    min-width: 80px;
    font-size: 0.9rem;
}

.color-by, .sort-by {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
    text-align: left;
    flex-wrap: wrap;
}

/* Ensure color scheme dropdown aligns properly */
#color-scheme-dropdown {
    margin: 0;
}

/* Adjust label margin for better spacing */
.color-by-label {
    margin-bottom: 0;
    white-space: nowrap;
}

/* Dropdown menus */
.dropdown-menu {
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.dropdown-toggle {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border-radius: 0.375rem;
    min-height: 38px;
    display: flex;
    align-items: center;
}

/* Buttons */
.btn {
    transition: all 0.2s ease;
    border-radius: 0.375rem;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.sort-by-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
}

/* Upload component */
#upload-data-component {
    border: none;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    background-color: #3b82f6;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    margin: 0;
    max-width: none;
    background-image: none;
    position: relative;
    overflow: hidden;
}

#upload-data-component:hover {
    background-color: #2563eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

#upload-data-component:active {
    transform: translateY(0);
}

#upload-data-component .drag-drop-text {
    text-align: center;
}

#upload-data-component a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

#upload-data-component a:hover {
    color: white;
    text-decoration: underline;
}

/* Make entire upload area clickable */
#upload-data-component input[type="file"] {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0 !important;
    cursor: pointer !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    pointer-events: auto !important;
}

#upload-data-component > span {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

/* Upload container */
.select-pollination-project {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    width: 100%;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
    justify-content: flex-start;
    text-align: left;
}

/* Upload tip container */
.upload-tip-container {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    width: 100%;
}

/* Upload tip */
.upload-tip {
    font-size: 0.8rem;
    color: #64748b;
    margin-left: 0;
    margin-top: 0;
    display: block;
    width: 100%;
    line-height: 1.5;
    padding: 0.5rem;
    background-color: #f8fafc;
    border-radius: 0.375rem;
    border-left: 3px solid #3b82f6;
}

.upload-tip a {
    color: #3b82f6;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.upload-tip a:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* Select sample */
.select-sample {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
    text-align: left;
}

/* Radio items */
.radio-items .form-check {
    margin-right: 1.5rem;
}

.radio-items .form-check-label {
    font-size: 0.9rem;
    color: #334155;
}

/* All form controls */
.form-control, .form-select, .btn, .dropdown-toggle {
    font-size: 0.9rem;
    border-radius: 0.375rem;
    min-height: 38px;
}

/* Label consistency */
.color-by-label, .sort-by-label, .form-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0;
}

/* Graph */
#parallel-coordinates {
    margin-bottom: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    background-color: #ffffff;
    padding: 1rem;
}

/* Images container */
.main-images-container {
    margin-bottom: 2rem;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 100%;
    box-sizing: border-box;
}

.images-container {
    display: flex;
    gap: 1.5rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    background-color: transparent;
    border: none;
}

/* Selected image container */
.selected-image-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 300px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background-color: #ffffff;
    box-sizing: border-box;
}

.selected-image-info {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
    font-size: 0.9rem;
    color: #475569;
}

.selected-image-wrapper {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.selected-image {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: 0.25rem;
}

/* Images grid */
.images-grid {
    flex: 2;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    overflow-y: auto;
    max-height: 600px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background-color: #ffffff;
    box-sizing: border-box;
}

.images-grid::-webkit-scrollbar {
    width: 8px;
}

.images-grid::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
    margin: 0.75rem 0;
}

.images-grid::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.images-grid::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Image grid items */
.image-grid {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 3px solid transparent;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.image-grid:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.image-grid.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* Table */
.dash-table-container {
    margin-top: 1.5rem;
    background-color: #ffffff;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.dash-table-container .dash-spreadsheet-container {
    border: none;
}

.dash-table-container .dash-spreadsheet {
    border: none;
}

.dash-table-container th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #334155;
    border-bottom: 2px solid #e2e8f0;
    padding: 0.75rem;
}

.dash-table-container td {
    padding: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.dash-table-container tr:hover {
    background-color: #f8fafc;
}

/* Loading spinner */
.custom-spinner {
    background-color: rgba(255, 255, 255, 0.9);
}

/* Responsive design */
@media (max-width: 768px) {
    .logo-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .app-name {
        font-size: 1.5rem;
    }
    
    .images-container {
        flex-direction: column;
    }
    
    .selected-image-container {
        order: 2;
    }
    
    .images-grid {
        order: 1;
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        max-height: 400px;
    }
    
    .color-by, .sort-by {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .color-by-label, .sort-by-label {
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
}

/* Animation for hover effects */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.images-grid > div {
    animation: fadeIn 0.3s ease-out;
}

/* Card styles */
.card-body {
    padding: 1.5rem;
    text-align: left;
}

.card {
    margin-bottom: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

/* Ensure all main containers have consistent width */
.info-box,
.card,
.card-body,
.color-by,
.sort-by,
.main-images-container {
    width: 100%;
    box-sizing: border-box;
}

/* Ensure all containers are left-aligned */
.select-pollination-project,
.select-sample,
.color-by,
.sort-by,
.main-images-container,
.radio-items {
    text-align: left;
}

/* Hide Dash debug menu */
.dash-debug-menu__outer {
    display: none !important;
}

/* Custom scrollbar for all elements */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}