/* Base Styles */
:root {
    --primary-color: #1173d4;
}

body {
    font-family: Inter, "Noto Sans", sans-serif;
    margin: 0;
    padding: 0;
    background-color: #0a0a09;
    color: #0a0a09;
}

/* Layout */
.design-root {
    position: relative;
    display: flex;
    height: 100vh;
    width: 100%;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.header {
    display: flex;
    height: 4rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    white-space: nowrap;
    background-color: black;
    padding: 0 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    position: relative;
    z-index: 20;
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0.125rem;
    background-color: #3b82f6;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
}

.logo {
    height: 2rem;
    width: 2rem;
    color: white;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: bold;
    letter-spacing: -0.025em;
    margin: 0;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
}

.nav-button {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: color 0.15s ease-in-out;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 0.125rem;
    padding: 0.25rem;
}

.nav-button:hover {
    color: #d1d5db;
}

.nav-button:focus {
    outline: none;
    box-shadow: 0 0 0 2px #3b82f6, 0 0 0 4px black;
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.slide-counter {
    font-size: 0.875rem;
    font-weight: 500;
}

.nav-divider {
    height: 1.5rem;
    width: 1px;
    background-color: #4b5563;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    background-color: #0a0a09;
    padding: 0;
    position: relative;
}

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    padding: 0.5rem;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease-in-out, background-color 0.15s ease-in-out;
    border: none;
    cursor: pointer;
    opacity: 0;
}

.main-content:hover .nav-arrow {
    opacity: 1;
}

.main-content.nav-hidden .nav-arrow {
    opacity: 0 !important;
}

.nav-arrow:hover {
    background-color: rgba(0, 0, 0, 0.4);
}

.nav-arrow:focus {
    outline: none;
    box-shadow: 0 0 0 2px #3b82f6, 0 0 0 4px #e5e7eb;
}

.nav-arrow:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-arrow.prev {
    left: 1rem;
}

.nav-arrow.next {
    right: 1rem;
}

.arrow-icon {
    height: 2rem;
    width: 2rem;
    color: white;
}

.slide-container {
    width: 100%;
    height: 100%;
    background-color: #0a0a09;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slide-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease-in-out, opacity 0.15s ease-in-out;
    transform-origin: center center;
}

/* Dynamic slide paper styles */
.slide-paper {
    position: relative;
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.5s ease-in;
}

.slide-paper.loaded {
    opacity: 1;
}

.background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 1;
}

.text-element {
    position: absolute;
    user-select: none;
    pointer-events: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    z-index: 2;
}

.text-element.clickable {
    pointer-events: auto;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.text-element.clickable:hover {
    opacity: 0.8;
}

/* Loading Screen */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0a0a09;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-ring {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-left: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Grid View Styles */
.grid-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0a0a09;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 3;
}

.grid-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.grid-item {
    position: relative;
    aspect-ratio: 16/9;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid transparent;
}

.grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: #3b82f6;
}

.grid-item.grid-current {
    border-color: #1173d4;
    box-shadow: 0 0 0 3px rgba(17, 115, 212, 0.3);
}

.grid-thumbnail {
    width: 100%;
    height: 100%;
    background-color: #000000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}


.grid-thumbnail-error {
    background-color: #374151;
    color: white;
    font-size: 0.875rem;
    text-align: center;
}

.grid-slide-number {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
    z-index: 10;
}

.grid-slide-number-large {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 2.5rem;
    font-weight: bold;
    text-align: center;
    z-index: 10;
    user-select: none;
}

/* Simple Grid Title */
.grid-title {
    z-index: 5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 90%;
}

/* Custom Scrollbar Styles */
.grid-container::-webkit-scrollbar {
    width: 8px;
}

.grid-container::-webkit-scrollbar-track {
    background: #0a0a09;
    border-radius: 4px;
}

.grid-container::-webkit-scrollbar-thumb {
    background: #000000;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.grid-container::-webkit-scrollbar-thumb:hover {
    background: #1a1a1a;
}

.grid-container::-webkit-scrollbar-thumb:active {
    background: #333333;
}

/* Firefox Scrollbar */
.grid-container {
    scrollbar-width: thin;
    scrollbar-color: #000000 #0a0a09;
}

/* Fullscreen Button States */
#fullscreenBtn {
    position: relative;
}

#fullscreenEnterIcon,
#fullscreenExitIcon {
    transition: opacity 0.2s ease-in-out;
}

/* Fullscreen Styles */
:fullscreen .design-root,
:-webkit-full-screen .design-root,
:-moz-full-screen .design-root,
:-ms-fullscreen .design-root {
    background-color: #0a0a09;
}

:fullscreen .main-content,
:-webkit-full-screen .main-content,
:-moz-full-screen .main-content,
:-ms-fullscreen .main-content {
    background-color: #0a0a09;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 0 1rem;
    }

    .nav-controls {
        gap: 0.5rem;
    }

    .slide-counter {
        font-size: 0.75rem;
    }

    .nav-arrow {
        padding: 0.375rem;
    }

    .arrow-icon {
        height: 1.5rem;
        width: 1.5rem;
    }

    .main-content {
        padding: 0;
    }

    /* Grid responsive styles for tablets */
    .grid-content {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
        padding: 16px;
    }

    .grid-item:hover {
        transform: translateY(-2px);
    }

    .grid-slide-number {
        bottom: 6px;
        right: 6px;
        padding: 3px 6px;
        font-size: 0.7rem;
    }

}

@media (max-width: 480px) {
    .logo-section {
        gap: 0.5rem;
    }

    .brand-title {
        font-size: 1.125rem;
    }

    .nav-icon {
        width: 1.25rem;
        height: 1.25rem;
    }

    .nav-controls {
        gap: 0.25rem;
    }

    /* Grid responsive styles for phones */
    .grid-content {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 12px;
        padding: 12px;
    }

    .grid-item {
        border-radius: 6px;
    }

    .grid-item:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    }

    .grid-slide-number {
        bottom: 4px;
        right: 4px;
        padding: 2px 5px;
        font-size: 0.65rem;
        min-width: 20px;
    }

}

/* Extra small phones */
@media (max-width: 360px) {
    .grid-content {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
        padding: 10px;
    }

    .grid-slide-number {
        font-size: 0.6rem;
        padding: 2px 4px;
        min-width: 18px;
    }

}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .grid-item:hover {
        transform: none;
        box-shadow: none;
        border-color: transparent;
    }

    .grid-item:active {
        transform: scale(0.98);
        opacity: 0.8;
    }

    .grid-item.grid-current {
        border-color: #1173d4;
        box-shadow: 0 0 0 2px rgba(17, 115, 212, 0.4);
    }

    /* Hide zoom and fullscreen buttons on mobile */
    #zoomInBtn,
    #zoomOutBtn,
    #fullscreenBtn {
        display: none !important;
    }
}