* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background-color: #2c2c2c;
    color: #ffffff;
}

.container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Hidden class for view toggling */
.hidden {
    display: none !important;
}

/* Album Grid View */
.album-grid-view {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #2c2c2c;
    overflow: hidden;
}

.grid-header {
    padding: 30px;
    background-color: #1a1a1a;
    border-bottom: 1px solid #333;
    text-align: center;
}

.grid-header h1 {
    font-size: 2.5em;
    font-weight: 300;
    color: #ffffff;
}

.album-grid {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, 450px);
    gap: 38px;
    align-content: start;
    justify-content: center;
}

.album-card {
    background-color: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #333;
    width: 450px;
    height: 570px;
    flex-shrink: 0;
}

.album-card:hover {
    transform: translateY(-5px);
    border-color: #4a9eff;
    box-shadow: 0 10px 30px rgba(74, 158, 255, 0.3);
}

.album-cover {
    width: 450px;
    height: 450px;
    object-fit: cover;
    display: block;
}

.album-name {
    padding: 20px;
    font-size: 1.3em;
    font-weight: 400;
    text-align: center;
    color: #ffffff;
    background-color: #0d0d0d;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Album Viewer View */
.album-viewer-view {
    width: 100%;
    height: 100vh;
    display: flex;
}

/* Navigation Panel */
.nav-panel {
    width: 280px;
    background-color: #1a1a1a;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.nav-panel.collapsed {
    margin-left: -280px;
}

.nav-header {
    padding: 20px;
    background-color: #0d0d0d;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid #333;
}

.collapse-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px 10px;
    transition: transform 0.3s ease;
}

.nav-panel.collapsed .collapse-btn {
    transform: rotate(180deg);
}

.collapse-btn:hover {
    color: #4a9eff;
}

.nav-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 10px;
}

.thumbnails {
    display: flex;
    flex-direction: column;
    gap: 15px;
    outline: none; /* Remove focus outline since selection is already visually indicated */
}

.thumbnail-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.thumbnail-row:hover {
    background-color: #2a2a2a;
}

.thumbnail-row.active {
    background-color: #3a3a3a;
    border-color: #4a9eff;
    box-shadow: 0 0 15px rgba(74, 158, 255, 0.6);
}

.thumbnail {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border: 2px solid #444;
    border-radius: 4px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.thumbnail:hover {
    border-color: #4a9eff;
}

/* Individual thumbnail active state (for page mode only) */
.thumbnail.active {
    border-color: #4a9eff;
    box-shadow: 0 0 10px rgba(74, 158, 255, 0.7);
}

/* Main Viewer */
.main-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #2c2c2c;
    position: relative;
}

.viewer-controls {
    padding: 15px 30px;
    background-color: #1a1a1a;
    display: flex;
    gap: 15px;
    align-items: center;
    border-bottom: 1px solid #333;
    transition: padding-left 0.3s ease;
}

/* Add left padding when nav panel is collapsed to avoid overlap with expand button */
.nav-panel.collapsed ~ .main-viewer .viewer-controls {
    padding-left: 80px;
}

.album-title {
    font-size: 1.5em;
    font-weight: 300;
    margin: 0;
    flex: 1;
    text-align: center;
}

.mode-btn, .nav-btn {
    padding: 10px 20px;
    background-color: #3a3a3a;
    color: #ffffff;
    border: 1px solid #555;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.2s ease;
}

.mode-btn:hover, .nav-btn:hover {
    background-color: #4a9eff;
    border-color: #4a9eff;
}

.mode-btn:disabled, .nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-btn {
    margin-left: auto;
}

.nav-btn:last-child {
    margin-left: 0;
}

.viewer-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    overflow: hidden;
}

.page-container {
    display: flex;
    gap: 20px;
    max-width: 100%;
    max-height: 100%;
    align-items: center;
    justify-content: center;
}

.page-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: 3px solid #444;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

/* Page mode - single page takes full space */
.viewer-content.page-mode .page-container {
    width: 100%;
    height: 100%;
}

.viewer-content.page-mode .page-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

/* Spread mode - two pages side by side */
.viewer-content.spread-mode .page-container {
    gap: 20px;
    width: 100%;
    height: 100%;
}

.viewer-content.spread-mode .page-image {
    max-width: calc(50% - 10px);
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Single page spread in spread mode - display like page mode */
.viewer-content.spread-mode.single-page-spread .page-container {
    width: 100%;
    height: 100%;
}

.viewer-content.spread-mode.single-page-spread .page-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

.page-info {
    padding: 15px 30px;
    background-color: #1a1a1a;
    text-align: center;
    font-size: 0.9em;
    color: #aaa;
    border-top: 1px solid #333;
}

/* Expand button when nav is collapsed */
.expand-btn {
    position: absolute;
    left: 10px;
    top: 20px;
    background-color: #3a3a3a;
    border: 1px solid #555;
    color: #ffffff;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2em;
    z-index: 50;
    transition: all 0.2s ease;
}

.expand-btn:hover {
    background-color: #4a9eff;
    border-color: #4a9eff;
}

.expand-btn.hidden {
    display: none;
}

/* Scrollbar styling */
.nav-content::-webkit-scrollbar {
    width: 8px;
}

.nav-content::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.nav-content::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.nav-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}
