/**
 * Text Embeddings Explorer - Styles
 * Uses CSS variables from ../shared/css/demo-styles.css for theming
 */

/* Demo-specific variables that don't conflict with theming */
:root {
    --embeddings-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --embeddings-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --embeddings-transition: all 0.3s ease;
}

.container {
    max-width: 100%;
    padding: 20px;
}

/* Hero Header - matches ELIZA styling */
.hero-header {
    padding: 3rem 0 2rem;
    margin-bottom: 30px;
    text-align: center;
    background: linear-gradient(180deg, var(--surface-color) 0%, var(--bg-color) 100%);
}

.hero-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    min-height: calc(100vh - 300px);
}

@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.control-panel {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--embeddings-shadow);
}

.control-panel h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

/* Control Sections */
.control-section {
    margin-bottom: 20px;
}

.control-section:last-child {
    margin-bottom: 0;
}

.control-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.control-section select,
.control-section input[type="text"],
.control-section textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    transition: var(--embeddings-transition);
    background: var(--surface-color);
    color: var(--text-primary);
}

.control-section select:focus,
.control-section input[type="text"]:focus,
.control-section textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.control-section textarea {
    resize: vertical;
    font-family: inherit;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--embeddings-transition);
    width: 100%;
    margin-top: 10px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover, var(--primary-dark));
    transform: translateY(-2px);
    box-shadow: var(--embeddings-shadow);
}

.btn-secondary {
    background: var(--surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--surface-color);
    border-color: var(--primary-color);
}

/* Parameter Groups */
.param-group {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.param-group label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.param-group input[type="range"] {
    width: calc(100% - 50px);
    margin-right: 10px;
}

.param-group span {
    display: inline-block;
    width: 40px;
    text-align: right;
    font-weight: 600;
    color: var(--primary-color);
}

/* Checkbox Groups */
.checkbox-group {
    margin-top: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: 400;
    margin-bottom: 8px;
    cursor: pointer;
    color: var(--text-primary);
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Info Note */
.info-note {
    margin-top: 8px;
    font-size: 0.85em;
    color: var(--text-secondary) !important;
}

/* Status Text */
.status-text {
    margin-top: 10px;
    padding: 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    min-height: 20px;
}

.status-text:not(:empty) {
    background: var(--surface-hover);
    color: var(--info-color);
}

/* Nearest Neighbors */
#nearest-neighbors {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

#nearest-neighbors h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1rem;
}

#neighbors-list {
    list-style: none;
}

#neighbors-list li {
    padding: 10px;
    margin-bottom: 8px;
    background: var(--surface-color);
    border-left: 3px solid var(--primary-color);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-primary);
}

#neighbors-list li strong {
    color: var(--primary-color);
}

#neighbors-list li em {
    color: var(--text-secondary);
}

/* Search Results */
#search-results {
    margin-top: 10px;
}

#search-results ul {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}

#search-results li {
    padding: 8px;
    margin-bottom: 5px;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-primary);
}

#search-results li:hover {
    background: var(--surface-hover);
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.visualization-container {
    position: relative;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--embeddings-shadow);
    min-height: 600px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px;
}

.plot-area {
    min-height: 580px;
    border-radius: 8px;
    background: var(--bg-secondary);
}

.plot-area.hidden {
    display: none;
}

.visualization-container:not(:has(.hidden)) .plot-area {
    grid-column: span 1;
}

.visualization-container:has(.hidden) .plot-area:not(.hidden) {
    grid-column: span 2;
}

/* Loading Spinner */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1000;
}

.loading.hidden {
    display: none;
}

.spinner {
    border: 4px solid var(--surface-hover);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.loading p {
    color: var(--primary-color);
    font-weight: 600;
}

/* Statistics Panel */
.stats-panel {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--embeddings-shadow);
}

.stats-panel h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

#stats-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-item {
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Cluster Statistics */
.cluster-stats {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.cluster-stats.hidden {
    display: none;
}

.cluster-stats h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1rem;
}

#cluster-distribution {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cluster-stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Info Panel */
.info-panel {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--embeddings-shadow);
}

.info-panel h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.info-panel ul {
    list-style: none;
}

.info-panel li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.info-panel li:last-child {
    border-bottom: none;
}

.info-panel strong {
    color: var(--primary-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.modal-content p {
    color: var(--text-secondary);
}

.modal-content textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-color);
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
}

.modal-content textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
    margin-top: 0;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar,
#search-results ul::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track,
#search-results ul::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb,
#search-results ul::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
#search-results ul::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 1.8rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .visualization-container {
        min-height: 400px;
        grid-template-columns: 1fr;
    }

    .plot-area {
        min-height: 380px;
    }

    #stats-content {
        grid-template-columns: 1fr 1fr;
    }
}

/* Animation for newly added points */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.custom-point {
    animation: pulse 1s ease-in-out 3;
}

/* Empty state - matches ELIZA styling */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state-text {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.empty-state-subtext {
    font-size: 0.9rem;
}
