/* --- Style Isolation and Reset for Business Simulator Plugin --- */
#bsim-root, #bsim-root div, #bsim-root span, #bsim-root h1, #bsim-root h2, #bsim-root h3, #bsim-root p, #bsim-root button, #bsim-root input, #bsim-root textarea, #bsim-root label {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#bsim-root {
    --SH-bg-start: #0f0c29;
    --SH-bg-mid: #302b63;
    --SH-bg-end: #24243e;
    --SH-glass-bg: rgba(255, 255, 255, 0.08);
    --SH-glass-border: rgba(255, 255, 255, 0.15);
    --SH-text-primary: #f0f2f5;
    --SH-text-secondary: #a8a2d2;
    --SH-text-muted: #8c85b9;
    --SH-accent-primary-start: #8e2de2;
    --SH-accent-primary-end: #4a00e0;
    --SH-accent-secondary-start: #10b981;
    --SH-accent-secondary-end: #059669;
    --SH-radius-sm: 0.5rem;
    --SH-radius-md: 0.75rem;
    --SH-radius-lg: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Vazirmatn", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(-45deg, var(--SH-bg-start), var(--SH-bg-mid), var(--SH-bg-end));
    background-size: 400% 400%;
    animation: bsim-gradientBG 15s ease infinite;
    color: var(--SH-text-primary);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    border-radius: var(--SH-radius-lg);
    direction: rtl;
}

@keyframes bsim-gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
#bsim-root .SH-app-container { width: 100%; max-width: 900px; margin: 2rem 0; }
#bsim-root .SH-game-container { transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
#bsim-root .SH-game-card {
    background: var(--SH-glass-bg);
    border: 1px solid var(--SH-glass-border);
    border-radius: var(--SH-radius-lg);
    padding: 2.5rem 3rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    animation: bsim-fadeIn 0.8s ease forwards;
}
@media (max-width: 768px) { #bsim-root .SH-game-card { padding: 2rem 1.5rem; } }
@keyframes bsim-fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Typography Resets within the plugin */
#bsim-root .bsim-h1, #bsim-root .SH-hero-title { font-size: 2.5rem; font-weight: 800; margin-bottom: 0.5rem; line-height: 1.2; }
#bsim-root .bsim-h2, #bsim-root .SH-scenario-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 1rem; line-height: 1.3; }
#bsim-root .bsim-h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: 1rem; line-height: 1.4; }
#bsim-root .bsim-p, #bsim-root .SH-hero-subtitle, #bsim-root .SH-scenario-description { font-size: 1.1rem; line-height: 1.8; }
#bsim-root .bsim-span { display: inline-block; }

#bsim-root .SH-hero-title { background: linear-gradient(90deg, #c7c5d0, #ffffff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
#bsim-root .SH-hero-subtitle { color: var(--SH-text-secondary); max-width: 500px; margin: 0 auto; }

/* General utility classes */
#bsim-root .bsim-text-center { text-align: center; }
#bsim-root .bsim-mb-3 { margin-bottom: 0.75rem; }
#bsim-root .bsim-mb-4 { margin-bottom: 1rem; }
#bsim-root .bsim-mb-6 { margin-bottom: 1.5rem; }
#bsim-root .bsim-mb-8 { margin-bottom: 2rem; }
#bsim-root .bsim-mb-10 { margin-bottom: 2.5rem; }
#bsim-root .bsim-mt-2 { margin-top: 0.5rem; }
#bsim-root .bsim-mt-4 { margin-top: 1rem; }
#bsim-root .bsim-mt-8 { margin-top: 2rem; }
#bsim-root .bsim-my-8 { margin-top: 2rem; margin-bottom: 2rem; }
#bsim-root .bsim-mx-auto { margin-left: auto; margin-right: auto; }
#bsim-root .bsim-px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
#bsim-root .bsim-p-4 { padding: 1rem; }
#bsim-root .bsim-p-8 { padding: 2rem; }
#bsim-root .bsim-max-w-xl { max-width: 36rem; }
#bsim-root .bsim-flex { display: flex; }
#bsim-root .bsim-flex-col { flex-direction: column; }
#bsim-root .bsim-justify-between { justify-content: space-between; }
#bsim-root .bsim-justify-center { justify-content: center; }
#bsim-root .bsim-items-center { align-items: center; }
#bsim-root .bsim-gap-2 { gap: 0.5rem; }
#bsim-root .bsim-gap-4 { gap: 1rem; }
#bsim-root .bsim-flex-wrap { flex-wrap: wrap; }
@media (min-width: 640px) { #bsim-root .sm\:bsim-flex-row { flex-direction: row; } }

#bsim-root .bsim-text-secondary { color: var(--SH-text-secondary); }
#bsim-root .bsim-text-muted { color: var(--SH-text-muted); }
#bsim-root .bsim-text-red-400 { color: #f87171; }
#bsim-root .bsim-text-red-500 { color: #ef4444; }

/* Components */
#bsim-root .SH-btn {
    appearance: none; -webkit-appearance: none;
    background: linear-gradient(90deg, var(--SH-accent-primary-start), var(--SH-accent-primary-end));
    color: white; padding: 1rem 2.5rem; border-radius: var(--SH-radius-md); font-size: 1.1rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); display: inline-flex; align-items: center; gap: 0.75rem; justify-content: center;
}
#bsim-root .SH-btn:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(74, 0, 224, 0.4); }
#bsim-root .SH-btn:disabled { opacity: 0.5; cursor: not-allowed; }
#bsim-root .SH-btn-secondary { background: var(--SH-glass-bg); }
#bsim-root .SH-btn-success { background: linear-gradient(90deg, var(--SH-accent-secondary-start), var(--SH-accent-secondary-end)); }

