/* Visually hidden class for accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Default Light Theme Styles for template (header, footer, settings menu) */
body {
    font-family: 'Inter', sans-serif;
    background-color: #F1F5F9; /* slate-100 */
    color: #0F172A; /* slate-900 */
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    scroll-behavior: smooth;
    overflow-x: hidden; /* Prevent horizontal scroll on body */
}

/* Added to prevent scrolling when a panel is open */
body.panel-open {
    overflow: hidden;
}

/* Particle Canvas Styles */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Place it behind all other content */
    pointer-events: none; /* Make it non-interactive */
    transition: opacity 0.5s ease-in-out;
    opacity: 1;
}

/* Hide particle canvas when animations are disabled */
body.animations-disabled #particle-canvas {
    opacity: 0;
    display: none;
}

.main-content-area {
    background-color: #FFFFFF; /* white */
    transition: background-color 0.3s ease;
}
header.app-header {
    background-color: #E2E8F0; /* slate-200 */
    transition: background-color 0.3s ease;
}
.nav-dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem; /* text-sm */
    color: #1E293B; /* slate-800 */
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}
.nav-dropdown-item svg:not([class*="text-"]):not(#animations-menu-icon-svg):not(.page-nav-icon-svg) {
    width: 1.25rem; /* w-5 */
    height: 1.25rem; /* h-5 */
    margin-right: 0.5rem;
    /* Default color, will be overridden by specific section colors */
    color: #0284C7; /* sky-600 */
}
.nav-dropdown-item .theme-checkmark svg {
     color: #0ea5e9; /* sky-500 */
}
.nav-dropdown-item:hover {
    background-color: #E2E8F0; /* slate-200 */
    color: #0369A1; /* sky-700 */
}
.dropdown-menu {
    background-color: #FFFFFF; /* white */
    color: #1E293B; /* slate-800 */
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.03);
}
#settings-dropdown .nav-dropdown-item:hover {
    background-color: #F3F4F6; /* gray-100 */
}
.dropdown-menu-header-text { color: #6B7280; /* gray-500 */ }
.dropdown-menu-item-text { color: #111827; /* gray-900 */ }

footer {
    border-top-color: transparent; /* Made transparent for particle effect */
    transition: background-color 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
    background-color: rgba(226, 232, 240, 0.25); /* slate-200 with 70% opacity */
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    padding-top: 1rem;
    padding-bottom: 1rem;
    position: relative; /* Ensure footer content is layered above the canvas */
    z-index: 10; /* Ensure footer is above particles */
}

body.animations-disabled footer {
    background-color: #E2E8F0; /* slate-200 */
    border-top-color: #CBD5E1; /* slate-300 */
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}


.footer-text-secondary { color: #64748B; /* slate-500 */ }

.site-logo { height: 32px; width: auto; margin-right: 0.5rem; }
.settings-divider { border-top: 1px solid #CBD5E1; /* slate-300 */ margin-top: 0.25rem; margin-bottom: 0.25rem; }

.toggle-switch-label { display: flex; align-items: center; cursor: pointer; }
.toggle-switch-checkbox { opacity: 0; width: 0; height: 0; }
.toggle-switch-checkbox:disabled + .toggle-switch-slider { background-color: #9CA3AF; cursor: not-allowed; }
.toggle-switch-checkbox:disabled + .toggle-switch-slider::before { background-color: #E5E7EB; }
#animations-toggle-link.disabled-link { opacity: 0.5; cursor: not-allowed; }


.toggle-switch-slider { width: 2.5rem; height: 1.25rem; background-color: #D1D5DB; /* gray-300 */ border-radius: 9999px; position: relative; transition: background-color 0.2s ease-in-out; }
.toggle-switch-slider::before { content: ''; position: absolute; top: 2px; left: 2px; width: 1rem; height: 1rem; background-color: white; border-radius: 9999px; transition: transform 0.2s ease-in-out; }
.toggle-switch-checkbox:checked + .toggle-switch-slider { background-color: #2563EB; /* blue-600 */ }
.toggle-switch-checkbox:checked + .toggle-switch-slider::before { transform: translateX(1.25rem); }

.header-icon { color: #334155; /* slate-700 */ transition: color 0.2s ease-in-out; }
.header-icon:hover { color: #0EA5E9; /* sky-500 */ }
.header-icon svg { fill: currentColor; }
.header-icon svg.stroked-icon { fill: none; stroke: currentColor; }

#settings-button:hover { background-color: #E2E8F0; /* slate-200 */ }

/* Dark Mode Overrides for template */
html.dark body { background-color: #0F172A; color: #F8FAFC; }
html.dark .main-content-area { background-color: #1E293B; /* slate-800 */ }
html.dark header.app-header { background-color: #1E293B; }
html.dark .nav-dropdown-item { color: #CBD5E1; }
html.dark .nav-dropdown-item svg:not([class*="text-"]):not(#animations-menu-icon-svg):not(.page-nav-icon-svg) { color: #38BDF8; }
html.dark .nav-dropdown-item .theme-checkmark svg { color: #38bdf8; }
html.dark .nav-dropdown-item:hover { background-color: #334155; color: #38BDF8; }
html.dark .dropdown-menu { background-color: #1E293B; color: #F8FAFC; }
html.dark #settings-dropdown .nav-dropdown-item:hover {
    background-color: #334155;
}
html.dark .dropdown-menu-header-text { color: #94A3B8; }
html.dark .dropdown-menu-item-text { color: #E2E8F0; }
html.dark footer {
    background-color: rgba(30, 41, 59, 0.7); /* slate-800 with 70% opacity */
    border-top-color: #334155; /* slate-700 */
}
html.dark .footer-text-secondary { color: #94A3B8; }
html.dark .settings-divider { border-top-color: #334155; }
html.dark .toggle-switch-slider { background-color: #4B5563; }
html.dark .toggle-switch-checkbox:checked + .toggle-switch-slider { background-color: #3B82F6; }
html.dark .toggle-switch-checkbox:disabled + .toggle-switch-slider { background-color: #374151; }
html.dark .toggle-switch-checkbox:disabled + .toggle-switch-slider::before { background-color: #4B5563; }
html.dark .header-icon { color: #CBD5E1; }
html.dark .header-icon:hover { color: #38BDF8; }
html.dark #settings-button:hover { background-color: #334155; }

/* Specific dark mode text color overrides */
html.dark .text-slate-900 { color: #F8FAFC; }
html.dark .text-slate-500 { color: #cbd5e1; }
html.dark .text-slate-600 { color: #e2e8f0; }
html.dark .text-slate-700 { color: #cbd5e1; }
html.dark .text-slate-800 { color: #e2e8f0; }
html.dark .text-red-600 { color: #f87171; } /* red-400 */
html.dark .text-blue-600 { color: #60a5fa; } /* blue-400 */
html.dark .text-orange-600 { color: #fb923c; } /* orange-400 */
html.dark .text-yellow-600 { color: #facc15; } /* yellow-400 */
html.dark .text-green-600 { color: #4ade80; } /* green-400 */
html.dark .text-sky-600 { color: #38bdf8; } /* sky-400 */


html.dark #manualDiceInput {
    background-color: #334155; /* slate-700 */
    border-color: #4B5563; /* slate-600 */
    color: #f8fafc; /* slate-50 */
}
html.dark select {
    color: #F8FAFC;
    background-color: #334155; /* Corresponds to slate-700 */
}
html.dark select option {
    background: #334155; /* Corresponds to slate-700 */
    color: #F8FAFC;
}


.theme-checkmark svg {
    color: #0ea5e9; /* sky-500 */
}
html.dark .theme-checkmark svg {
    color: #38bdf8; /* sky-400 */
}

.animations-icon-svg {
    transition: transform 0.3s ease, stroke 0.3s ease;
}
.animations-icon-svg.animate-active {
    animation: explosion-effect 2s infinite ease-in-out,
               rainbow-stroke-wave-direct 3s infinite linear;
}
@keyframes explosion-effect {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
    25% { transform: scale(1.6) rotate(45deg); opacity: 0.7; }
    50% { transform: scale(0.7) rotate(-45deg); opacity: 1; }
    75% { transform: scale(1.3) rotate(15deg); opacity: 0.8; }
}
@keyframes rainbow-stroke-wave-direct {
    0%   { stroke: #FF0000; } 14%  { stroke: #FFA500; } 28%  { stroke: #FFFF00; } 42%  { stroke: #008000; }
    57%  { stroke: #0000FF; } 71%  { stroke: #4B0082; } 85%  { stroke: #EE82EE; } 100% { stroke: #FF0000; }
}
.animations-icon-svg:not(.animate-active) { stroke: #bd10e0; }
html.dark .animations-icon-svg:not(.animate-active) { stroke: #d946ef; }

.scene {
    perspective: 800px;
}

.dice {
    width: 50px;
    height: 50px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1s;
}

body.animations-disabled .rolling {
    animation: none;
}

.rolling {
    animation: roll 2s ease-out forwards;
}

.dice-face {
    position: absolute;
    width: 50px;
    height: 50px;
    background-color: #dc2626;
    border: 2px solid #991b1b;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: white;
    padding: 5px;
}

.dot {
    width: 10px;
    height: 10px;
    background-color: white;
    border-radius: 50%;
}

.face-1 { transform: rotateY(0deg) translateZ(25px); }
.face-2 { transform: rotateY(90deg) translateZ(25px); }
.face-3 { transform: rotateY(180deg) translateZ(25px); }
.face-4 { transform: rotateY(-90deg) translateZ(25px); }
.face-5 { transform: rotateX(90deg) translateZ(25px); }
.face-6 { transform: rotateX(-90deg) translateZ(25px); }

.dots-container {
    display: grid;
    width:100%;
    height:100%;
    gap: 4px;
    align-items: center;
    justify-items: center;
}
.dots-1 { grid-template-columns: 1fr; }
.dots-2 { grid-template-columns: 1fr 1fr; }
.dots-2 .dot:first-child { align-self: flex-start; justify-self: flex-start; }
.dots-2 .dot:last-child { align-self: flex-end; justify-self: flex-end; }

.dots-3 {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
}
.dots-3 .dot:nth-child(1) { grid-area: 1 / 1; }
.dots-3 .dot:nth-child(2) { grid-area: 2 / 2; }
.dots-3 .dot:nth-child(3) { grid-area: 3 / 3; }

.dots-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}
.dots-4 .dot:nth-child(1) {
    align-self: start;
    justify-self: start;
}
.dots-4 .dot:nth-child(2) {
    align-self: start;
    justify-self: end;
}
.dots-4 .dot:nth-child(3) {
    align-self: end;
    justify-self: start;
}
.dots-4 .dot:nth-child(4) {
    align-self: end;
    justify-self: end;
}

.dots-5 {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
}
.dots-5 .dot:nth-child(1) { grid-area: 1 / 1; }
.dots-5 .dot:nth-child(2) { grid-area: 1 / 3; }
.dots-5 .dot:nth-child(3) { grid-area: 2 / 2; }
.dots-5 .dot:nth-child(4) { grid-area: 3 / 1; }
.dots-5 .dot:nth-child(5) { grid-area: 3 / 3; }

.dots-6 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
}

@keyframes roll {
    0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
    100% { transform: rotateX(720deg) rotateY(720deg) rotateZ(720deg); }
}

.show-1 { transform: rotateY(0deg) rotateZ(0deg) rotateX(0deg); }
.show-2 { transform: rotateY(-90deg) rotateZ(0deg) rotateX(0deg); }
.show-3 { transform: rotateY(-180deg) rotateZ(0deg) rotateX(0deg); }
.show-4 { transform: rotateY(90deg) rotateZ(0deg) rotateX(0deg); }
.show-5 { transform: rotateX(-90deg) rotateZ(0deg) rotateY(0deg); }
.show-6 { transform: rotateX(90deg) rotateZ(0deg) rotateY(0deg); }

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@property --rainbow-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes rainbow-chase-feedback-animation {
    to {
        --rainbow-angle: 360deg;
    }
}

@keyframes aura-pulse-effect {
    0%   { box-shadow: 0 0 15px 4px rgba(239, 68, 68, 0.35), 0 0 30px 8px rgba(239, 68, 68, 0.2); }
    17%  { box-shadow: 0 0 15px 4px rgba(249, 115, 22, 0.35), 0 0 30px 8px rgba(249, 115, 22, 0.2); }
    33%  { box-shadow: 0 0 15px 4px rgba(234, 179, 8, 0.35), 0 0 30px 8px rgba(234, 179, 8, 0.2); }
    50%  { box-shadow: 0 0 15px 4px rgba(34, 197, 94, 0.35), 0 0 30px 8px rgba(34, 197, 94, 0.2); }
    67%  { box-shadow: 0 0 15px 4px rgba(59, 130, 246, 0.35), 0 0 30px 8px rgba(59, 130, 246, 0.2); }
    83%  { box-shadow: 0 0 15px 4px rgba(139, 92, 246, 0.35), 0 0 30px 8px rgba(139, 92, 246, 0.2); }
    100% { box-shadow: 0 0 15px 4px rgba(239, 68, 68, 0.35), 0 0 30px 8px rgba(239, 68, 68, 0.2); }
}

.animated-rainbow-border-container {
    padding: 3px;
    border-radius: 0.5rem; /* rounded-lg */
    background: conic-gradient(from var(--rainbow-angle), #ef4444, #f97316, #eab308, #22c55e, #3b82f6, #6366f1, #8b5cf6, #ef4444);
    animation: rainbow-chase-feedback-animation 3s linear infinite, aura-pulse-effect 6s ease-in-out infinite;
    position: relative;
}

body.animations-disabled .animated-rainbow-border-container {
    animation: none !important;
    background: transparent !important;
    border: 2px solid #dc2626; /* red-600 */
    padding: 1px; /* Adjust padding to maintain inner size */
    box-shadow: none !important; /* Remove aura when animations are disabled */
}

html.dark body.animations-disabled .animated-rainbow-border-container {
    border-color: #f87171; /* red-400 */
}

.animated-border-inner-content {
    border-radius: calc(0.5rem - 3px); /* rounded-lg minus padding */
    width: 100%;
    background-color: #ffffff;
    transition: background-color 0.3s ease;
}

body.animations-disabled .animated-border-inner-content {
     border-radius: calc(0.5rem - 2px); /* Adjust for thinner border */
}

html.dark .animated-border-inner-content {
    background-color: #1E293B;
}

/* Custom style for history list numbers */
.history-list-number {
    font-weight: 700;
}
#historyContainer div span.history-list-number {
    color: #334155; /* slate-700 */
}
html.dark #historyContainer div span.history-list-number {
    color: #FFFFFF;
}

/* Styles for metrics from securityAnalyzer.css */
.pag-label-style {
    font-weight: 600;
    color: #0284C7; /* sky-600 */
    transition: color 0.3s ease;
}
html.dark .pag-label-style { color: #38bdf8; /* sky-400 */ }

.pag-entropy-legend-item {
    display: flex;
    align-items: center;
}
.pag-entropy-legend-color {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 9999px;
    margin-right: 0.25rem;
    border: 1px solid #D1D5DB; /* slate-300 */
}
html.dark .pag-entropy-legend-color { border: 1px solid #4B5563; }

/* --- NEW STYLES FOR SIDE PANELS --- */

/* Overlay for when the panel is open */
.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 70; /* Higher than header, lower than panel */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Base styles for both side panels */
.side-panel {
    position: fixed;
    top: 0;
    height: 100%;
    width: 90vw;
    background-color: #FFFFFF; /* Light mode default */
    z-index: 80; /* Highest z-index */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-width: 420px;
}

html.dark .side-panel {
    background-color: #1E293B; /* Dark mode background */
}

/* Left-side panel initial state (off-screen) */
.side-panel.left {
    left: 0;
    transform: translateX(-100%);
}

/* Right-side panel initial state (off-screen) */
.side-panel.right {
    right: 0;
    transform: translateX(100%);
}

/* State when the panel is open (on-screen) */
.side-panel.open {
    transform: translateX(0);
}

/* Header within the side panel */
.side-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #E2E8F0; /* Light mode border */
}

html.dark .side-panel-header {
    border-bottom-color: #334155; /* Dark mode border */
}

.side-panel-title {
    font-weight: 600;
    color: #1E293B; /* Light mode text */
    font-size: 1.375rem;
}

html.dark .side-panel-title {
    color: #E2E8F0; /* Dark mode text */
}

/* Close button inside the panel */
.panel-close-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: #64748B; /* Light mode icon color */
    transition: color 0.2s ease, transform 0.2s ease;
}

.panel-close-button:hover {
    color: #EF4444; /* Red on hover */
    transform: rotate(90deg);
}

html.dark .panel-close-button {
    color: #94A3B8; /* Dark mode icon color */
}

html.dark .panel-close-button:hover {
    color: #F87171; /* Light red on hover */
}

/* Content area of the side panel */
.side-panel-content {
    padding: 0.5rem 0;
    flex-grow: 1;
}

.side-panel .nav-dropdown-item {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
}
.side-panel .dropdown-menu-header-text {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem 0.5rem;
}

/* The new hamburger menu icon button */
#menu-button {
    margin-right: 0.5rem; /* Add some space between it and the logo */
}
