/* Base Styles for PressPective Viewer */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #1a1a1a;
    color: #fff;
}

/* Header Bar */
.header-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(26, 26, 26, 0.95);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
    z-index: 3000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.header-title {
    font-size: 18px;
    font-weight: 500;
    margin-right: auto;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Main Container with transition */
#viewer-container {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    gap: 4px;
    padding: 4px;
    background: #1a1a1a;
    transition: right 0.3s ease, opacity 0.2s ease;
    will-change: right, opacity; /* Performance hint for browser */
}

/* Layout Classes */
#viewer-container.layout-single { 
    grid-template-columns: 1fr; 
}

#viewer-container.layout-two-vertical { 
    grid-template-columns: 1fr 1fr; 
}

#viewer-container.layout-three-vertical { 
    grid-template-columns: 1fr 1fr 1fr; 
}

#viewer-container.layout-four {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

/* Add class for when sidebar is open */
#viewer-container.sidebar-open {
    right: 360px;
}

/* Viewer Styles */
.viewer-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    overflow: hidden; /* Prevent content overflow */
}

.viewer-wrapper.active {
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.viewer {
    width: 100%;
    height: 100%;
}

/* Keyframes */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.98);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-content {
    text-align: center;
}

.loading-content h2 {
    color: white;
    font-size: 24px;
    margin-bottom: 20px;
}

.loading-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #4a9eff;
    animation: spin 1s ease-in-out infinite;
}

.loading-text {
    color: white;
    font-size: 18px;
    text-align: center;
}

/* Update z-index hierarchy */
.openseadragon-container .navigator {
    z-index: 2000 !important; /* Force navigator to stay on top */
}

/* Close Confirmation Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100%;
    max-height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000; /* Higher than everything else */
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background-color: #2a2a2a;
    padding: 24px;
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.modal-content h3 {
    font-size: 20px;
    margin-bottom: 12px;
    color: #fff;
}

.modal-content p {
    margin-bottom: 24px;
    color: #ccc;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.modal-buttons button {
    padding: 10px 24px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

#modal-cancel-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

#modal-cancel-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

#modal-confirm-btn {
    background-color: #e74c3c;
    color: white;
}

#modal-confirm-btn:hover {
    background-color: #c0392b;
}
