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

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

    /* Component-specific colors (used for legend) */
    --color-embedding: #4CAF50;
    --color-attention: #2196F3;
    --color-feedforward: #FF9800;
    --color-normalization: #9C27B0;
    --color-output: #F44336;
}

/* Container */
.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 20px;
}

/* Hero Header - matches main index.html and ELIZA demo 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;
}

/* Legacy header support (fallback) */
.header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--surface-color) 0%, var(--bg-secondary) 100%);
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: var(--transformer-shadow-lg);
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.1em;
    color: var(--text-secondary);
}

/* Control Panel */
.control-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: var(--transformer-shadow);
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 200px;
}

.control-group label {
    font-size: 0.9em;
    color: var(--text-secondary);
    font-weight: 500;
}

.control-group select,
.control-group input {
    padding: 10px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1em;
    transition: var(--transformer-transition);
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transformer-transition);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--transformer-shadow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--transformer-shadow-lg);
}

.btn:active {
    transform: translateY(0);
}

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

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

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

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    margin-bottom: 20px;
}

/* 3D Canvas */
.canvas-container {
    position: relative;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--transformer-shadow-lg);
    min-height: 600px;
}

#scene-container {
    width: 100%;
    height: 600px;
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.info-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    background: var(--surface-color);
    padding: 15px 20px;
    border-radius: 10px;
    border: 2px solid var(--primary-color);
    max-width: 300px;
    backdrop-filter: blur(10px);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.info-panel h3 {
    font-size: 1.1em;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.info-panel p {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 0;
}

/* Side Panel */
.side-panel {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--transformer-shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 600px;
    animation: slideLeft 0.5s ease-out;
}

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.panel-header {
    padding: 20px;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 1.4em;
    color: var(--primary-color);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2em;
    cursor: pointer;
    transition: var(--transformer-transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-btn:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.panel-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.panel-content h3 {
    color: var(--secondary-color);
    margin-bottom: 10px;
    font-size: 1.2em;
}

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

.panel-content p {
    line-height: 1.6;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.panel-content ul {
    list-style: none;
    padding: 0;
}

.panel-content ul li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    color: var(--text-secondary);
    line-height: 1.5;
}

.panel-content ul li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

.architecture-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

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

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

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

/* Tensor Flow Panel */
.tensor-flow-panel {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--transformer-shadow);
    margin-bottom: 20px;
    animation: fadeIn 1s ease-out;
}

.tensor-flow-panel h3 {
    margin-bottom: 15px;
    color: var(--secondary-color);
    font-size: 1.3em;
}

#tensor-flow-viz {
    min-height: 200px;
    position: relative;
    overflow-x: auto;
}

/* Component Library */
.component-library {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--transformer-shadow);
    margin-bottom: 20px;
    animation: fadeIn 1.2s ease-out;
}

.component-library h3 {
    margin-bottom: 20px;
    color: var(--secondary-color);
    font-size: 1.3em;
}

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

.component-card {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: var(--transformer-transition);
    border: 2px solid transparent;
}

.component-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: var(--transformer-shadow-lg);
}

.component-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.component-card h4 {
    color: var(--text-primary);
    margin-bottom: 5px;
    font-size: 1em;
}

.component-card p {
    color: var(--text-secondary);
    font-size: 0.85em;
    margin-bottom: 0;
}

/* Legend */
.legend {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--transformer-shadow);
    animation: fadeIn 1.4s ease-out;
}

.legend h4 {
    margin-bottom: 15px;
    color: var(--secondary-color);
    font-size: 1.2em;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.legend-color {
    width: 30px;
    height: 20px;
    border-radius: 4px;
    box-shadow: var(--transformer-shadow);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

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

    .side-panel {
        max-height: 400px;
    }
}

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

    .header h1 {
        font-size: 1.8em;
    }

    .control-panel {
        flex-direction: column;
    }

    .control-group {
        min-width: 100%;
    }

    .component-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

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

/* Animation Classes */
.highlight {
    animation: highlight 1s ease-in-out;
}

@keyframes highlight {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.data-flow {
    animation: dataFlow 2s ease-in-out infinite;
}

@keyframes dataFlow {
    0% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(10px);
    }
    100% {
        transform: translateX(0);
    }
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: var(--surface-color);
    color: var(--text-primary);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9em;
    pointer-events: none;
    z-index: 1000;
    border: 2px solid var(--primary-color);
    box-shadow: var(--transformer-shadow-lg);
    backdrop-filter: blur(10px);
}

/* Component Detail Styles */
.formula {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    font-family: 'Courier New', monospace;
    border-left: 4px solid var(--accent-color);
    overflow-x: auto;
    color: var(--text-primary);
}

.code-block {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.tensor-shape {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    margin: 5px 5px 5px 0;
}

.layer-badge {
    display: inline-block;
    background: var(--secondary-color);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    margin-right: 5px;
}
