/* =========================================================================
   TeachCloud CI/CD & DevOps Automation Studio Stylesheet
   Violet / Cyan / Emerald Pipeline Flow & Runner Simulator
   ========================================================================= */

.cicd-studio-container {
    max-width: 1200px;
    margin: 1.5rem auto 3.5rem;
    padding: 0 1rem;
}

.cicd-master-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.25);
    transition: var(--transition);
}

.cicd-studio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.cicd-studio-title-badge {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #8b5cf6;
}

.cicd-studio-title {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0.25rem 0 0;
}

.cicd-level-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.cicd-level-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    font-size: 0.84rem;
    font-weight: 700;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.cicd-level-btn:hover {
    color: #a855f7;
    border-color: #8b5cf6;
    transform: translateY(-1px);
}

.cicd-level-btn.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.15));
    border-color: #8b5cf6;
    color: #c084fc;
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.25);
}

/* =========================================================================
   Pipeline Visual Stepper Flow
   ========================================================================= */

.pipeline-visual-board {
    background: var(--bg-primary, #0f172a);
    border: 1px solid var(--border-color, #1e293b);
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.pipeline-stepper-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 780px;
    position: relative;
    padding: 1rem 0.5rem;
}

.pipeline-step-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 2;
    cursor: pointer;
    transition: transform 0.2s ease;
    width: 110px;
}

.pipeline-step-node:hover {
    transform: scale(1.05);
}

.pipeline-node-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: #1e293b;
    border: 2px solid #475569;
    color: #94a3b8;
    margin-bottom: 0.6rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.pipeline-node-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 0.2rem;
    white-space: nowrap;
}

.pipeline-node-status {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Stage State Variants */
.pipeline-step-node.status-pending .pipeline-node-icon {
    border-color: #334155;
    background: #0f172a;
    color: #64748b;
}

.pipeline-step-node.status-running .pipeline-node-icon {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.5);
    animation: pipelinePulse 1.5s infinite;
}

.pipeline-step-node.status-running .pipeline-node-label {
    color: #38bdf8;
}

.pipeline-step-node.status-running .pipeline-node-status {
    color: #38bdf8;
}

.pipeline-step-node.status-success .pipeline-node-icon {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.pipeline-step-node.status-success .pipeline-node-label {
    color: #34d399;
}

.pipeline-step-node.status-success .pipeline-node-status {
    color: #10b981;
}

.pipeline-step-node.status-failed .pipeline-node-icon {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
    animation: shakeNode 0.4s ease;
}

.pipeline-step-node.status-failed .pipeline-node-label {
    color: #f87171;
}

.pipeline-step-node.status-failed .pipeline-node-status {
    color: #ef4444;
}

.pipeline-step-connector {
    flex: 1;
    height: 3px;
    background: #334155;
    position: relative;
    z-index: 1;
    margin: 0 -10px 2rem;
    transition: background 0.3s ease;
}

.pipeline-step-connector.connector-active {
    background: linear-gradient(90deg, #10b981, #38bdf8);
}

.pipeline-step-connector.connector-failed {
    background: #ef4444;
}

@keyframes pipelinePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 10px rgba(56, 189, 248, 0.4); }
    50% { transform: scale(1.08); box-shadow: 0 0 20px rgba(56, 189, 248, 0.8); }
}

@keyframes shakeNode {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* =========================================================================
   Pipeline Simulator Controls Bar
   ========================================================================= */

.pipeline-controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.85rem 1.25rem;
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 10px;
}

.pipeline-control-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.btn-pipeline-action {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    font-size: 0.86rem;
    font-weight: 700;
    border-radius: 7px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-pipeline-run {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

.btn-pipeline-run:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.45);
}

.btn-pipeline-fail-test {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
    color: #f87171;
}

.btn-pipeline-fail-test:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
}

.btn-pipeline-reset {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.25);
    color: #cbd5e1;
}

.btn-pipeline-reset:hover {
    background: rgba(148, 163, 184, 0.2);
    color: #ffffff;
}

/* =========================================================================
   Terminal Simulator & Live Execution Logs
   ========================================================================= */

.cicd-terminal-wrapper {
    background: #090d16;
    border: 1px solid #1e293b;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    margin-bottom: 2rem;
}

.cicd-terminal-header {
    background: #0f172a;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #1e293b;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cicd-terminal-dots {
    display: flex;
    gap: 6px;
}

.cicd-terminal-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
}

