/* Tobacco Industry System Components - vis-network MicroSim
 * ==========================================================
 * Optimized for narrow iframe embedding in textbook chapters
 */

/* ===========================================
   RESET & BASE STYLES
   =========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f8f9fa;
}

/* ===========================================
   MAIN CONTAINER & NETWORK CANVAS
   =========================================== */
.container {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 550px;
}

#network {
    width: 100%;
    height: 100%;
    background-color: #f8f9fa;
}

/* ===========================================
   TITLE (Top Center)
   =========================================== */
.title {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    font-weight: bold;
    color: #333;
    background-color: rgba(248, 249, 250, 0.95);
    padding: 4px 12px;
    border-radius: 4px;
    z-index: 10;
    white-space: nowrap;
}

/* ===========================================
   LEGEND (Upper Left)
   =========================================== */
.legend {
    position: absolute;
    top: 10px;
    left: 8px;
    padding: 8px 10px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10;
    font-size: 11px;
    max-width: 140px;
}

.legend-title {
    font-weight: bold;
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 4px;
    margin-top: 4px;
}

.legend-title:first-child {
    margin-top: 0;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 3px 0;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    margin-right: 6px;
    border: 1px solid rgba(0,0,0,0.2);
}

.legend-divider {
    height: 1px;
    background-color: #ddd;
    margin: 6px 0;
}

/* Node category colors */
.color-industry { background-color: #e74c3c; }
.color-government { background-color: #3498db; }
.color-health { background-color: #27ae60; }
.color-society { background-color: #f1c40f; }

/* Connection type lines */
.legend-line {
    width: 24px;
    height: 3px;
    margin-right: 6px;
}

.legend-line.solid {
    background-color: #27ae60;
}

.legend-line.information {
    background: repeating-linear-gradient(
        90deg,
        #3498db,
        #3498db 4px,
        transparent 4px,
        transparent 8px
    );
    height: 2px;
}

.legend-line.influence {
    background: repeating-linear-gradient(
        90deg,
        #9b59b6,
        #9b59b6 6px,
        transparent 6px,
        transparent 10px
    );
    height: 2px;
}

.legend-line.dotted {
    background: repeating-linear-gradient(
        90deg,
        #e67e22,
        #e67e22 2px,
        transparent 2px,
        transparent 6px
    );
    height: 2px;
}

.legend-line.bold-line {
    background-color: #2c3e50;
    height: 4px;
}

/* ===========================================
   RIGHT PANEL (Controls & Status)
   =========================================== */
.right-panel {
    position: absolute;
    bottom: 10px;
    right: 8px;
    width: 130px;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    z-index: 10;
}

/* ===========================================
   CONTROL BUTTONS
   =========================================== */
.controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 8px 10px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-label {
    font-size: 11px;
    font-weight: bold;
    color: #666;
}

#filter-select {
    padding: 6px 8px;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
}

#filter-select:focus {
    outline: none;
    border-color: #3498db;
}

.btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: bold;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary {
    background-color: #757575;
    color: white;
}

.btn-secondary:hover {
    background-color: #616161;
}

/* ===========================================
   SAVE CONTROLS (Editor Mode)
   =========================================== */
.save-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background-color: rgba(232, 245, 233, 0.95);
    padding: 8px 10px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 2px solid #4caf50;
}

.save-label {
    font-size: 11px;
    font-weight: bold;
    color: #2e7d32;
    text-transform: uppercase;
}

.save-hint {
    font-size: 10px;
    color: #555;
    font-style: italic;
}

.btn-save {
    background-color: #4caf50;
    color: white;
    padding: 8px 12px;
}

.btn-save:hover {
    background-color: #388e3c;
}

/* ===========================================
   STATUS INFO PANEL
   =========================================== */
.status-info {
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 4px;
    padding: 0px 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.status-title {
    font-weight: bold;
    margin-bottom: 0px;
    font-size: 11px;
    color: #333;
}

.status-text {
    font-size: 11px;
    line-height: 1;
    color: #555;
}

/* ===========================================
   ANNOTATION BOX
   =========================================== */
.annotation-box {
    background-color: rgba(255, 248, 220, 0.95);
    border-radius: 6px;
    padding: 8px 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 3px solid #f39c12;
}

.annotation-title {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 11px;
    color: #333;
}

.annotation-text {
    font-size: 11px;
    line-height: 1.4;
    color: #555;
}

/* Highlight for problematic connections */
.problematic-highlight {
    color: #c0392b;
    font-weight: bold;
}

/* ===========================================
   VIS-NETWORK NAVIGATION BUTTONS
   =========================================== */
.vis-navigation {
    position: absolute !important;
    bottom: 10px !important;
    left: 10px !important;
}

/* ===========================================
   RESPONSIVE STYLES
   =========================================== */
@media (max-width: 500px) {
    .title {
        font-size: 14px;
        padding: 3px 8px;
    }

    .legend {
        padding: 6px 8px;
        max-width: 120px;
        font-size: 10px;
    }

    .legend-color {
        width: 12px;
        height: 12px;
    }

    .right-panel {
        width: 160px;
    }

    .controls {
        padding: 6px 8px;
    }

    .btn {
        padding: 5px 10px;
        font-size: 11px;
    }

    #filter-select {
        font-size: 11px;
        padding: 4px 6px;
    }
}

/* Very narrow screens - stack layout */
@media (max-width: 400px) {
    .legend {
        top: auto;
        bottom: 60px;
        left: 8px;
    }

    .right-panel {
        top: 40px;
        width: 140px;
    }
}
