/* =========================================================
   AILEARNIST — PLAYGROUND CORE (every ported playground page)
   The playgrounds keep their own component CSS (scoped under
   .pg-scope in tools/{slug}.css). This file maps their design
   variables onto the ailearnist / sqlism studio tokens so the
   playgrounds follow the site theme (light + dark), and
   restyles the shared surfaces (.glass panels, buttons) as
   sqlism-style studio cards. `.tool-page .pg-scope` gives these
   rules one extra class of specificity over the tool files.
   ========================================================= */
.tool-page { --pg-card: var(--bg-card); --pg-bg: var(--bg); --pg-alt: var(--bg-alt); }
.tool-page .pg-scope {
  --bg-primary: var(--pg-bg);
  --bg-container: var(--pg-card);
  --bg-subtle: var(--pg-alt);
  --bg-card: color-mix(in srgb, var(--text) 3%, transparent);
  --background-secondary: var(--pg-alt);
  --card-background: var(--pg-card);
  --input-background: var(--pg-bg);
  --text-primary: var(--text);
  --text-secondary: var(--text-muted);
  --border-color: var(--border);
  --border-focus: #7c5cff;
  --accent-primary: #7c5cff;
  --accent-secondary: #5b3fd9;
  --accent-tertiary: #22d3ee;
  --accent-success: var(--success);
  --primary-color: #7c5cff;
  --primary-color-dark: #5b3fd9;
  --primary-color-rgb: 124, 92, 255;
  --primary-color-alpha: rgba(124, 92, 255, .12);
  --secondary-color: #22d3ee;
  --secondary-color-dark: #0891b2;
  --secondary-color-rgb: 34, 211, 238;
  --accent-color: #a3e635;
  --accent-color-dark: #65a30d;
  --accent-color-rgb: 163, 230, 53;
  --success-color: var(--success);
  --warning-color: var(--warning);
  --shadow-light: 0 2px 8px rgba(15, 23, 42, .06);
  --shadow-medium: 0 18px 44px -20px rgba(10, 13, 26, .22);
  --shadow-large: 0 30px 70px -28px rgba(10, 13, 26, .32);
  --shadow-glass: 0 18px 44px -20px rgba(10, 13, 26, .22);
  --gradient-primary: linear-gradient(135deg, #7c5cff 0%, #5b3fd9 100%);
  --gradient-secondary: linear-gradient(135deg, #22d3ee 0%, #7c5cff 100%);
  --gradient-tertiary: linear-gradient(135deg, #a3e635 0%, #22d3ee 100%);
  color: var(--text);
  font-family: var(--font-body);
}
[data-theme="dark"] .tool-page .pg-scope {
  --shadow-light: 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-medium: 0 18px 44px -20px rgba(0, 0, 0, .5);
  --shadow-large: 0 32px 76px -28px rgba(0, 0, 0, .6);
  --shadow-glass: 0 18px 44px -20px rgba(0, 0, 0, .5);
}
.tool-page .pg-scope [hidden] { display: none !important; }
.tool-page .pg-scope .floating-particles { display: none !important; }

/* page frame — same width/padding as the sqlism tool pages */
.tool-page .pg-scope > .container,
.tool-page .pg-scope > .playground-container,
.tool-page .pg-scope > div > .container {
  max-width: 1400px; min-height: 0; margin: 0 auto; padding: 2.2rem clamp(14px, 3vw, 2rem) 3rem;
}

/* .glass panels → studio cards */
.tool-page .pg-scope .glass {
  background: var(--pg-card);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 18px 44px -20px rgba(10, 13, 26, .22);
}
[data-theme="dark"] .tool-page .pg-scope .glass { background: var(--pg-card); border-color: var(--border); box-shadow: 0 18px 44px -20px rgba(0, 0, 0, .5); }
.tool-page .pg-scope .glass::before {
  height: 3px; opacity: .7;
  background: linear-gradient(90deg, #a3e635, #22d3ee 55%, #7c5cff);
}
.tool-page .pg-scope .glass:hover { transform: none; }

/* headings inside playgrounds use the site font + colour */
.tool-page .pg-scope h1, .tool-page .pg-scope h2, .tool-page .pg-scope h3, .tool-page .pg-scope h4 { font-family: var(--font-head); color: var(--text); letter-spacing: -.01em; }

/* buttons shared across playgrounds */
.tool-page .pg-scope .btn { padding: .75rem 1.4rem; border-radius: 12px; font: 600 .95rem var(--font-body); text-decoration: none; transition: all .25s ease; position: relative; overflow: hidden; border: none; cursor: pointer; }
.tool-page .pg-scope .btn-primary { background: #111827; color: #fff; box-shadow: 0 10px 22px -10px rgba(0, 0, 0, .45); }
.tool-page .pg-scope .btn-primary:hover { background: #000; transform: translateY(-2px); }
[data-theme="dark"] .tool-page .pg-scope .btn-primary { background: #f9fafb; color: #111827; }
.tool-page .pg-scope .btn-secondary { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.tool-page .pg-scope .btn-secondary:hover { border-color: #7c5cff; color: #7c5cff; transform: translateY(-2px); }

/* form controls follow the theme */
.tool-page .pg-scope textarea, .tool-page .pg-scope input[type="text"], .tool-page .pg-scope input[type="number"], .tool-page .pg-scope select {
  font-family: inherit; color: var(--text);
}
.tool-page .pg-scope input[type="range"] { accent-color: #7c5cff; }
.tool-page .pg-scope code, .tool-page .pg-scope pre { font-family: var(--font-mono); }

@media (max-width: 640px) {
  .tool-page .pg-scope > .container,
  .tool-page .pg-scope > .playground-container { padding: 1.4rem 12px 2rem; }
}
/* PlayGenAI Icon System - Consistent & Elegant Icons */
/* Designed for light/dark mode compatibility */

/* Base Icon Styles */
.pg-scope .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--icon-color-secondary);
    fill: none;
    stroke: currentColor;
    stroke-width: var(--icon-stroke-width);
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

/* Icon Sizes */
.pg-scope .icon-xs { width: 12px; height: 12px; }
.pg-scope .icon-sm { width: 16px; height: 16px; }
.pg-scope .icon-md { width: 20px; height: 20px; }
.pg-scope .icon-lg { width: 24px; height: 24px; }
.pg-scope .icon-xl { width: 28px; height: 28px; }
.pg-scope .icon-2xl { width: 32px; height: 32px; }

/* Icon Colors */
.pg-scope .icon-primary { color: var(--icon-color-primary); }
.pg-scope .icon-secondary { color: var(--icon-color-secondary); }
.pg-scope .icon-muted { color: var(--icon-color-muted); }
.pg-scope .icon-accent { color: var(--icon-color-accent); }
.pg-scope .icon-success { color: var(--icon-color-success); }
.pg-scope .icon-warning { color: var(--icon-color-warning); }
.pg-scope .icon-error { color: var(--icon-color-error); }

/* Icon States */
.pg-scope .icon:hover { 
    color: var(--icon-color-accent);
    transform: scale(1.05);
}

.pg-scope .icon-interactive {
    cursor: pointer;
    transition: all 0.2s ease;
}

.pg-scope .icon-interactive:hover {
    color: var(--icon-color-accent);
    transform: scale(1.1);
}

.pg-scope .icon-interactive:active {
    transform: scale(0.95);
}

/* Icon Stroke Weights */
.pg-scope .icon-thin { stroke-width: 1; }
.pg-scope .icon-normal { stroke-width: var(--icon-stroke-width); }
.pg-scope .icon-bold { stroke-width: var(--icon-stroke-width-bold); }

/* Specific Icon Components */

/* Navigation Icons */
.pg-scope .nav-icon {
    width: 20px;
    height: 20px;
    color: var(--icon-color-secondary);
}

/* Breadcrumb Icons */
.pg-scope .breadcrumb-icon {
    width: 16px;
    height: 16px;
    color: var(--icon-color-muted);
}

.pg-scope .breadcrumb-home-icon {
    width: 14px;
    height: 14px;
    color: var(--icon-color-muted);
}

/* Theme Toggle Icons */
.pg-scope .theme-icon {
    width: 18px;
    height: 18px;
    color: var(--icon-color-secondary);
    transition: all 0.3s ease;
}

.pg-scope .theme-icon.active {
    color: var(--icon-color-accent);
    transform: scale(1.1);
}

/* Section Icons */
.pg-scope .section-icon {
    width: 24px;
    height: 24px;
    color: var(--icon-color-accent);
    margin-right: 0.75rem;
}

/* Feature Icons */
.pg-scope .feature-icon {
    width: 32px;
    height: 32px;
    color: var(--icon-color-accent);
    margin-bottom: 1rem;
}

/* Social Icons */
.pg-scope .social-icon {
    width: 18px;
    height: 18px;
    color: var(--icon-color-secondary);
    transition: all 0.3s ease;
}

.pg-scope .social-icon:hover {
    color: var(--icon-color-accent);
    transform: scale(1.1);
}

/* Tool Icons */
.pg-scope .tool-icon {
    width: 40px;
    height: 40px;
    color: var(--icon-color-accent);
    stroke-width: 1.5;
}

/* Status Icons */
.pg-scope .status-icon-success { color: var(--icon-color-success); }
.pg-scope .status-icon-warning { color: var(--icon-color-warning); }
.pg-scope .status-icon-error { color: var(--icon-color-error); }

/* Icon Animations */
@keyframes iconSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes iconPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.pg-scope .icon-spin { animation: iconSpin 2s linear infinite; }
.pg-scope .icon-pulse { animation: iconPulse 2s ease-in-out infinite; }
.pg-scope .icon-bounce { animation: iconBounce 1s ease-in-out infinite; }

/* Icon Backgrounds */
.pg-scope .icon-bg {
    background: var(--bg-card, rgba(255, 255, 255, 0.1));
    border-radius: 8px;
    padding: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.pg-scope .icon-bg-circle {
    background: var(--bg-card, rgba(255, 255, 255, 0.1));
    border-radius: 50%;
    padding: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.pg-scope .icon-bg-accent {
    background: var(--icon-color-accent);
    border-radius: 8px;
    padding: 8px;
    color: white;
}

.pg-scope .icon-bg-accent .icon {
    color: white;
}

/* Responsive Icon Adjustments */
@media (max-width: 768px) {
    .pg-scope .feature-icon { width: 28px; height: 28px; }
    .pg-scope .tool-icon { width: 32px; height: 32px; }
    .pg-scope .section-icon { width: 20px; height: 20px; }
}

@media (max-width: 480px) {
    .pg-scope .feature-icon { width: 24px; height: 24px; }
    .pg-scope .tool-icon { width: 28px; height: 28px; }
    .pg-scope .section-icon { width: 18px; height: 18px; }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .pg-scope .icon,
    .pg-scope .icon-interactive,
    .pg-scope .theme-icon,
    .pg-scope .social-icon {
        transition: none;
    }
    
    .pg-scope .icon-spin,
    .pg-scope .icon-pulse,
    .pg-scope .icon-bounce {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .pg-scope .icon {
        color: #000 !important;
        stroke: #000;
    }
    
    .pg-scope .icon-bg,
    .pg-scope .icon-bg-circle,
    .pg-scope .icon-bg-accent {
        background: transparent !important;
        border: 1px solid #000 !important;
    }
}

/* High Contrast Support */
@media (prefers-contrast: high) {
    .pg-scope .icon {
        stroke-width: var(--icon-stroke-width-bold);
    }
    
    .pg-scope .icon-bg,
    .pg-scope .icon-bg-circle {
        border-width: 2px;
    }
}

/* Icon Utility Classes */
.pg-scope .icon-inline { display: inline-flex; vertical-align: middle; }
.pg-scope .icon-block { display: block; }
.pg-scope .icon-center { margin: 0 auto; }
.pg-scope .icon-left { margin-right: 0.5rem; }
.pg-scope .icon-right { margin-left: 0.5rem; }

/* Icon Groups */
.pg-scope .icon-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pg-scope .icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 1rem;
    align-items: center;
    justify-items: center;
}

/* Specific Page Icon Overrides */
.pg-scope .header .icon { color: var(--icon-color-secondary); }
.pg-scope .footer .icon { color: var(--icon-color-muted); }
.pg-scope .breadcrumb-navigation .icon { color: var(--icon-color-muted); }

/* Focus States for Accessibility */
.pg-scope .icon-interactive:focus {
    outline: 2px solid var(--icon-color-accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Loading State Icons */
.pg-scope .icon-loading {
    opacity: 0.6;
    animation: iconSpin 1s linear infinite;
}

/* Disabled State Icons */
.pg-scope .icon-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Icon with Text Combinations */
.pg-scope .icon-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.pg-scope .icon-text .icon {
    flex-shrink: 0;
}

/* Card Header Icons */
.pg-scope .card-header .icon {
    width: 20px;
    height: 20px;
    color: var(--icon-color-accent);
    margin-right: 0.5rem;
}

/* List Item Icons */
.pg-scope .list-item .icon {
    width: 16px;
    height: 16px;
    color: var(--icon-color-accent);
    margin-right: 0.75rem;
    flex-shrink: 0;
}

/* Button Icons */
.pg-scope .btn .icon {
    width: 18px;
    height: 18px;
    margin-right: 0.5rem;
}

.pg-scope .btn .icon:last-child {
    margin-right: 0;
    margin-left: 0.5rem;
}
/* "fixed-actions" (Help / Reset / Export…) were floating buttons on the
   right edge in PlayGenAI; on ailearnist they sit inline as a toolbar so
   they never cover the share / back-to-top buttons. */
.tool-page .pg-scope .fixed-actions {
  position: static; inset: auto; transform: none; z-index: auto;
  display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 10px;
  margin: 1.5rem auto; padding: 14px; border: 1px dashed var(--border); border-radius: 16px; background: var(--pg-alt);
}
.tool-page .pg-scope .fixed-actions .btn { box-shadow: none; padding: .6rem 1.1rem; font-size: .88rem; border-radius: 12px; }

/* keep every playground inside the viewport on phones */
.tool-page .pg-scope textarea, .tool-page .pg-scope input, .tool-page .pg-scope select { max-width: 100%; min-width: 0; box-sizing: border-box; }
.tool-page .pg-scope .main-content > *, .tool-page .pg-scope [class*="grid"] > *, .tool-page .pg-scope [class*="container"] > * { min-width: 0; }
.tool-page .pg-scope pre, .tool-page .pg-scope code { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .tool-page .pg-scope .glass { padding: 18px 14px; border-radius: 18px; }
  .tool-page .pg-scope .main-content { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------
   Icons: the playgrounds used colourful emoji; they now use the
   site's Font Awesome set as single-colour glyphs. Markup is
   <i class=fa-NAME aria-hidden=true></i> (one class so it is safe
   inside any JS string); these rules give it the solid FA font.
   --------------------------------------------------------------- */
.tool-page .pg-scope i[class^="fa-"] {
  font-family: "Font Awesome 6 Free"; font-weight: 900; font-style: normal; font-variant: normal;
  line-height: 1; display: inline-block; text-rendering: auto; -webkit-font-smoothing: antialiased;
  font-size: .9em; vertical-align: -.05em;
}
.tool-page .pg-scope :is(h1, h2, h3, h4, h5, .section-title, .panel-title, [class*="title"], [class*="header"], [class*="icon"]) > i[class^="fa-"] { color: #7c5cff; }
[data-theme="dark"] .tool-page .pg-scope :is(h1, h2, h3, h4, h5, .section-title, .panel-title, [class*="title"], [class*="header"], [class*="icon"]) > i[class^="fa-"] { color: #a78bfa; }
.tool-page .pg-scope [class*="icon"]:not(svg) { filter: none; }
.tool-page .pg-scope [class*="icon"] > i[class^="fa-"] { font-size: .8em; }
.tool-page .pg-scope .btn i[class^="fa-"], .tool-page .pg-scope button i[class^="fa-"] { color: inherit; margin-right: .15em; }
.tool-page .pg-scope .section-icon, .tool-page .pg-scope svg.icon { color: #7c5cff; }
[data-theme="dark"] .tool-page .pg-scope .section-icon, [data-theme="dark"] .tool-page .pg-scope svg.icon { color: #a78bfa; }
