/* =========================================
   1. ANIMATIONS
   ========================================= */
@keyframes flash {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes blinkingText {
    0% { color: #d32f2f; }
    50% { color: transparent; }
    100% { color: #d32f2f; }
}

@keyframes popupScaleIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.flashing-text {
    font-size: large;
    animation: flash 1s infinite;
}

/* =========================================
   2. TOOLTIPS (High Contrast)
   ========================================= */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 160px;
    background-color: #000; /* Pure Black */
    color: #fff;            /* Pure White */
    text-align: center;
    border-radius: 4px;
    padding: 8px;
    position: absolute;
    z-index: 10000000;
    bottom: 125%;
    left: 50%;
    margin-left: -80px;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 13px;
    font-weight: bold;
    border: 1px solid #fff; /* High contrast border */
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

.tooltiptext input {
    width: 100%;
    border: none;
    background-color: #333;
    color: white;
    padding: 5px;
    border-radius: 3px;
}

/* =========================================
   3. NOTICES & ALERTS
   ========================================= */
.notice {
    display: none;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #006400; /* Dark Green */
    color: #fff;
    padding: 15px 30px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 3000;
    opacity: 1;
    font-family: 'Segoe UI', sans-serif;
    font-weight: bold;
    border: 2px solid #fff;
}

.notice.show { display: block; opacity: 1; }
.notice.fade-out { opacity: 0; }

/* =========================================
   4. CHART HIGHLIGHTING (Mermaid)
   ========================================= */
.highlight rect, .highlight polygon, .highlight circle {
    fill: #fff176 !important; /* Stronger Yellow */
    stroke: #000 !important;  /* Black stroke for contrast */
    stroke-width: 4px !important;
    transition: fill 0.3s ease-in-out;
}

.next-highlight rect, .next-highlight polygon, .next-highlight circle {
    fill: #aed581 !important; /* Stronger Green */
    stroke: #000 !important;
    stroke-width: 4px !important;
    transition: fill 0.3s ease-in-out;
}

.highlight-line, .highlight-segment {
    background-color: rgba(255, 235, 59, 0.5);
    position: absolute;
    z-index: 20;
    border: 1px solid #fbc02d;
}

/* =========================================
   5. INTERACTIVE TERMINAL POPUP
   ========================================= */
#chartinteractivePopup {
    position: absolute;
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    background-color: #000; /* Pure Black for best contrast */
    border-radius: 8px;
    box-shadow: 0 0 0 1000px rgba(0,0,0,0.5); /* Dim background */
    display: none;
    z-index: 100;
    padding: 15px;
    border: 2px solid #fff; /* High Vis Border */
    display: flex;
    flex-direction: column;
}

#chartinteractivediv {
    flex-grow: 1;
    background-color: #000 !important;
    color: #fff !important;
    font-family: 'Consolas', monospace;
    font-size: 14px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #666;
}

/* Terminal Text Colors - Accessible */
#chartinteractivediv .command { color: #80d8ff; } /* Light Blue */
#chartinteractivediv .error, #chartinteractivediv span.terminal-error { color: #ff8a80; } /* Light Red */
#chartinteractivediv .user-input { color: #ccff90; } /* Light Green */

/* =========================================
   6. EDIT & CONTROL PANELS (MODAL CARDS)
   ========================================= */

/* Very subtle background overlay (Light Grey, Low Opacity) */
.statement_edit_panel::before,
.ctr_panel::before {
    content: "";
    position: fixed;
    top: -50vh;
    left: -50vw;
    width: 200vw;
    height: 200vh;
    background: rgba(0, 0, 0, 0.05); /* Very light grey tint */
    z-index: -1;
    pointer-events: none; /* Allows seeing through easily */
}

/* Main Card Styling */
.ctr_panel,
.statement_edit_panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;

    background-color: #ffffff; /* Solid White */
    padding: 25px;
    border-radius: 8px;
    
    /* Strong solid border for accessibility */
    border: 2px solid #000000; 
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2); /* Softer shadow */

    /* Sizing */
    min-width: 450px;
    max-width: 90vw;
    width: auto;
    
    /* Layout */
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;

    animation: popupScaleIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Inputs & Typography - High Contrast */
.styled-label,
.statement_edit_panel label,
.ctr_panel label {
    font-family: 'Segoe UI', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #000000; /* Pure Black */
    margin-bottom: 4px;
    flex: 1 1 100%;
}

#edit_content_instr {
    font-size: 14px;
    color: #000;
    font-style: normal;
    background: #f0f0f0;
    padding: 10px;
    border: 1px solid #555;
    border-radius: 4px;
    text-align: center;
    font-weight: 600;
    flex: 1 1 100%;
}

/* Inputs & Selects Styling */
.statement_edit_panel input[type="text"],
.statement_edit_panel textarea,
.ctr_panel select,
.styled-select {
    flex: 1 1 100%;
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    font-size: 16px;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #000;
    background-color: #fff;
    border: 2px solid #555;
    border-radius: 4px;
    margin-bottom: 8px;
}

/* Focus State */
.statement_edit_panel input[type="text"]:focus,
.ctr_panel select:focus,
.custom-button:focus,
.statement_edit_panel button:focus {
    outline: 3px solid #004494;
    outline-offset: 2px;
    border-color: #004494;
}

