/* PhotoHub Manager Pro — Mini tema interno (independente do tema do site) */

:root {
    --phm-bg: #f5f6f8;
    --phm-surface: #ffffff;
    --phm-text: #1a1a1a;
    --phm-muted: #6b7280;
    --phm-border: #e5e7eb;
    --phm-accent: #ff3b30;
    --phm-radius: 10px;
}

body.phm-dark-mode {
    --phm-bg: #0f1115;
    --phm-surface: #1a1d24;
    --phm-text: #f3f4f6;
    --phm-muted: #9aa0a6;
    --phm-border: #2a2e37;
}

.phm-body {
    background: var(--phm-bg);
    color: var(--phm-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
}

.phm-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.phm-header {
    background: var(--phm-surface);
    border-bottom: 1px solid var(--phm-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.phm-header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 20px;
}

.phm-logo {
    font-weight: 700;
    font-size: 18px;
    color: var(--phm-text);
    text-decoration: none;
    white-space: nowrap;
}

.phm-logo span { color: var(--phm-accent); }

.phm-search-form {
    position: relative;
    flex: 1;
    display: flex;
}

.phm-search-form input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--phm-border);
    background: var(--phm-bg);
    color: var(--phm-text);
}

.phm-search-form button {
    border: none;
    background: transparent;
    cursor: pointer;
    margin-left: -40px;
}

.phm-search-results {
    position: absolute;
    top: 110%;
    left: 0;
    right: 0;
    background: var(--phm-surface);
    border: 1px solid var(--phm-border);
    border-radius: var(--phm-radius);
    max-height: 320px;
    overflow-y: auto;
    display: none;
    z-index: 60;
}

.phm-search-results.is-open { display: block; }

.phm-search-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    text-decoration: none;
    color: var(--phm-text);
}

.phm-search-result img { width: 48px; height: 32px; object-fit: cover; border-radius: 4px; }

.phm-theme-toggle {
    border: 1px solid var(--phm-border);
    background: var(--phm-surface);
    border-radius: 999px;
    width: 38px;
    height: 38px;
    cursor: pointer;
}

/* Hamburger (menu mobile) */
.phm-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 38px;
    height: 38px;
    border: 1px solid var(--phm-border);
    background: var(--phm-surface);
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.phm-hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--phm-text);
    transition: transform .2s ease, opacity .2s ease;
}

.phm-hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.phm-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.phm-hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.phm-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 90;
}

.phm-sidebar-overlay.is-open { display: block; }

/* Botão de fechar do menu mobile: só aparece dentro do painel deslizante,
   já que nesse breakpoint o próprio hamburguer do cabeçalho fica coberto
   pela sidebar aberta e não pode ser usado para fechá-la. */
.phm-sidebar-close {
    display: none;
    margin-left: auto;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    background: var(--phm-bg, transparent);
    border: 1px solid var(--phm-border);
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    color: var(--phm-text, inherit);
    cursor: pointer;
}
.phm-sidebar-close:hover { background: var(--phm-border); }

/* Breadcrumb */
.phm-breadcrumb {
    padding: 12px 20px;
    font-size: 13px;
    color: var(--phm-muted);
}
.phm-breadcrumb a { color: var(--phm-muted); text-decoration: none; }

/* Layout */
.phm-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 28px;
    padding: 20px 20px 60px;
    align-items: start;
}

.phm-main {
    min-width: 0; /* evita que imagens/grids estourem a coluna no grid */
}

.phm-sidebar {
    background: var(--phm-surface);
    border: 1px solid var(--phm-border);
    border-radius: var(--phm-radius);
    padding: 18px 14px;
    align-self: start;
}

.phm-sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--phm-border);
}

.phm-sidebar-icon {
    color: var(--phm-accent);
    font-size: 20px;
    line-height: 1;
}

.phm-sidebar h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--phm-muted);
    margin: 0;
}

.phm-category-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.phm-category-list li { margin-bottom: 0; }

.phm-category-list a,
.phm-cat-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--phm-text);
    font-size: 14px;
    transition: background .2s ease, color .2s ease, transform .15s ease;
}

