/* Photographic collection viewer */
.doc-layer.photo-mode {
    background:
        radial-gradient(circle at 84% 8%, rgba(92, 151, 243, 0.14), transparent 34%),
        linear-gradient(180deg, #f4f8ff 0%, #edf3fc 100%);
    overflow: auto;
}

.doc-layer.photo-mode .doc-canvas {
    width: min(100%, var(--x-max-page-width, 1600px));
    max-width: var(--x-max-page-width, 1600px);
    min-height: 100%;
    height: auto;
    margin: 0 auto;
    padding: clamp(1rem, 1.55vw, 1.75rem);
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.doc-layer.photo-mode .title-bar,
.doc-layer.photo-mode .doc-toolbar {
    display: none;
}

.doc-layer.photo-mode #docHost,
.doc-layer.photo-mode #docHostGeneric {
    height: auto;
    min-height: 0;
    overflow: visible;
    background: transparent;
}

.photo-viewer-shell {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    color: #092554;
}

.photo-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    color: #6f81a3;
    font-size: 0.92rem;
    font-weight: 750;
}

.photo-breadcrumb .is-current {
    color: #112a58;
}

.photo-breadcrumb i {
    color: #a7b4cd;
    font-size: 0.72rem;
}

.photo-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.photo-hero-main {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    min-width: 0;
}

.photo-back-btn,
.photo-action-btn,
.photo-tool-btn,
.photo-zoom-select,
.photo-nav,
.photo-download-btn,
.photo-quick-button {
    border: 1px solid #bfd2ef;
    background: #f8fbff;
    color: #0a2a5a;
    box-shadow: 0 10px 22px rgba(25, 58, 116, 0.09);
}

.photo-back-btn {
    width: 58px;
    height: 52px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex: 0 0 auto;
}

.photo-title-block h2 {
    margin: 0;
    color: #081f4a;
    font-size: clamp(1.7rem, 2.2vw, 2.35rem);
    font-weight: 850;
    line-height: 1.05;
}

.photo-title-block p {
    margin: 0.2rem 0 0;
    color: #52688d;
    font-size: 1rem;
    font-weight: 650;
}

.photo-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 1rem;
    margin-top: 0.5rem;
    color: #6d7e9f;
    font-weight: 750;
}

.photo-meta-row span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.photo-hero-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
}

.photo-action-btn {
    min-height: 54px;
    border-radius: 12px;
    padding: 0 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-weight: 850;
    white-space: nowrap;
}

.photo-action-primary {
    border-color: #1172ee;
    background: linear-gradient(135deg, #1578f2, #0966e5);
    color: #ffffff;
}

.photo-layout {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr) 360px;
    gap: 1rem;
    align-items: stretch;
}

.photo-albums-panel,
.photo-info-panel {
    border: 1px solid #c8d8f0;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 16px 36px rgba(39, 74, 130, 0.11);
}

.photo-albums-panel {
    padding: 1rem;
}

.photo-albums-panel h3 {
    margin: 0 0 0.9rem;
    color: #172b4f;
    font-size: 1.02rem;
    font-weight: 850;
}

.photo-album-search {
    position: relative;
    display: block;
    margin-bottom: 1rem;
}

.photo-album-search i {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9babc3;
}

.photo-album-search input {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d7e2f1;
    border-radius: 9px;
    background: #fff;
    color: #1e3155;
    padding: 0 0.85rem 0 2.5rem;
    font-weight: 650;
}

.photo-albums-list {
    display: flex;
    flex-direction: column;
    gap: 0.58rem;
}

.photo-album-item {
    display: grid;
    grid-template-columns: 76px 1fr;
    align-items: center;
    gap: 0.72rem;
    width: 100%;
    border: 0;
    border-left: 4px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #1a2f55;
    padding: 0.5rem;
    text-align: left;
}

.photo-album-item.is-active {
    border-left-color: #1690e8;
    background: #eaf4ff;
}

.photo-album-thumb {
    height: 48px;
    border-radius: 7px;
    overflow: hidden;
    background: #dce7f6;
}

.photo-album-thumb img,
.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.45) saturate(0.78);
}

.photo-album-item strong,
.photo-album-item small {
    display: block;
}

.photo-album-item strong {
    font-size: 0.92rem;
    font-weight: 850;
}

.photo-album-item small {
    color: #7a879f;
    font-weight: 700;
}

