/**
 * EasyEDA Viewer Styles
 * Styles pour l'affichage des schématiques EasyEDA
 */

/* Conteneur principal EasyEDA */
.easyeda-container,
.schema-container {
    background: #f8f9fa;
    border: 1px solid #d1d9e0;
    border-radius: 8px;
    margin: 1.5rem 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Conteneur schema automatique */
.schema-container.auto-schema {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #007bff;
}

/* Légende et contrôles */
.easyeda-legend,
.schema-legend {
    background: #e9ecef;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #d1d9e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 500;
}

.schema-legend {
    background: linear-gradient(90deg, #007bff, #0056b3);
    color: white;
    border-bottom: 1px solid #0056b3;
}

.easyeda-legend .legend-title {
    color: #495057;
}

.easyeda-controls {
    display: flex;
    gap: 0.5rem;
}

.easyeda-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.easyeda-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.easyeda-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.load-btn {
    background: #007bff !important;
}

.load-btn:hover {
    background: #0056b3 !important;
}

.info-btn {
    background: #17a2b8 !important;
}

.info-btn:hover {
    background: #138496 !important;
}

/* Zone d'affichage */
.easyeda-display {
    padding: 1.5rem;
    background: white;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Placeholder avant chargement */
.easyeda-placeholder {
    text-align: center;
    color: #6c757d;
}

.easyeda-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #adb5bd;
}

.easyeda-placeholder p {
    margin: 0.5rem 0;
    font-size: 1rem;
}

.easyeda-placeholder code {
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.9rem;
    color: #495057;
}

/* Schématiques SVG */
.easyeda-schematic {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    margin: 1rem 0;
}

.easyeda-schematic.demo {
    background: #f8f9fa;
}

/* Informations du fichier */
.easyeda-info {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    align-self: stretch;
}

/* Liste des composants */
.easyeda-components {
    align-self: stretch;
    margin-top: 1rem;
}

.easyeda-components h4 {
    margin: 0 0 0.5rem 0;
    color: #495057;
    font-size: 1rem;
}

.easyeda-components ul {
    margin: 0;
    padding-left: 1.5rem;
}

.easyeda-components li {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

/* Erreurs */
.easyeda-error {
    text-align: center;
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 1rem;
}

.easyeda-error i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.easyeda-error code {
    background: #f1b0b7;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 768px) {
    .easyeda-legend {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .easyeda-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .easyeda-btn {
        flex: 1;
        text-align: center;
    }
    
    .easyeda-display {
        padding: 1rem;
    }
    
    .easyeda-schematic {
        width: 100%;
        height: auto;
    }
}

/* Intégration avec KaTeX */
.easyeda-container + .katex-container {
    margin-top: 0.5rem;
}

.katex-container + .easyeda-container {
    margin-top: 0.5rem;
}

/* Animation de chargement */
@keyframes easyedaLoad {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.easyeda-display > * {
    animation: easyedaLoad 0.3s ease-out;
}

/* Styles spécifiques aux schémas automatiques */
.schema-controls {
    display: flex;
    gap: 0.5rem;
}

.schema-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.schema-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

.schema-display {
    padding: 2rem;
    background: white;
    min-height: 300px;
    text-align: center;
}

.schema-placeholder {
    color: #495057;
}

.schema-placeholder h3 {
    color: #007bff;
    margin: 1rem 0;
}

.schema-info {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
    padding: 1rem;
    margin: 1rem 0;
    text-align: left;
    display: inline-block;
}

.schema-btn-large {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 1rem;
    transition: all 0.2s;
}

.schema-btn-large:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.3);
}

/* Animation de génération */
.schema-generating {
    color: #666;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Schéma généré */
.generated-schema {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.schema-meta {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: left;
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
}

.schema-calculations {
    margin: 1.5rem 0;
    text-align: left;
}

.schema-calculations h4 {
    color: #495057;
    margin-bottom: 1rem;
    text-align: center;
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.calc-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.75rem;
    font-size: 0.9rem;
}

.schema-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.schema-actions .schema-btn {
    background: #6c757d;
    color: white;
    border: 1px solid #6c757d;
    padding: 0.5rem 1rem;
}

.schema-actions .schema-btn:hover {
    background: #5a6268;
}

/* Mode impression */
@media print {
    .easyeda-container,
    .schema-container {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #666;
    }
    
    .easyeda-legend,
    .schema-legend {
        background: #f0f0f0 !important;
        color: #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .easyeda-btn,
    .schema-btn,
    .schema-btn-large,
    .schema-actions {
        display: none;
    }
    
    .easyeda-schematic,
    .generated-schema {
        max-width: 100%;
    }
}