body {
    background-color: #1a1a1a; /* Dark gray instead of black */
    -ms-overflow-style: none; /* Hide scrollbars in Internet Explorer */
    scrollbar-width: none; /* Hide scrollbars in Firefox */
    margin: 0;
    overflow-x: hidden;
    overflow-y: hidden; /* Hide vertical scrolling */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: 'Times New Roman', Times, serif;
}

/* Consolidated sidebar styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background: linear-gradient(180deg, #2a2a2a 0%, #1e1e1e 100%); /* Subtle gradient */
    border-right: 2px solid #333;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2); /* Add depth */
    overflow-y: auto;
    z-index: 1000;
    backdrop-filter: blur(10px); /* Add blur effect */
    padding: 10px;
    box-sizing: border-box;
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Custom scrollbar styling for dark theme */
    scrollbar-width: thin;
    scrollbar-color: #555 #2a2a2a;
}

/* Consolidated scrollbar hiding styles */
body, #slide-container, #outer-container {
    -ms-overflow-style: none; /* Hide scrollbars in Internet Explorer */
    scrollbar-width: none; /* Hide scrollbars in Firefox */
}

/* Hide scrollbars in Chrome, Safari, and newer versions of Opera */
body::-webkit-scrollbar,
#slide-container::-webkit-scrollbar,
#outer-container::-webkit-scrollbar {
    display: none;
}

.embedded-slide {
    pointer-events: none;
}



.control-div {
    position: fixed;
    top: 50%;
    right: 15px;
    transform: translateY(-50%); /* Center vertically */
    z-index: 1000;
    display: flex;
    flex-direction: column; /* Make buttons vertical */
    gap: 15px;
    background: rgba(34, 34, 34, 0.95);
    padding: 18px 12px; /* Adjust padding for vertical layout */
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}



.slide {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}




.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    height: 100%; 
    padding: 8px;
    box-sizing: border-box;
    overflow-y: auto;
}


.grid .slide {
    position: relative;
    width: 100%; 
    height: 100%; 
    overflow: hidden; 

}


.markdownComponent {
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
}

.markdownComponent p {
    margin: 0;
    text-align: left;
    line-height: 1;
    height: 100%;
}


.markdownComponent mjx-container, .markdownComponent mjx-math, .markdownComponent mjx-mi, .markdownComponent mjx-c {
    margin: 0 !important;
    padding: 0 !important;
}


.loader {
    border: 16px solid #f3f3f3;
    border-top: 16px solid #3498db;
    border-radius: 50%;
    width: 120px;
    height: 120px;
    animation: spin 2s linear infinite;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

#loading-container {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 10px;
  }

/* Slide container styling will be defined later */


.fullscreen-mode {
    position: relative;
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}


/* Default style (covers wider screens) */
.fullscreen-mode .slide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    width: 100vw;
    height: 56.25vw;
    
    max-height: 100vh;
    max-width: calc(100vh * 16 / 9);
}


  
  #loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  
  #loading-bar {
    width: 200px;
    height: 20px;
    margin-bottom: 10px;
  }
  
  #loading-text {
    color: white;
    font-family: sans-serif;
    font-size: 16px;
  }
  




@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}


.hide-cursor {
    cursor: none;
}

.button-base {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 12px;
    font-size: 16px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.button-base:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.button-base:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Active/pressed state for toggle buttons */
.button-base.active {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.button-base.active:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Removed unused button-arrow and button-light classes */



/* For screens taller than 16:9 */
@media (max-aspect-ratio: 16/9) {
    .fullscreen-mode .slide {
        width: calc(100vh * 16 / 9);
        height: 100vh;
    }
}


/* Custom styles for code blocks */
.hljs {
    background: transparent;
}
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8); /* Black with opacity */
    overflow: auto;
    z-index: 1; /* Sit on top */
}

.modal-content {
    background-color: #333333; /* Charcoal */
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 30%; /* Adjust this value for the modal width */
    position: relative;
    color: white;
    word-wrap: break-word; /* Break long words if necessary */
    overflow: hidden;      /* Hide overflowed content */
}

#modalText {
    white-space: pre-line; /* Allows text to wrap */
    overflow-wrap: break-word; /* Break long words if necessary */
    max-width: 100%; /* Ensure the text doesn't go beyond the modal */
}