.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.cicd-terminal-body {
    padding: 1.25rem;
    font-family: 'JetBrains Mono', 'Fira Code', Menlo, Monaco, Consolas, monospace;
    font-size: 0.88rem;
    line-height: 1.6;
    color: #e2e8f0;
    max-height: 420px;
    min-height: 240px;
    overflow-y: auto;
}

.log-entry {
    margin-bottom: 0.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.log-ts {
    color: #475569;
    font-size: 0.78rem;
    user-select: none;
    min-width: 65px;
}

.log-badge-info { color: #38bdf8; font-weight: 700; }
.log-badge-success { color: #34d399; font-weight: 700; }
.log-badge-warn { color: #fbbf24; font-weight: 700; }
.log-badge-error { color: #f87171; font-weight: 700; }

.log-command {
    color: #f1f5f9;
    font-weight: 600;
}

/* Quick Chips */
.cicd-quick-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.65rem 1rem;
    background: #0d1322;
    border-top: 1px solid #1e293b;
}

.cicd-chip-btn {
    font-size: 0.76rem;
    font-family: monospace;
    background: #1e293b;
    border: 1px solid #334155;
    color: #94a3b8;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cicd-chip-btn:hover {
    color: #38bdf8;
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}

/* Interactive Input Bar */
.cicd-terminal-input-bar {
    display: flex;
    align-items: center;
    background: #0f172a;
    border-top: 1px solid #1e293b;
    padding: 0.5rem 0.85rem;
    gap: 0.6rem;
}

.cicd-terminal-prompt-label {
    font-family: monospace;
    font-size: 0.82rem;
    font-weight: 700;
    color: #c084fc;
    white-space: nowrap;
}

.cicd-terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #f1f5f9;
    font-family: monospace;
    font-size: 0.86rem;
}

/* =========================================================================
   Interactive YAML Workflow Inspector & Editor
   ========================================================================= */

.yaml-studio-card {
    background: var(--bg-card, #ffffff);
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    padding: 1.75rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.yaml-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    flex-wrap: wrap;
}

.yaml-tab-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 700;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.yaml-tab-btn:hover {
    color: #8b5cf6;
    border-color: #8b5cf6;
}

.yaml-tab-btn.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.15));
    border-color: #8b5cf6;
    color: #8b5cf6;
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.2);
}

textarea#yaml-editor-textarea.yaml-editor-textarea,
[data-theme="light"] textarea#yaml-editor-textarea.yaml-editor-textarea,
[data-theme="dark"] textarea#yaml-editor-textarea.yaml-editor-textarea,
[data-time-phase="day"] textarea#yaml-editor-textarea.yaml-editor-textarea,
[data-time-phase="night"] textarea#yaml-editor-textarea.yaml-editor-textarea {
    width: 100% !important;
    min-height: 200px;
    background: #090d16 !important;
    background-color: #090d16 !important;
    border: 1px solid #1e293b !important;
    border-radius: 10px !important;
    color: #ffffff !important;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace !important;
    font-size: 0.88rem !important;
    line-height: 1.65 !important;
    padding: 1.25rem !important;
    resize: none !important;
    overflow-y: hidden !important;
    overflow-x: auto !important;
    tab-size: 2 !important;
    -moz-tab-size: 2 !important;
    caret-color: #38bdf8 !important;
    box-sizing: border-box !important;
    white-space: pre !important;
    outline: none !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45) !important;
}

textarea#yaml-editor-textarea.yaml-editor-textarea:focus,
[data-theme="light"] textarea#yaml-editor-textarea.yaml-editor-textarea:focus,
[data-time-phase="day"] textarea#yaml-editor-textarea.yaml-editor-textarea:focus {
    border-color: #8b5cf6 !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3) !important;
}

.yaml-validation-output {
    margin-top: 0.75rem;
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    font-size: 0.84rem;
    font-weight: 600;
    display: none;
}

.yaml-validation-output.valid {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
    display: block;
}

.yaml-validation-output.invalid {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    display: block;
}

/* YAML Virtual Runner Output Terminal & Action Styles */
.yaml-code-footer-bar {
    border-top: 1px dashed var(--border-color, #334155);
}

.yaml-execution-container {
    animation: yamlOutputSlideIn 0.25s ease-out;
}

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

.yaml-runner-terminal::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.yaml-runner-terminal::-webkit-scrollbar-track {
    background: #090d16;
}

.yaml-runner-terminal::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 4px;
}