#bsim-root .SH-input, #bsim-root textarea {
    appearance: none; -webkit-appearance: none;
    width: 100%; background: rgba(0, 0, 0, 0.2); border: 1px solid var(--SH-glass-border); border-radius: var(--SH-radius-md);
    padding: 1.25rem; color: var(--SH-text-primary); font-size: 1.1rem; transition: all 0.3s ease; line-height: 1.5;
}
#bsim-root .SH-input::placeholder, #bsim-root textarea::placeholder { color: var(--SH-text-muted); }
#bsim-root .SH-input:focus, #bsim-root textarea:focus { outline: none; border-color: rgba(142, 45, 226, 0.7); box-shadow: 0 0 0 3px rgba(142, 45, 226, 0.3); }

#bsim-root .SH-suggestion-item {
    width: 100%; background: var(--SH-glass-bg); border: 1px solid transparent; border-radius: var(--SH-radius-md); padding: 0.75rem 1.5rem;
    color: var(--SH-text-secondary); cursor: pointer; transition: all 0.3s ease; font-family: inherit; font-size: 0.95rem; text-align: right;
}
#bsim-root .SH-suggestion-item:hover { background: rgba(255, 255, 255, 0.15); border-color: var(--SH-glass-border); color: var(--SH-text-primary); transform: translateY(-2px); }

#bsim-root .SH-loading-container { text-align: center; padding: 2rem 0; }
#bsim-root .SH-loading-spinner { width: 60px; height: 60px; border: 5px solid var(--SH-glass-border); border-top-color: #fff; border-radius: 50%; animation: bsim-spin 1s linear infinite; margin: 0 auto 2rem; }
#bsim-root .SH-mini-spinner { width: 20px; height: 20px; border: 2px solid var(--SH-glass-border); border-top-color: #fff; border-radius: 50%; animation: bsim-spin 0.8s linear infinite; margin: 0 auto; }
@keyframes bsim-spin { to { transform: rotate(360deg); } }

