/* Simulateur OPC UA Pédagogique - Styles CSS */

/* Variables et réinitialisation */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --light-color: #ecf0f1;
    --dark-color: #34495e;
    --text-color: #333;
    --border-color: #ddd;
    --shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f5f7fa;
}

/* Structure principale */
.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

header h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#connection-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: var(--transition);
}

#connection-indicator.disconnected {
    background-color: var(--accent-color);
}

#connection-indicator.connected {
    background-color: var(--success-color);
}

.main-content {
    display: flex;
    flex: 1;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.sidebar {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.main-panel {
    flex: 1;
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: #777;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    width: 100%;
    flex-wrap: wrap;
}

.footer-info, .footer-contact, .footer-links {
    margin: 0.5rem 0;
}

.footer-contact a {
    color: var(--secondary-color);
    text-decoration: none;
}

.footer-contact a:hover {
    text-decoration: underline;
}

.author-info {
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Panneaux et composants */
.panel {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.panel h2 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.help-text {
    font-size: 0.8em;
    color: #666;
    margin-top: 2px;
}

.button-group {
    display: flex;
    gap: 0.5rem;
}

/* Boutons */
button {
    cursor: pointer;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    transition: var(--transition);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.primary-btn:hover:not(:disabled) {
    background-color: #2980b9;
}

.secondary-btn {
    background-color: var(--light-color);
    color: var(--dark-color);
}

.secondary-btn:hover:not(:disabled) {
    background-color: #dfe6e9;
}

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

.warning-btn:hover:not(:disabled) {
    background-color: #e67e22;
}

.tool-btn {
    background-color: var(--light-color);
    color: var(--dark-color);
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
}

.tool-btn:hover:not(:disabled) {
    background-color: #dfe6e9;
}

.link-btn {
    background: none;
    color: var(--secondary-color);
    padding: 0;
    font-size: 0.9rem;
    text-decoration: underline;
}

.link-btn:hover {
    color: #2980b9;
}

/* Onglets */
.tabs {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tab-header {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    padding: 0.8rem 1.2rem;
    background: none;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    color: #777;
}

.tab-btn:hover:not(.active) {
    background-color: #f8f9fa;
}

.tab-btn.active {
    color: var(--secondary-color);
    border-bottom-color: var(--secondary-color);
}

.tab-content {
    flex: 1;
    overflow: auto;
}

.tab-pane {
    display: none;
    padding: 1.5rem;
    height: 100%;
}

.tab-pane.active {
    display: block;
}

/* Espace d'adressage */
.address-space-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.address-space-toolbar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.search-container {
    display: flex;
    gap: 0.5rem;
}

.search-container input {
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
}

.address-space-tree {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
    overflow: auto;
    min-height: 200px;
}

.tree-view {
    font-family: monospace;
    font-size: 0.9rem;
}

.tree-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #777;
}

.node-details {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
    min-height: 150px;
}

.node-details h3 {
    margin-bottom: 0.8rem;
    color: var(--primary-color);
    font-size: 1rem;
}

/* Lecture/Écriture */
.read-write-container {
    display: flex;
    gap: 1.5rem;
    height: 100%;
}

.operation-panel {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
}

.operation-panel h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1rem;
}

.operation-result {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
}

.operation-result h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1rem;
}

.result-panel {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 1rem;
    min-height: 200px;
    font-family: monospace;
    white-space: pre-wrap;
    overflow: auto;
}

/* Abonnements */
.subscriptions-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    gap: 1rem;
    height: 100%;
}

.subscription-panel {
    grid-column: 1;
    grid-row: 1;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
}

.subscription-panel h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1rem;
}

.active-subscriptions {
    grid-column: 2;
    grid-row: 1;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
}

.active-subscriptions h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1rem;
}

.subscription-notifications {
    grid-column: 1 / span 2;
    grid-row: 2;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
}

.subscription-notifications h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1rem;
}

.list-panel {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 1rem;
    height: calc(100% - 2.5rem);
    overflow: auto;
}

/* Transactions */
.transactions-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.transactions-toolbar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.filter-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-container select {
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
}

.transactions-list {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
    overflow: auto;
    min-height: 300px;
}

.transaction-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #777;
}

.transaction-item {
    padding: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-item.read {
    border-left: 3px solid var(--secondary-color);
}

.transaction-item.write {
    border-left: 3px solid var(--success-color);
}

.transaction-item.subscription {
    border-left: 3px solid var(--warning-color);
}

.transaction-item.error {
    border-left: 3px solid var(--accent-color);
}

/* Informations pédagogiques */
.info-tabs {
    margin-top: 0.5rem;
}

.info-tabs .tab-header {
    margin-bottom: 0.5rem;
}

.info-tabs .tab-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
}

.info-tabs .tab-pane {
    padding: 0.8rem;
    font-size: 0.9rem;
}

.info-tabs .tab-pane p {
    margin-bottom: 0.8rem;
}

.info-tabs .tab-pane ul {
    margin-left: 1.5rem;
    margin-bottom: 0.8rem;
}

/* Overlay d'explication */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.overlay-content h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.overlay-content button {
    margin-top: 1.5rem;
}

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

/* Animation pour les flux de données */
@keyframes dataFlow {
    0% {
        transform: translateY(-10px);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(10px);
        opacity: 0;
    }
}

.data-flow {
    position: relative;
}

.data-flow::before {
    content: '↓';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    color: var(--secondary-color);
    font-size: 1.2rem;
    animation: dataFlow 1.5s infinite;
}

/* Responsive */
@media (max-width: 992px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        flex: none;
        width: 100%;
    }
    
    .read-write-container {
        flex-direction: column;
    }
    
    .subscriptions-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
    }
    
    .active-subscriptions {
        grid-column: 1;
        grid-row: 2;
    }
    
    .subscription-notifications {
        grid-column: 1;
        grid-row: 3;
    }
}