.yaml-runner-terminal::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* Dual Mode Toggle & YAML Explanation Blueprint Styles */
.yaml-mode-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.4rem 0.95rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.yaml-mode-btn:hover {
    color: var(--text-primary);
}

.yaml-mode-btn.active {
    background: var(--bg-card, #ffffff);
    color: #8b5cf6;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.12);
}

.yaml-explain-container {
    background: var(--bg-primary, #0f172a);
    border: 1px solid var(--border-color, #1e293b);
    border-radius: 10px;
    padding: 1.5rem;
    color: var(--text-primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.yaml-explain-banner {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(6, 182, 212, 0.08));
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.yaml-explain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.yaml-explain-card-inner {
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
}

.yaml-explain-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.yaml-explain-list {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.yaml-explain-list li {
    margin-bottom: 0.4rem;
}

.yaml-explain-code-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    background: rgba(139, 92, 246, 0.15);
    color: #a855f7;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

/* =========================================================================
   CI/CD Sub-Tabs & Directives Directory
   ========================================================================= */

.cicd-tabs-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 0.85rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.cicd-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.cicd-tab-btn:hover {
    color: #c084fc;
    border-color: rgba(168, 85, 247, 0.4);
}

.cicd-tab-btn.active {
    background: rgba(168, 85, 247, 0.15);
    border-color: #8b5cf6;
    color: #c084fc;
    font-weight: 700;
}

.cicd-tab-content {
    animation: fadeIn 0.2s ease-in-out;
}

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

.cicd-directive-card {
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.cicd-directive-card:hover {
    border-color: #8b5cf6;
    transform: translateY(-2px);
    box-shadow: 0 4px 18px rgba(139, 92, 246, 0.15);
}

.cicd-directive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.cicd-directive-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.cicd-directive-badge {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    background: rgba(139, 92, 246, 0.15);
    color: #c084fc;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.cicd-directive-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.cicd-directive-code {
    background: #090d16;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: #e2e8f0;
    overflow-x: auto;
}

/* CI/CD Masterclass Quiz Styling */
.cicd-quiz-card {
    background: #111827;
    border: 1.5px solid #2d3b52;
    border-radius: 12px;
    padding: 1.35rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: all 0.2s ease;
}

.cicd-quiz-card.answered-correct {
    border-color: #10b981;
    background: linear-gradient(135deg, #111827, #062419);
}

.cicd-quiz-card.answered-wrong {
    border-color: #ef4444;
    background: linear-gradient(135deg, #111827, #240b0e);
}

.cicd-quiz-qhead {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
}

.cicd-quiz-qnum {
    font-size: 0.78rem;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid #38bdf8;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.cicd-quiz-qtitle {
    color: #ffffff !important;
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0 0 1rem;
    line-height: 1.5;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.cicd-quiz-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.75rem;
}

.cicd-quiz-btn {
    background: #1e293b;
    border: 1.5px solid #475569;
    color: #ffffff !important;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    transition: all 0.15s ease;
}

.cicd-quiz-btn:hover:not(:disabled) {
    background: #0f172a;
    border-color: #38bdf8;
    color: #38bdf8 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2);
}

.cicd-quiz-opt-tag {
    background: #0f172a;
    border: 1px solid #38bdf8;
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
    color: #38bdf8;
    flex-shrink: 0;
}

.cicd-quiz-btn.correct {
    background: #064e3b !important;
    border-color: #34d399 !important;
    color: #ffffff !important;
    font-weight: 800;
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.35);
}

.cicd-quiz-btn.correct .cicd-quiz-opt-tag {
    background: #10b981;
    color: #ffffff;
    border-color: #34d399;
}

.cicd-quiz-btn.wrong {
    background: #7f1d1d !important;
    border-color: #f87171 !important;
    color: #ffffff !important;
    font-weight: 800;
}

.cicd-quiz-btn.wrong .cicd-quiz-opt-tag {
    background: #ef4444;
    color: #ffffff;
    border-color: #f87171;
}

.cicd-quiz-explain {
    margin-top: 1rem;
    padding: 0.85rem 1.15rem;
    background: #090e1a;
    border-left: 4px solid #38bdf8;
    border-radius: 0 8px 8px 0;
    font-size: 0.88rem;
    color: #e2e8f0 !important;
    line-height: 1.6;
    display: none;
}

.cicd-quiz-explain.visible {
    display: block;
    animation: cicdFade 0.2s ease-out;
}