.photo-stage-panel {
    min-width: 0;
    overflow: hidden;
    border-radius: 14px;
    background: #06295d;
    box-shadow: 0 18px 38px rgba(13, 36, 77, 0.2);
}

.photo-toolbar {
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: 0.72rem;
    padding: 0.65rem 0.85rem;
    background: #06285b;
    color: #fff;
}

.photo-toolbar-spacer {
    flex: 1 1 auto;
}

.photo-tool-btn,
.photo-zoom-select {
    min-width: 44px;
    height: 42px;
    border-color: rgba(255, 255, 255, 0.12);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: none;
    font-weight: 850;
}

.photo-zoom-select {
    padding: 0 0.9rem;
}

.photo-count {
    min-width: 92px;
    text-align: center;
    font-weight: 850;
}

.photo-image-frame {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: clamp(390px, 49vw, 720px);
    background: #0a1e3e;
    overflow: hidden;
}

.photo-main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: sepia(0.28) saturate(0.82) contrast(1.02);
}

.photo-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 42px;
    height: 42px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: #17345e;
}

.photo-nav-left {
    left: 0.85rem;
}

.photo-nav-right {
    right: 0.85rem;
}

.photo-thumb-strip {
    display: grid;
    grid-template-columns: repeat(7, minmax(84px, 1fr));
    gap: 0.62rem;
    padding: 0.75rem;
    background: #06285b;
}

.photo-thumb {
    aspect-ratio: 1.35 / 1;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    background: #123b72;
    padding: 0;
}

.photo-thumb.is-active {
    border-color: #1494ff;
}

.photo-info-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.photo-info-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: 1px solid #d9e5f5;
}

.photo-info-tabs button {
    min-height: 58px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: #4d5e7d;
    font-weight: 850;
}

.photo-info-tabs .is-active {
    border-bottom-color: #4f93de;
    color: #0f6de7;
}

.photo-exif {
    padding: 1.25rem;
}

.photo-exif h3 {
    margin: 0 0 1rem;
    color: #182d52;
    font-size: 0.95rem;
    font-weight: 850;
    text-transform: uppercase;
}

.photo-exif dl {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 0.72rem 1rem;
    margin: 0;
}

.photo-exif dt {
    color: #7d879a;
    font-weight: 750;
}

.photo-exif dd {
    margin: 0;
    color: #20365f;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.photo-exif-note {
    display: flex;
    gap: 0.65rem;
    margin-top: 1.25rem;
    border-radius: 10px;
    background: #eaf4ff;
    color: #59708f;
    padding: 0.85rem;
    font-weight: 700;
}

