/* ============================================================================
   Applying Neural Networks Demo - Custom Styles
   ============================================================================ */

/* Demo Tabs */
.demo-tabs {
    width: 100%;
}

.demo-tab-header {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.demo-tab-button {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}

.demo-tab-button:hover {
    color: #1976d2;
    background: rgba(25, 118, 210, 0.05);
}

.demo-tab-button.active {
    color: #1976d2;
    border-bottom-color: #1976d2;
}

.demo-tab-content {
    display: none;
}

.demo-tab-content.active {
    display: block;
}

/* Sections */
.section {
    margin-bottom: 30px;
}

.section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

/* Dataset Controls */
.dataset-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dataset-controls select {
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
}

.dataset-info-box {
    padding: 12px;
    background: #f5f5f5;
    border-left: 3px solid #1976d2;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.dataset-info-box.show {
    border-color: #1976d2;
}

.loading-indicator {
    padding: 10px;
    background: #fff3e0;
    border-left: 3px solid #ff9800;
    border-radius: 4px;
    font-size: 14px;
    color: #e65100;
    font-weight: 500;
}

/* Two-Column Layout */
.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.column-left,
.column-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.viz-panel {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.viz-panel h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
    color: #555;
}

#networkCanvas {
    width: 100%;
    height: 300px;
    background: white;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

#lossChart {
    width: 100%;
    height: 100%;
}

/* Architecture Controls */
.architecture-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.control-row label {
    font-weight: 500;
    margin-right: 5px;
}

.training-controls .control-row {
    gap: 5px;
}

.training-controls .control-row input#learningRate {
    margin-right: 20px;
}

/* Button styles removed - now using phoebe.css conventions (.solution-btn, .reset-btn, .btn-secondary, etc.) */

.layer-controls-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.layer-control {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.layer-control--enter {
    animation: layer-control-enter 0.25s ease;
}

.layer-control:hover {
    background: #eef5ff;
    border-color: #90caf9;
    transform: translateY(-1px);
}

.layer-control span {
    font-weight: 500;
    min-width: 60px;
}

.layer-control input,
.layer-control select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.layer-control input[type="number"] {
    width: 60px;
}

.layer-control select {
    min-width: 100px;
}

@keyframes layer-control-enter {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Training Controls */
.training-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.training-controls input[type="number"] {
    width: 40px;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.training-controls input#learningRate {
    width: 60px;
}

/* Progress Bar */
.progress-bar-container {
    margin-top: 15px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.progress-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-label {
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.progress-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.progress-text {
    font-size: 12px;
    font-family: 'Courier New', monospace;
    color: #1976d2;
    font-weight: 600;
}

.progress-eta {
    font-size: 11px;
    font-family: 'Courier New', monospace;
    color: #666;
    font-weight: 500;
}

.progress-bar-track {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #1976d2, #42a5f5);
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: none;
}

.progress-bar-fill.training-active::after {
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.metrics-display {
    display: flex;
    gap: 20px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 14px;
}

.metrics-display span {
    color: #666;
}

.metrics-display strong {
    color: #333;
    font-family: 'Courier New', monospace;
}

/* Evaluation Results */
.evaluation-results {
    margin-top: 20px;
}

#resultsTable {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

#resultsTable th,
#resultsTable td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#resultsTable th {
    background: #f5f5f5;
    font-weight: 600;
    color: #555;
}

#resultsTable tbody tr:hover {
    background: #f9f9f9;
}

.evaluation-notes {
    padding: 12px;
    background: #e3f2fd;
    border-left: 3px solid #1976d2;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
}

/* Manual Prediction */
.prediction-inputs {
    margin-bottom: 20px;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.input-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-row label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.input-row input {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.input-row input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

.prediction-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.result-box {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    text-align: center;
}

.result-box h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #555;
    font-size: 16px;
}

.prediction-value {
    font-size: 24px;
    font-weight: bold;
    color: #1976d2;
    font-family: 'Courier New', monospace;
}

.prediction-warning {
    margin-top: 15px;
    padding: 12px;
    background: #fff3e0;
    border-left: 3px solid #ff9800;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}

/* Weight Tooltip */
.weight-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    .two-column-layout {
        grid-template-columns: 1fr;
    }

    .prediction-results {
        grid-template-columns: 1fr;
    }

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

    .demo-tab-header {
        flex-direction: column;
    }

    .demo-tab-button {
        width: 100%;
        text-align: left;
    }

    .layer-control {
        flex-wrap: wrap;
    }

    .control-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .metrics-display {
        flex-direction: column;
        gap: 5px;
    }

    #networkCanvas {
        height: 250px;
    }

    #lossChart {
        height: 250px;
    }
}

/* Accessibility */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

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

.text-color-input {
    color: #1976d2;
}

.text-color-hidden {
    color: #7b1fa2;
}

.text-color-output {
    color: #388e3c;
}

@media (prefers-reduced-motion: reduce) {
    button,
    button:hover,
    .layer-control,
    .layer-control--enter,
    .dataset-info-box,
    .demo-tab-content {
        transition: none;
        animation: none;
    }
}

/* Smooth Transitions */
.demo-tab-content {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
