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

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

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: var(--surface-color);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

/* Hero Header - matches main index.html 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: 600px;
    margin: 0 auto;
}

.main-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    min-height: calc(100vh - 200px);
}

/* Sidebar */
.sidebar {
    background: var(--bg-secondary);
    padding: 20px;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.control-panel {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--analogy-shadow);
}

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

.control-panel h4 {
    color: var(--secondary-color);
    margin: 15px 0 10px 0;
    font-size: 1.1em;
}

.control-section {
    margin-bottom: 20px;
}

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

.control-section select {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: var(--surface-color);
    color: var(--text-primary);
}

.control-section select:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

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

.checkbox-group {
    margin-top: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    margin: 8px 0;
    font-weight: 400;
    cursor: pointer;
}

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

.btn {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--analogy-transition);
    margin-top: 10px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

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

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

.status-text {
    margin-top: 10px;
    padding: 8px;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
}

.status-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

.status-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

/* Model Info */
.model-info {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
}

.info-item .label {
    color: var(--text-secondary);
    font-weight: 600;
}

.info-item .value {
    color: var(--primary-color);
    font-weight: 700;
}

/* Analogy Input */
.analogy-input {
    margin-top: 10px;
}

.analogy-formula {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.analogy-word {
    flex: 1;
    min-width: 80px;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    transition: border-color 0.3s;
    background: var(--surface-color);
    color: var(--text-primary);
}

.analogy-word:focus {
    outline: none;
    border-color: var(--primary-color);
}

.operator {
    font-size: 18px;
    font-weight: 700;
    color: var(--secondary-color);
}

.result {
    flex: 1;
    min-width: 80px;
    padding: 8px 12px;
    background: rgba(245, 158, 11, 0.1);
    border: 2px solid var(--warning-color);
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    color: var(--warning-color);
    text-align: center;
}

/* Analogy Results */
.analogy-results {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.analogy-results h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.predictions-list,
.similar-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prediction-item,
.similar-item {
    display: grid;
    grid-template-columns: 30px 1fr 2fr 60px;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--surface-color);
    border-radius: 6px;
    border: 2px solid transparent;
    transition: var(--analogy-transition);
}

.prediction-item:hover,
.similar-item:hover {
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.rank {
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.word {
    font-weight: 600;
    color: var(--text-primary);
}

.similarity-bar {
    background: var(--surface-hover);
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 10px;
    transition: width 0.5s ease;
}

.similarity {
    text-align: right;
    font-size: 13px;
    color: var(--primary-color);
    font-weight: 600;
}

/* Examples */
.examples-section {
    margin-top: 20px;
}

.examples-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.example-btn {
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-color);
    font-size: 13px;
    font-family: monospace;
    text-align: left;
    cursor: pointer;
    transition: var(--analogy-transition);
    color: var(--text-primary);
}

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

/* Search */
.search-input {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 10px;
    transition: border-color 0.3s;
    background: var(--surface-color);
    color: var(--text-primary);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.similar-results {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.similar-results h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Info Panel */
.info-panel {
    background: rgba(245, 158, 11, 0.1);
    border-radius: 12px;
    padding: 20px;
    border-left: 4px solid var(--warning-color);
}

.info-panel h4 {
    color: var(--warning-color);
    margin-bottom: 10px;
}

.info-panel p {
    margin-bottom: 10px;
    line-height: 1.6;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    padding: 30px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    background: var(--bg-color);
}

.hidden {
    display: none !important;
}

/* Loading */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface-color);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    text-align: center;
    z-index: 1000;
}

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

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

/* Visualization Sections */
.viz-section {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
}

.viz-section h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.viz-section .subtitle {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.plot-container {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 20px;
    min-height: 500px;
}

/* Explanation Panel */
.explanation-panel {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
}

.explanation-panel h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.explanation-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.step {
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.step strong {
    color: var(--secondary-color);
    display: block;
    margin-bottom: 10px;
}

.formula {
    padding: 15px;
    background: var(--surface-color);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    margin: 10px 0;
    text-align: center;
    font-size: 16px;
    color: var(--text-primary);
}

.formula em {
    color: var(--primary-color);
    font-weight: 700;
}

.formula .vector {
    color: var(--secondary-color);
    font-weight: 700;
}

.detail {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 8px;
}

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

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

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

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

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

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

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

    .sidebar {
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .analogy-formula {
        flex-direction: column;
        align-items: stretch;
    }

    .analogy-word,
    .result {
        min-width: auto;
    }

    .operator {
        text-align: center;
    }

    .prediction-item,
    .similar-item {
        grid-template-columns: 30px 1fr;
        grid-template-rows: auto auto;
    }

    .similarity-bar {
        grid-column: 1 / -1;
    }

    .similarity {
        grid-column: 1 / -1;
        text-align: center;
    }
}

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

    .hero-subtitle {
        font-size: 0.9em;
    }

    .main-content {
        padding: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .plot-container {
        min-height: 400px;
    }
}