.photo-download-btn {
    min-height: 52px;
    margin: auto 1.25rem 1.25rem;
    border-radius: 10px;
    border-color: #1172ee;
    background: linear-gradient(135deg, #1578f2, #0966e5);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    font-weight: 850;
}

html[data-theme="dark"] .doc-layer.photo-mode,
body[data-theme="dark"] .doc-layer.photo-mode {
    background:
        radial-gradient(circle at 84% 8%, rgba(70, 126, 224, 0.18), transparent 34%),
        linear-gradient(180deg, #071a34 0%, #0a2547 100%) !important;
}

html[data-theme="dark"] .photo-title-block h2,
html[data-theme="dark"] .photo-breadcrumb .is-current,
html[data-theme="dark"] .photo-albums-panel h3,
html[data-theme="dark"] .photo-exif h3,
body[data-theme="dark"] .photo-title-block h2,
body[data-theme="dark"] .photo-breadcrumb .is-current,
body[data-theme="dark"] .photo-albums-panel h3,
body[data-theme="dark"] .photo-exif h3 {
    color: #f2f7ff;
}

html[data-theme="dark"] .photo-breadcrumb,
html[data-theme="dark"] .photo-title-block p,
html[data-theme="dark"] .photo-meta-row,
body[data-theme="dark"] .photo-breadcrumb,
body[data-theme="dark"] .photo-title-block p,
body[data-theme="dark"] .photo-meta-row {
    color: #9db6dc;
}

html[data-theme="dark"] .photo-albums-panel,
html[data-theme="dark"] .photo-info-panel,
body[data-theme="dark"] .photo-albums-panel,
body[data-theme="dark"] .photo-info-panel {
    border-color: rgba(102, 141, 201, 0.5);
    background: rgba(13, 33, 62, 0.94);
}

html[data-theme="dark"] .photo-action-light,
html[data-theme="dark"] .photo-back-btn,
body[data-theme="dark"] .photo-action-light,
body[data-theme="dark"] .photo-back-btn {
    border-color: rgba(97, 134, 192, 0.56);
    background: rgba(18, 43, 78, 0.96);
    color: #edf5ff;
}

html[data-theme="dark"] .photo-album-search input,
body[data-theme="dark"] .photo-album-search input {
    border-color: rgba(97, 134, 192, 0.56);
    background: rgba(18, 43, 78, 0.96);
    color: #edf5ff;
}

html[data-theme="dark"] .photo-album-item,
html[data-theme="dark"] .photo-exif dd,
body[data-theme="dark"] .photo-album-item,
body[data-theme="dark"] .photo-exif dd {
    color: #e7f0ff;
}

html[data-theme="dark"] .photo-album-item.is-active,
body[data-theme="dark"] .photo-album-item.is-active {
    background: rgba(23, 64, 113, 0.82);
}

html[data-theme="dark"] .photo-exif dt,
body[data-theme="dark"] .photo-exif dt {
    color: #9db6dc;
}

@media (max-width: 1250px) {
    .photo-layout {
        grid-template-columns: 230px minmax(0, 1fr);
    }

    .photo-info-panel {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .photo-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .photo-hero-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .photo-layout {
        grid-template-columns: 1fr;
    }

    .photo-thumb-strip {
        overflow-x: auto;
        grid-template-columns: repeat(7, minmax(110px, 1fr));
    }
}

@media (max-width: 640px) {
    .doc-layer.photo-mode .doc-canvas {
        padding: 0.85rem !important;
    }

    .photo-hero-main {
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: start;
    }

    .photo-action-btn,
    .photo-download-btn {
        width: 100%;
    }

    .photo-toolbar {
        flex-wrap: wrap;
    }

    .photo-image-frame {
        height: 320px;
    }

    .photo-exif dl {
        grid-template-columns: 1fr;
    }
}

/* Final dark-mode polish for photo viewer */
html[data-theme="dark"] .photo-hero,
body[data-theme="dark"] .photo-hero {
    border-color: rgba(75, 111, 169, 0.62) !important;
    background:
        radial-gradient(circle at top right, rgba(72, 140, 255, 0.18), transparent 28%),
        linear-gradient(145deg, rgba(20, 45, 82, 0.98), rgba(16, 37, 66, 0.96)) !important;
    box-shadow:
        0 18px 40px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(142, 186, 255, 0.09) !important;
}

html[data-theme="dark"] .photo-stage-panel,
html[data-theme="dark"] .photo-toolbar,
html[data-theme="dark"] .photo-thumb-strip,
body[data-theme="dark"] .photo-stage-panel,
body[data-theme="dark"] .photo-toolbar,
body[data-theme="dark"] .photo-thumb-strip {
    border-color: rgba(97, 134, 192, 0.46) !important;
    background: rgba(12, 31, 58, 0.94) !important;
}

html[data-theme="dark"] .photo-tool-btn,
html[data-theme="dark"] .photo-zoom-select,
html[data-theme="dark"] .photo-nav,
html[data-theme="dark"] .photo-download-btn,
html[data-theme="dark"] .photo-quick-button,
body[data-theme="dark"] .photo-tool-btn,
body[data-theme="dark"] .photo-zoom-select,
body[data-theme="dark"] .photo-nav,
body[data-theme="dark"] .photo-download-btn,
body[data-theme="dark"] .photo-quick-button {
    border-color: rgba(97, 134, 192, 0.56) !important;
    background: rgba(18, 43, 78, 0.96) !important;
    color: #edf5ff !important;
}

html[data-theme="dark"] .photo-image-frame,
body[data-theme="dark"] .photo-image-frame {
    background:
        linear-gradient(45deg, rgba(130, 160, 205, 0.1) 25%, transparent 25% 75%, rgba(130, 160, 205, 0.1) 75%),
        linear-gradient(45deg, rgba(130, 160, 205, 0.1) 25%, transparent 25% 75%, rgba(130, 160, 205, 0.1) 75%),
        #0b2341 !important;
}

html[data-theme="dark"] .photo-thumb,
body[data-theme="dark"] .photo-thumb {
    border-color: rgba(97, 134, 192, 0.46) !important;
    background: rgba(18, 43, 78, 0.88) !important;
}