/* Error Messages */
.statement_edit_panel pre,
#error_messages {
    flex: 1 1 100%;
    background-color: #ffebee;
    color: #b71c1c;
    font-family: sans-serif;
    font-size: 14px;
    font-weight: bold;
    padding: 10px;
    border: 2px solid #b71c1c;
    border-radius: 4px;
    display: none;
}

/* =========================================
   7. BUTTONS (SAME ROW, EQUAL SIZE, ACCESSIBLE)
   ========================================= */

/* General styling for buttons inside the panels */
.statement_edit_panel button,
.ctr_panel button {
    flex: 1; /* Equal width */
    min-width: 90px;
    padding: 12px 0;
    margin: 10px 4px 0 4px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid transparent; 
}

/* Base Custom Button (Top Toolbar) */
.custom-button {
    background-color: #004494; /* WCAG AAA Blue */
    color: white;
    border: none;
    padding: 8px 14px;
    margin: 2px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
}
.custom-button:hover { 
    background-color: #002a5c; 
    text-decoration: underline;
}

/* --- PANEL BUTTON COLORS --- */

/* Primary Actions: Save / Add / Check (DEEP BLUE) */
button[id$="_save_edit_statement"],
button[id$="_add_new_statement"],
button[id$="_check_edit_statement"],
button[id$="_save_wrapper"] {
    background-color: #004494; 
    color: #ffffff;
    border-color: #002a5c;
}
button[id$="_save_edit_statement"]:hover,
button[id$="_add_new_statement"]:hover,
button[id$="_check_edit_statement"]:hover {
    background-color: #002a5c;
}

/* Secondary Action: Cancel (DARK GRAY) */
button[id$="_cancel_edit_statement"],
button[id$="_cancel_new_statement"],
button[id$="_cancel_wrapper"] {
    background-color: #444444;
    color: #ffffff;
    border-color: #222222;
}
button[id$="_cancel_edit_statement"]:hover {
    background-color: #222222;
}

/* Destructive Action: Delete (DEEP RED) */
.custom-del-button,
button[id$="_delete_statement"] {
    background-color: #b00020 !important; /* WCAG AAA Red */
    color: #ffffff !important;
    border-color: #790000 !important;
    width: auto !important;
    margin-top: 10px !important;
    flex: 1; /* Keep same size */
}

.custom-del-button:hover {
    background-color: #790000 !important;
    text-decoration: underline;
}

/* =========================================
   8. CHART EDGE LABELS & INTERACTION
   ========================================= */
#chartpre .edgeLabel a.loc-add span,
#chartpre .edgeLabel a.loc-add-else span {
    background-color: #fff !important;
    color: #004494 !important; /* Matches Primary Blue */
    border: 2px solid #004494;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    line-height: 20px;
    text-align: center;
    display: inline-block;
    font-weight: 900;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

#chartpre .edgeLabel a.loc-add span:hover,
#chartpre .edgeLabel a.loc-add-else span:hover {
    background-color: #004494 !important;
    color: white !important;
    transform: scale(1.2);
}

/* 1. BLUE BUTTONS (Editable Nodes - Keep Underline) */
.statement-edit-button {
    color: #004494 !important; /* Accessible Blue */
    font-weight: 700;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 2px 4px;
    transition: background-color 0.2s;
}

.statement-edit-button:hover {
    background-color: #e3f2fd;
    color: #002a5c !important;
}

/* 2. BLACK LABELS (Static/Special Nodes - NO Underline) */
.statement-edit {
    color: #000000 !important; /* Pure Black */
    font-weight: 700;
    text-decoration: none !important; /* Removed underline */
    cursor: default;
    background: transparent;
    border: none;
    padding: 2px 4px;
}

.statement-edit:hover {
    background-color: transparent; /* No hover effect for static text */
}

/* =========================================
   9. EDITOR AREAS
   ========================================= */
#code_from_chart_gen {
    border: 2px solid #555; /* Visible border */
    border-radius: 4px;
    margin-top: 10px;
}




/* =========================================
   INSTRUCTION / STEP EXPLANATION BOX
   ========================================= */
.instruction-box {
    /* Positioning: Overlays the chart at the top center */
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50; /* High enough to sit above flowchart lines */

    /* Visual Style - Accessible High Contrast */
    background-color: transparent;
    /* Typography */
    color: #A53200;
    font-family: 'Segoe UI', sans-serif;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;

    /* Sizing */
    padding: 12px 20px;
    min-width: 300px;
    max-width: 80%;
    
    /* Animation support */
    transition: opacity 0.3s ease, top 0.3s ease;
}

/* Optional: Add a subtle 'slide down' effect when it appears */
.instruction-box[style*="display: block"] {
    animation: slideDownFade 0.3s ease-out;
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        top: 10px;
    }
    to {
        opacity: 1;
        top: 20px;
    }
}



/* --- Toast Notification --- */
.custom-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #ffffff;
    color: #333;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    border-left: 4px solid #28a745; /* Green by default */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.custom-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.custom-toast.error {
    border-left: 4px solid #dc3545; /* Red for errors */
}


.navbar-workbench a:hover {
    color:#fff;
    font-size: larger;
    font-weight: bold;
}