.phm-category-list a .dashicons,
.phm-cat-link .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: var(--phm-muted);
    transition: color .2s ease;
}

.phm-category-list a:hover,
.phm-cat-link:hover {
    background: var(--phm-bg);
    color: var(--phm-accent);
    transform: translateX(2px);
}
.phm-category-list a:hover .dashicons,
.phm-cat-link:hover .dashicons { color: var(--phm-accent); }

.phm-category-list a.is-active,
.phm-cat-link.is-active {
    background: var(--phm-accent);
    color: #fff;
    font-weight: 600;
}
.phm-category-list a.is-active .dashicons,
.phm-cat-link.is-active .dashicons { color: #fff; }

.phm-cat-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.phm-cat-count {
    background: var(--phm-bg);
    color: var(--phm-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    min-width: 22px;
    text-align: center;
}

.phm-category-list a.is-active .phm-cat-count,
.phm-cat-link.is-active .phm-cat-count {
    background: rgba(255,255,255,.25);
    color: #fff;
}

.phm-cat-empty {
    color: var(--phm-muted);
    font-size: 13px;
    padding: 8px 10px;
    font-style: italic;
}

.phm-archive-content {
    background: var(--phm-bg);
    border: 1px solid var(--phm-border);
    border-radius: var(--phm-radius);
    padding: 24px 28px 28px;
}

.phm-archive-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin: 0 0 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--phm-border);
}

.phm-page-title {
    margin: 0;
    font-size: 24px;
    line-height: 1.3;
    color: var(--phm-text);
}

.phm-archive-count {
    font-size: 13px;
    color: var(--phm-muted);
    white-space: nowrap;
}

.phm-no-results {
    text-align: center;
    color: var(--phm-muted);
    font-size: 14px;
    padding: 60px 0;
}

/* Grid de fotos — mosaico (estilo Pinterest) montado via JS (ver
   initMasonry em photo-hub.js), que posiciona cada card na coluna mais
   curta. Isso evita espaços vazios quando há fotos horizontais/quadradas
   misturadas com verticais, independente da ordem de envio. */
.phm-photo-grid {
    position: relative;
}

.phm-card {
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    background: var(--phm-surface);
    border: 1px solid var(--phm-border);
    border-radius: var(--phm-radius);
    overflow: hidden;
    transition: transform .15s ease, top .25s ease, left .25s ease, width .25s ease;
    visibility: hidden; /* evita "flash" no canto superior esquerdo antes do JS calcular a posição */
}
.phm-card.is-placed { visibility: visible; }
.phm-card:hover { transform: translateY(-3px); }

.phm-card-thumb {
    position: relative;
    display: block;
    /* Sem aspect-ratio fixo: cada foto mantém sua proporção vertical
       natural, formando o efeito de mosaico (masonry). */
    background: var(--phm-border);
    overflow: hidden;
}

.phm-card-img { width: 100%; height: auto; display: block; }

.phm-card-placeholder {
    display: flex; align-items: center; justify-content: center;
    aspect-ratio: 3 / 4; font-size: 32px; color: var(--phm-muted);
}

.phm-card-play {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 26px;
    background: rgba(0,0,0,0.15);
    opacity: 0; transition: opacity .15s ease;
}
.phm-card:hover .phm-card-play { opacity: 1; }

.phm-card-body { padding: 12px 14px; }
.phm-card-category {
    font-size: 11px; text-transform: uppercase; color: var(--phm-accent); font-weight: 700;
}
.phm-card-title { font-size: 15px; margin: 6px 0 0; line-height: 1.35; }
.phm-card-title a { color: var(--phm-text); text-decoration: none; }

/* Exibição da foto na página individual */
.phm-single-photo {
    background: var(--phm-surface);
    border: 1px solid var(--phm-border);
    border-radius: var(--phm-radius);
    padding: 24px 28px 28px;
}

.phm-photo-title {
    margin: 0 0 10px;
    font-size: 26px;
    line-height: 1.3;
    color: var(--phm-text);
}

.phm-photo-meta {
    color: var(--phm-muted);
    font-size: 13px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--phm-border);
}