#bsim-root .SH-scenario-progress { width: 100%; height: 8px; background: rgba(0, 0, 0, 0.2); border-radius: 50px; overflow: hidden; margin-top: 1rem; }
#bsim-root .SH-scenario-progress-bar { height: 100%; background: linear-gradient(90deg, var(--SH-accent-primary-start), var(--SH-accent-primary-end)); border-radius: 50px; transition: width 0.5s ease; }
#bsim-root .SH-options-grid { display: grid; gap: 1rem; }
#bsim-root .SH-option-card { background: rgba(0, 0, 0, 0.15); border: 1px solid var(--SH-glass-border); border-radius: var(--SH-radius-md); padding: 1.5rem; display: flex; align-items: center; cursor: pointer; transition: all 0.3s ease; }
#bsim-root .SH-option-card:hover { background: rgba(142, 45, 226, 0.2); border-color: rgba(142, 45, 226, 0.7); transform: translateX(-5px); }
#bsim-root .SH-option-number { font-weight: 700; font-size: 1.2rem; color: var(--SH-text-primary); margin-left: 1.5rem; min-width: 20px; }
#bsim-root .SH-option-text { color: var(--SH-text-secondary); flex-grow: 1; }

#bsim-root .SH-scores-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 2.5rem; border-top: 1px solid var(--SH-glass-border); padding-top: 2rem; }
@media (max-width: 768px) { #bsim-root .SH-scores-container { grid-template-columns: 1fr; gap: 1rem; } }
#bsim-root .SH-score-card { text-align: center; background: rgba(0, 0, 0, 0.1); padding: 1.5rem; border-radius: var(--SH-radius-md); }
#bsim-root .SH-score-value { font-size: 2rem; font-weight: 700; margin-bottom: 0.25rem; }
#bsim-root .SH-score-label { font-size: 0.9rem; color: var(--SH-text-secondary); }

#bsim-root .SH-feedback-result, #bsim-root .SH-feedback-explanation { background: rgba(0, 0, 0, 0.15); border-radius: var(--SH-radius-md); padding: 1.5rem; margin-bottom: 1.5rem; border-left: 4px solid; }
#bsim-root .SH-feedback-result { border-color: #f59e0b; }
#bsim-root .SH-feedback-explanation { border-color: #3b82f6; }
#bsim-root #SH-ai-advice-container { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--SH-glass-border); }
#bsim-root #SH-ai-advice-content { background: rgba(0, 0, 0, 0.2); border-radius: var(--SH-radius-md); padding: 1.5rem; margin-top: 1rem; color: var(--SH-text-secondary); line-height: 1.8; white-space: pre-wrap; }

#bsim-root .SH-performance-badge { display: inline-block; padding: 0.5rem 1.5rem; border-radius: 50px; font-weight: 600; margin: 1rem 0; }
#bsim-root .SH-performance-excellent { background: linear-gradient(90deg, #10b981, #059669); color: white; }
#bsim-root .SH-performance-good { background: linear-gradient(90deg, #3b82f6, #2563eb); color: white; }
#bsim-root .SH-performance-average { background: linear-gradient(90deg, #f59e0b, #d97706); color: white; }
#bsim-root .SH-performance-poor { background: linear-gradient(90deg, #ef4444, #dc2626); color: white; }
#bsim-root #SH-final-analysis-container { margin-top: 2rem; padding: 1.5rem; background: rgba(0,0,0,0.2); border-radius: var(--SH-radius-md); }
#bsim-root #SH-final-analysis-content { white-space: pre-wrap; line-height: 1.9; color: var(--SH-text-secondary); }

/* Notification needs to be outside the root to be fixed to viewport */
.SH-notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translate(-50%, 150%);
    background: #2d3748;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--SH-radius-md);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 99999;
    border: 1px solid var(--SH-glass-border);
    backdrop-filter: blur(10px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Vazirmatn", Roboto, Helvetica, Arial, sans-serif;
    direction: rtl;
}
.SH-notification.show { transform: translate(-50%, 0); }
.SH-notification span { font-family: inherit; }


/* Tag style for stage indicator */
#bsim-root .bsim-tag {
    background: rgba(168, 85, 247, 0.2); 
    color: #c084fc; 
    font-size: 0.875rem; 
    font-weight: 600; 
    padding: 0.25rem 1rem; 
    border-radius: 9999px;
}