#copyBtn {
    position: absolute;
    top: 10px;
    right: 10px;
}

#copyBtn:hover {
    color: gray;
}

#copyMessage {
    display: none;
    color: limegreen;
    margin-top: 10px;
    font-weight: bold;
}


/* Removed duplicate modal styles - using the original modal styles above */

.copy-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.copy-row input,
.copy-row textarea {
  flex: 1;
  background: #2a2a2a;
  color: #fff;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 8px;
}

.checkbox-label {
  display: block;
  margin: 8px 0 16px;
}

/* Buttons */
.icon-btn {
  background: #333;
  color: #fff;
  border: none;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.icon-btn:hover {
  background: #555;
}

.close-btn {
  background: #444;
  color: #fff;
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.close-btn:hover {
  background: #666;
}

.modal-actions {
  text-align: right;
}

/* Removed duplicate sidebar definition */

/* Webkit scrollbar styling (Chrome, Safari, Edge) */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
    border: 1px solid #2a2a2a;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #666;
}

.sidebar::-webkit-scrollbar-corner {
    background: #2a2a2a;
}

#sidebar-slides {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-slide {
    width: 100%;
    height: 120px;
    background: #2a2a2a;
    border: 2px solid #444;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.sidebar-slide:hover {
    border-color: #666;
}

.sidebar-slide.active {
    border-color: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

/* Adjust main content to account for sidebar */
#slide-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin-left: calc((250px - 60px) / 2); /* Center between sidebar (250px) and button bar (~60px) */
    width: calc(100vw - 250px - 120px); /* Account for sidebar and button bar space */
    height: calc(100vh - 60px);
    max-width: calc((100vh - 60px) * 16 / 9); /* Maintain 16:9 aspect ratio */
    max-height: calc((100vw - 370px) * 9 / 16); /* Account for sidebar + button space */
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #111 0%, #000 100%); /* Subtle gradient instead of flat black */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 
                0 8px 16px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.12),
                inset 0 1px 0 rgba(255, 255, 255, 0.05); /* Add inner highlight */
    border-radius: 12px; /* Slightly more rounded corners */
}

/* Embed mode: slide container fills entire viewport while maintaining 16:9 ratio */
#slide-container.embed-mode {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin-left: 0;
    width: calc(100vw - 120px); /* Account for control buttons space */
    height: 100vh;
    max-width: calc(100vh * 16 / 9); /* Maintain 16:9 aspect ratio */
    max-height: calc((100vw - 120px) * 9 / 16); /* Account for control buttons */
    border-radius: 0; /* Remove border radius for full screen */
    box-shadow: none; /* Remove shadows for clean embed look */
}

/* Hide sidebar instantly when embed=True is in URL - no JavaScript delay */
body[data-embed="true"] .sidebar {
    display: none !important;
}

body[data-embed="true"] #slide-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin-left: 0;
    width: calc(100vw - 120px);
    height: 100vh;
    max-width: calc(100vh * 16 / 9);
    max-height: calc((100vw - 120px) * 9 / 16);
    border-radius: 0;
    box-shadow: none;
}

/* Sidebar thumbnails should always be visible */
.sidebar-thumbnail {
    visibility: visible !important;
    display: block !important;
    position: relative;
    width: 500%;
    height: 500%;
    transform: scale(0.2);
    transform-origin: top left;
    pointer-events: none;
    border: none;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-thumbnail:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.sidebar-thumbnail.selected {
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.1);
}

/* Prevent overlap between slide and controls on smaller screens */
@media (max-width: 1400px) {
    #slide-container {
        margin-left: calc((250px - 80px) / 2); /* Adjust centering for smaller screens */
        width: calc(100vw - 250px - 140px); /* More space for button bar */
        max-height: calc((100vw - 390px) * 9 / 16);
    }
    
    .control-div {
        right: 20px; /* More space from edge */
    }
}

@media (max-width: 1200px) {
    #slide-container {
        margin-left: calc((250px - 100px) / 2); /* Further adjustment */
        width: calc(100vw - 250px - 160px);
    }
    
    .control-div {
        right: 30px;
    }
}

/* Professional animations and final touches */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Apply smooth entrance animations to control div */
.control-div {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Add subtle focus states for accessibility */
.button-base:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}