.phm-photo-meta > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.phm-photo-cat-tag {
    display: inline-flex;
    align-items: center;
    color: var(--phm-accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .3px;
    background: var(--phm-bg);
    border: 1px solid var(--phm-border);
    border-radius: 999px;
    padding: 4px 12px;
    transition: background .2s ease, color .2s ease;
}
.phm-photo-cat-tag:hover {
    background: var(--phm-accent);
    color: #fff;
    border-color: var(--phm-accent);
}

.phm-photo-content { margin-top: 4px; }

.phm-photo-wrapper { margin: 0 0 20px; text-align: center; }
.phm-photo-wrapper .phm-photo-img {
    max-width: 100%;
    height: auto;
    border-radius: var(--phm-radius);
    display: inline-block;
    box-shadow: 0 2px 14px rgba(0,0,0,.08);
}
.phm-photo-lightbox-trigger { display: inline-block; cursor: zoom-in; }
.phm-photo-unavailable {
    display: flex; align-items: center; justify-content: center;
    aspect-ratio: 3 / 4; max-width: 480px; margin: 0 auto;
    background: var(--phm-bg); color: var(--phm-muted);
    border-radius: var(--phm-radius);
}

.phm-related-photos {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--phm-border);
}
.phm-related-photos h2 {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--phm-text);
}

/* Paginação */
.phm-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 34px;
    flex-wrap: wrap;
}
.phm-pagination a, .phm-pagination span {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--phm-border);
    text-decoration: none;
    color: var(--phm-text);
    font-size: 14px;
    background: var(--phm-surface);
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.phm-pagination a:hover { background: var(--phm-bg); border-color: var(--phm-accent); color: var(--phm-accent); }
.phm-pagination .current { background: var(--phm-accent); color: #fff; border-color: var(--phm-accent); }

.phm-loading-more { text-align: center; color: var(--phm-muted); padding: 24px 0; font-size: 13px; }

/* Footer */
.phm-footer {
    border-top: 1px solid var(--phm-border);
    padding: 24px 0;
    color: var(--phm-muted);
    font-size: 13px;
    text-align: center;
}

/* Responsivo */
@media (max-width: 900px) {
    .phm-hamburger { display: flex; }

    .phm-layout { grid-template-columns: 1fr; }

    .phm-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 260px;
        max-width: 80vw;
        background: var(--phm-surface);
        border-right: 1px solid var(--phm-border);
        padding: 20px;
        overflow-y: auto;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform .25s ease;
    }

    .phm-sidebar.is-open {
        transform: translateX(0);
    }

    .phm-sidebar-close {
        display: flex;
        position: absolute;
        top: 14px;
        right: 14px;
    }

    .phm-sidebar h3:first-of-type { margin-top: 44px; }
}

@media (max-width: 600px) {
    .phm-header-inner { flex-wrap: wrap; }
    .phm-photo-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .phm-single-photo { padding: 18px 16px 20px; }
    .phm-photo-title { font-size: 21px; }
    .phm-archive-content { padding: 18px 16px 20px; }
}

/* ==========================================================================
   Comentários (markup padrão do comments_template() do WordPress)
   ========================================================================== */
.phm-comments {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--phm-border);
}

.phm-comments h2,
.phm-comments h3,
.phm-comments .comments-title,
.phm-comments .comment-reply-title {
    font-size: 20px;
    margin: 0 0 20px;
    color: var(--phm-text);
}
.phm-comments .comment-reply-title small a {
    font-size: 13px;
    color: var(--phm-muted);
    margin-left: 8px;
}

/* Lista de comentários */
.phm-comments .comment-list {
    list-style: none;
    margin: 0 0 30px;
    padding: 0;
}
.phm-comments .comment-list .children {
    list-style: none;
    margin: 0;
    padding-left: 28px;
}
.phm-comments .comment-list > li + li,
.phm-comments .comment-list .children > li {
    margin-top: 18px;
}

.phm-comments .comment-body {
    background: var(--phm-surface);
    border: 1px solid var(--phm-border);
    border-radius: var(--phm-radius);
    padding: 16px 18px;
}

