/* STEMAura Simulator Floating Instruction Guide Modal CSS - Premium Edition */

.tutorial-sidebar {
    position: fixed;
    top: 60px;
    right: 20px;
    left: auto;
    bottom: auto;
    transform: none;
    width: 450px;
    max-width: calc(100vw - 36px);
    max-height: calc(100vh - 76px);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    color: #f1f5f9;
    display: flex;
    flex-direction: column;
    z-index: 99999;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.tutorial-sidebar-header {
    padding: 0.9rem 1.15rem;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
    user-select: none;
}

.tut-toggle-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f3f4f6;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.tut-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.tutorial-sidebar-content {
    flex: 1;
    padding: 1.15rem;
    overflow-y: auto;
}

.tutorial-sidebar-content::-webkit-scrollbar {
    width: 5px;
}
.tutorial-sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}
.tutorial-sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
.tutorial-sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Meta Card & Progress Bar */
.tut-meta-card {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.7) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.tut-course-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.2rem 0.65rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(79, 70, 229, 0.15));
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.45rem;
}

.tut-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0.2rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.tut-subtitle {
    font-size: 0.88rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 0.65rem;
}

.tut-progress-wrapper {
    margin-top: 6px;
}

.tut-progress-tag {
    font-size: 0.78rem;
    color: #38bdf8;
    font-weight: 700;
}

.tut-progress-bar-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    overflow: hidden;
    margin-top: 4px;
}

.tut-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #6366f1, #818cf8);
    border-radius: 9999px;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.tut-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    margin: 1rem 0;
}

/* Modern Segmented Tab Bar */
.tut-segmented-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    background: rgba(15, 23, 42, 0.85);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.tut-tab-pill {
    flex: 1;
    padding: 7px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    user-select: none;
}

.tut-tab-pill:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
}

.tut-tab-pill.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    font-weight: 700;
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

/* Step Cards */
.tut-step-box {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.75) 0%, rgba(15, 23, 42, 0.85) 100%);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.tut-step-box:hover {
    border-color: rgba(99, 102, 241, 0.35);
}

.tut-step-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.tut-step-pill {
    font-size: 0.7rem;
    font-weight: 800;
    color: #818cf8;
    background: rgba(99, 102, 241, 0.18);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 6px;
    padding: 2px 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tut-step-heading {
    font-weight: 700;
    font-size: 0.95rem;
    color: #ffffff;
    margin-bottom: 0.45rem;
    line-height: 1.4;
}

.tut-step-text {
    font-size: 0.86rem;
    color: #d1d5db;
    line-height: 1.6;
}

/* Interactive Connection Trace Card */
.tut-connection-item {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9px;
    padding: 9px 12px;
    cursor: pointer;
    font-size: 0.82rem;
    color: #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.tut-connection-item:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(56, 189, 248, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.2);
}

.tut-connection-item:active {
    transform: translateY(0);
}

.tut-conn-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.tut-chip-from {
    color: #fbbf24;
    font-weight: 600;
}

.tut-chip-to {
    color: #a78bfa;
    font-weight: 600;
}

.tut-pin-badge {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.75rem;
    font-weight: 700;
}

.tut-trace-btn {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tut-connection-item:hover .tut-trace-btn {
    background: #38bdf8;
    color: #0f172a;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

/* Hardware Locate Item */
.tut-hardware-item {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.82rem;
    color: #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    user-select: none;
}

.tut-hardware-item:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.2);
}

.tut-hardware-item:hover .tut-locate-badge {
    background: #818cf8;
    color: #ffffff;
}

.tut-locate-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.18);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

/* Step Tip Callout */
.tut-step-tip {
    margin-top: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.12) 0%, rgba(245, 158, 11, 0.04) 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    font-size: 0.82rem;
    color: #fef08a;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

/* Footer & Buttons */
.tutorial-sidebar-footer {
    padding: 1rem 1.15rem;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tut-nav-btns {
    display: flex;
    gap: 0.65rem;
    justify-content: space-between;
}

.tut-nav-btns .btn {
    flex: 1;
    padding: 8px 12px;
    font-weight: 700;
    font-size: 0.82rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.tut-nav-btns .btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
}
.tut-nav-btns .btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.tut-nav-btns .btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
.tut-nav-btns .btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.45);
}

#tut-btn-done {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 9px !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    cursor: pointer !important;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
    transition: all 0.2s ease !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

#tut-btn-done:hover:not(:disabled) {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.5) !important;
}

/* Clickable Block Preview Card */
.tut-block-preview-box {
    background: #090d16;
    border: 1px dashed #3b82f6;
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    position: relative;
    max-height: 210px;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.tut-block-preview-box:hover {
    border-color: #60a5fa;
    border-style: solid;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.25);
}
.tut-block-preview-badge {
    position: absolute;
    top: 8px;
    right: 10px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 5;
}

/* Lightbox Modal for Enlarged Block View */
.block-enlarge-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(8px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.block-enlarge-modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}
.block-enlarge-modal-content {
    background: #0f172a;
    border: 1px solid #3b82f6;
    border-radius: 16px;
    width: 780px;
    max-width: 92vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(59, 130, 246, 0.3);
    overflow: hidden;
    animation: zoomInBlockModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes zoomInBlockModal {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.block-enlarge-header {
    padding: 14px 20px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.block-enlarge-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Scratch / Blockly Arduino Program Visual Blocks */
.scratch-program-container {
    background: #2b3648;
    border-radius: 10px;
    padding: 14px 18px 20px 14px;
    width: fit-content;
    min-width: 320px;
    max-width: 100%;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.65);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    user-select: none;
}

.scratch-program-header {
    color: #ffffff;
    font-weight: 800;
    font-size: 0.95rem;
    margin-bottom: 14px;
    letter-spacing: 0.2px;
}

.scratch-scope-section {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.scratch-scope-label {
    color: #ffffff;
    font-weight: 800;
    font-size: 0.88rem;
    width: 46px;
    flex-shrink: 0;
    padding-top: 6px;
}

.scratch-scope-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
}

.scratch-block {
    position: relative;
    padding: 8px 14px 8px 16px;
    border-radius: 4px 10px 10px 4px;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.83rem;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    margin-top: -3px;
}

.scratch-block:first-child {
    margin-top: 0;
}

.scratch-block::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 14px;
    width: 18px;
    height: 6px;
    background: inherit;
    border-radius: 0 0 3px 3px;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.25);
    z-index: 2;
}

