/* Game System Toggle Styles - Data Attribute Version */

/* Hide elements based on data-visible attribute */
[data-visible="false"] {
    display: none;
}

/* Show elements when visible */
[data-visible="true"] {
    display: block;
}

/* Ensure inline elements display correctly */
span[data-visible="true"] {
    display: inline;
}

/* Game system specific styling - now using data-system attribute */
[data-system] {
    width: fit-content;
    padding-left: 1rem;
    border-left: 3px solid var(--brass, #B8860B);
}

[data-system] > p {
    margin: 1rem auto;
}

/* System-specific border colors */
[data-system~="dnd35"] {
    border-left-color: #8B0000;
}

[data-system~="dnd5e"] {
    border-left-color: #DC143C;
}

[data-system~="daggerheart"] {
    border-left-color: #4B0082;
}

[data-system~="tsl"] {
    border-left-color: #FF1493;
}

[data-system~="agate"] {
    border-left-color: #228B22;
}

/* GM Note styling - now using data attributes */
.gm-note[data-system="gm"] {
    background: rgba(0, 0, 0, 0.8);
    color: #FFD700;
    padding: 0.5rem 1rem;
    margin: 0.5rem 0;
    border: 1px dashed #FFD700;
    font-style: italic;
}

.gm-note:before {
    content: "🔒 ";
}

/* Inline system content styling */
span[data-system] {
    padding: 0 0.25rem;
    border-radius: 3px;
}

span[data-system~="dnd5e"] {
    background: rgba(220, 20, 60, 0.1);
}

span[data-system~="daggerheart"] {
    background: rgba(75, 0, 130, 0.1);
}

span[data-system~="tsl"] {
    background: rgba(255, 20, 147, 0.1);
}

/* Hamburger menu button */
.system-menu-toggle {
    position: fixed;
    top: 5.5rem;
    left: 1rem;
    z-index: 1001;
    background: var(--bg-tertiary, #2a1f1a);
    border: 2px solid var(--brass-dark, #8b6508);
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease, left 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.system-menu-toggle:hover {
    background: var(--bg-wood, #3e2723);
    border-color: var(--brass, #b8860b);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6), 0 0 10px rgba(184, 134, 11, 0.3);
}

.system-menu-toggle.active {
    background: var(--brass, #b8860b);
    border-color: var(--brass-light, #daa520);
}

.hamburger-line {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--brass, #b8860b);
    margin: 5px 0;
    transition: all 0.3s ease;
}

.system-menu-toggle.active .hamburger-line {
    background: var(--bg-primary, #0d0907);
}

.system-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.system-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.system-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Sidebar styles */
.system-sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100vh;
    background: var(--bg-secondary, #1a1210);
    border-right: 3px solid var(--brass, #b8860b);
    transition: left 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
}

.system-sidebar.active {
    left: 0;
}

.system-sidebar-content {
    padding: 2rem 1.5rem;
}

.system-sidebar-header {
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--brass-dark, #8b6508);
    padding-bottom: 1rem;
}

.system-sidebar-header h3 {
    color: var(--brass-light, #daa520);
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Overlay */
.system-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 999;
}

.system-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Multi-select for systems in sidebar */
.system-sidebar .system-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.system-sidebar .system-checkboxes label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-primary, #e8dcc0);
    transition: color 0.3s ease;
    padding: 0.5rem;
    border-radius: 4px;
}

.system-sidebar .system-checkboxes label:hover {
    color: var(--brass-light, #daa520);
    background: rgba(184, 134, 11, 0.1);
}

.system-checkboxes input[type="checkbox"] {
    appearance: none;
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid var(--brass-dark, #8b6508);
    border-radius: 3px;
    background: var(--bg-secondary, #1a1210);
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.system-checkboxes input[type="checkbox"]:checked {
    background: var(--brass, #b8860b);
    border-color: var(--brass-light, #daa520);
    box-shadow: 0 0 5px rgba(184, 134, 11, 0.4);
}

.system-checkboxes input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--bg-primary, #0d0907);
    font-weight: bold;
    font-size: 0.8rem;
}

/* Toggle switches for GM notes in sidebar */
.system-sidebar .gm-toggle {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--brass-dark, #8b6508);
}

.system-sidebar .gm-toggle label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary, #c0a878);
    padding: 0.5rem;
    border-radius: 4px;
}

.system-sidebar .gm-toggle label:hover {
    background: rgba(184, 134, 11, 0.1);
}

.gm-toggle input[type="checkbox"] {
    appearance: none;
    width: 2.5rem;
    height: 1.25rem;
    background: var(--bg-secondary, #1a1210);
    border: 2px solid var(--brass-dark, #8b6508);
    border-radius: 1rem;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gm-toggle input[type="checkbox"]:checked {
    background: var(--brass, #b8860b);
    border-color: var(--brass-light, #daa520);
    box-shadow: 0 0 8px rgba(184, 134, 11, 0.4);
}

.gm-toggle input[type="checkbox"]:before {
    content: "";
    position: absolute;
    width: 0.9rem;
    height: 0.9rem;
    background: var(--text-primary, #e8dcc0);
    border-radius: 50%;
    top: 50%;
    left: 0.2rem;
    transform: translateY(-50%);
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.gm-toggle input[type="checkbox"]:checked:before {
    transform: translateY(-50%) translateX(1.1rem);
    background: var(--bg-primary, #0d0907);
}

/* Smooth transitions for visibility changes */
[data-system] {
    transition: opacity 0.3s ease-in-out;
}

[data-visible="false"] {
    opacity: 0;
    transition: opacity 0.3s ease-in-out, display 0s 0.3s;
}

[data-visible="true"] {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

/* System selector container in header */
#game-system-container {
    position: absolute;
    top: 1rem;
    right: 2rem;
    z-index: 10;
}

#game-system-container .system-selector {
    margin: 0;
    background: rgba(26, 18, 16, 0.9);
    backdrop-filter: blur(4px);
    max-width: 320px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .system-menu-toggle {
        top: 1rem;
    }
    
    .system-sidebar {
        width: 260px;
        left: -260px;
    }
    
    .system-sidebar-content {
        padding: 1.5rem 1rem;
    }
}