.phm-comments .comment-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.phm-comments .comment-author .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: block;
}
.phm-comments .comment-author .fn {
    font-weight: 600;
    font-style: normal;
    color: var(--phm-text);
}
.phm-comments .comment-author .says { display: none; }

.phm-comments .comment-metadata {
    font-size: 12px;
    color: var(--phm-muted);
    margin-bottom: 10px;
}
.phm-comments .comment-metadata a {
    color: var(--phm-muted);
    text-decoration: none;
}
.phm-comments .comment-metadata a:hover { text-decoration: underline; }

.phm-comments .comment-content p {
    margin: 0 0 10px;
    color: var(--phm-text);
    line-height: 1.6;
    font-size: 14px;
}
.phm-comments .comment-content p:last-child { margin-bottom: 0; }

.phm-comments .reply {
    margin-top: 10px;
}
.phm-comments .comment-reply-link {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: var(--phm-accent);
    text-decoration: none;
    border: 1px solid var(--phm-border);
    border-radius: 999px;
    padding: 4px 12px;
}
.phm-comments .comment-reply-link:hover {
    background: var(--phm-accent);
    border-color: var(--phm-accent);
    color: #fff;
}

.phm-comments .comment-awaiting-moderation {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    font-style: italic;
    color: var(--phm-muted);
}

.phm-comments .comment-navigation {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 13px;
}
.phm-comments .comment-navigation a { color: var(--phm-accent); text-decoration: none; }

.phm-comments .no-comments {
    color: var(--phm-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

/* Formulário de comentário */
.phm-comments #respond,
.phm-comments .comment-respond {
    background: var(--phm-surface);
    border: 1px solid var(--phm-border);
    border-radius: var(--phm-radius);
    padding: 20px;
}

.phm-comments .comment-notes,
.phm-comments .logged-in-as {
    font-size: 13px;
    color: var(--phm-muted);
    margin: 0 0 16px;
}
.phm-comments .logged-in-as a { color: var(--phm-accent); }

.phm-comments .comment-form-comment,
.phm-comments .comment-form-author,
.phm-comments .comment-form-email,
.phm-comments .comment-form-url,
.phm-comments .comment-form-cookies-consent {
    margin-bottom: 14px;
}

.phm-comments label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--phm-text);
    margin-bottom: 6px;
}

.phm-comments textarea#comment,
.phm-comments input#author,
.phm-comments input#email,
.phm-comments input#url {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--phm-text);
    background: var(--phm-bg);
    border: 1px solid var(--phm-border);
    border-radius: 8px;
    transition: border-color .15s ease;
}
.phm-comments textarea#comment {
    min-height: 110px;
    resize: vertical;
}
.phm-comments textarea#comment:focus,
.phm-comments input#author:focus,
.phm-comments input#email:focus,
.phm-comments input#url:focus {
    outline: none;
    border-color: var(--phm-accent);
}

.phm-comments .comment-form-cookies-consent {
    display: flex;
    align-items: center;
    gap: 8px;
}
.phm-comments .comment-form-cookies-consent label {
    margin: 0;
    font-weight: 400;
    font-size: 12px;
    color: var(--phm-muted);
}

.phm-comments .form-submit {
    margin: 6px 0 0;
}
.phm-comments #submit {
    background: var(--phm-accent);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s ease;
}
.phm-comments #submit:hover { opacity: .9; }

@media (max-width: 600px) {
    .phm-comments .comment-list .children { padding-left: 14px; }
}
/* Lightbox — visualização ampliada da foto */
.phm-lightbox-overlay {
    position: fixed; inset: 0; z-index: 9999;
    display: none; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.9); padding: 30px;
}
.phm-lightbox-overlay.is-open { display: flex; }
.phm-lightbox-img { max-width: 100%; max-height: 100%; border-radius: 6px; }
.phm-lightbox-close {
    position: absolute; top: 16px; right: 20px;
    background: none; border: 0; color: #fff; font-size: 34px;
    line-height: 1; cursor: pointer;
}