.scratch-block-orange {
    background: linear-gradient(180deg, #f4511e, #e65100);
}
.scratch-block-yellow {
    background: linear-gradient(180deg, #ff9800, #f57c00);
}
.scratch-block-amber {
    background: linear-gradient(180deg, #e65100, #d84315);
}
.scratch-block-blue {
    background: linear-gradient(180deg, #1e88e5, #1565c0);
}

.scratch-dropdown {
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    padding: 3px 9px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.scratch-dropdown-arrow {
    font-size: 0.65rem;
    opacity: 0.85;
}

.scratch-pill-string {
    background: #00897b;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.scratch-pill-num {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    padding: 3px 14px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
}

/* ========================================================= */
/* Light Mode Theme for Lesson Guide                         */
/* ========================================================= */

.tutorial-sidebar.tut-light-mode {
    background: rgba(255, 255, 255, 0.98);
    border-color: #cbd5e1;
    color: #1e293b;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.tutorial-sidebar.tut-light-mode .tutorial-sidebar-header {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid #e2e8f0;
}

.tutorial-sidebar.tut-light-mode #tut-header-title {
    color: #0f172a !important;
}

.tutorial-sidebar.tut-light-mode .tut-toggle-btn {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #334155;
}

.tutorial-sidebar.tut-light-mode .tut-toggle-btn:hover {
    background: #e2e8f0;
}

.tutorial-sidebar.tut-light-mode #tut-btn-back {
    color: #475569 !important;
}

.tutorial-sidebar.tut-light-mode #tut-btn-back:hover {
    color: #0f172a !important;
    background: #f1f5f9 !important;
}

.tutorial-sidebar.tut-light-mode #tut-btn-collapse {
    background: #f1f5f9 !important;
    color: #334155 !important;
}

.tutorial-sidebar.tut-light-mode .tut-meta-card {
    background: #f8fafc;
    border-color: #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.tutorial-sidebar.tut-light-mode .tut-course-badge {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4f46e5;
}

.tutorial-sidebar.tut-light-mode .tut-title {
    color: #0f172a;
}

.tutorial-sidebar.tut-light-mode .tut-subtitle {
    color: #475569;
}

.tutorial-sidebar.tut-light-mode .tut-progress-bar-track {
    background: #e2e8f0;
}

.tutorial-sidebar.tut-light-mode .tut-divider {
    background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
}

.tutorial-sidebar.tut-light-mode .tut-segmented-tabs {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.tutorial-sidebar.tut-light-mode .tut-tab-pill {
    color: #64748b;
}

.tutorial-sidebar.tut-light-mode .tut-tab-pill:hover {
    color: #0f172a;
    background: rgba(0, 0, 0, 0.04);
}

.tutorial-sidebar.tut-light-mode .tut-tab-pill.active {
    background: #3b82f6;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.tutorial-sidebar.tut-light-mode .tut-step-box {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.tutorial-sidebar.tut-light-mode .tut-step-box:hover {
    border-color: #cbd5e1;
}

.tutorial-sidebar.tut-light-mode .tut-step-pill {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4f46e5;
}

.tutorial-sidebar.tut-light-mode .tut-step-heading {
    color: #0f172a;
}

.tutorial-sidebar.tut-light-mode .tut-step-text {
    color: #334155;
}

.tutorial-sidebar.tut-light-mode .tut-connection-item {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #0f172a;
}

.tutorial-sidebar.tut-light-mode .tut-connection-item:hover {
    background: #f0f9ff;
    border-color: #7dd3fc;
    box-shadow: 0 4px 12px rgba(125, 211, 252, 0.25);
}

.tutorial-sidebar.tut-light-mode .tut-chip-from {
    color: #d97706;
}

.tutorial-sidebar.tut-light-mode .tut-chip-to {
    color: #7c3aed;
}

.tutorial-sidebar.tut-light-mode .tut-pin-badge {
    background: #e0f2fe;
    border-color: #bae6fd;
    color: #0284c7;
}

.tutorial-sidebar.tut-light-mode .tut-trace-btn {
    background: #e0f2fe;
    border-color: #bae6fd;
    color: #0284c7;
}

.tutorial-sidebar.tut-light-mode .tut-hardware-item {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #0f172a;
}

.tutorial-sidebar.tut-light-mode .tut-hardware-item:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.tutorial-sidebar.tut-light-mode .tut-locate-badge {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4f46e5;
}

.tutorial-sidebar.tut-light-mode .tut-step-tip {
    background: #fffbeb;
    border-color: #fde68a;
    border-left-color: #f59e0b;
    color: #92400e;
}

.tutorial-sidebar.tut-light-mode .tutorial-sidebar-footer {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-top: 1px solid #e2e8f0;
}

.tutorial-sidebar.tut-light-mode .tut-nav-btns .btn-secondary {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}
.tutorial-sidebar.tut-light-mode .tut-nav-btns .btn-secondary:hover:not(:disabled) {
    background: #e2e8f0;
    color: #0f172a;
}
