/* -----------------------------------------------
   WP Photo Proofing — Frontend Styles
   Theme-hardened: explicit resets prevent theme CSS bleed
----------------------------------------------- */

/* -----------------------------------------------
   Theme isolation — reset common elements inside our containers
----------------------------------------------- */
.wppp-gallery,
.wppp-gallery *,
.wppp-password-wrap,
.wppp-password-wrap *,
.wppp-modal,
.wppp-modal *,
#wppp-lightbox,
#wppp-lightbox * {
    box-sizing: border-box;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.wppp-gallery h2,
.wppp-gallery h3,
.wppp-password-wrap h2,
.wppp-modal h3,
.wppp-confirmed-banner h2 {
    font-family: inherit;
    letter-spacing: normal;
    text-transform: none;
    line-height: 1.3;
    color: #222;
}

.wppp-gallery p,
.wppp-password-wrap p,
.wppp-modal p {
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: normal;
    text-transform: none;
}

.wppp-gallery img,
#wppp-lightbox img {
    max-width: 100%;
    height: auto;
    border: none;
    box-shadow: none;
    outline: none;
    padding: 0;
    margin: 0;
}

.wppp-gallery button,
.wppp-password-wrap button,
.wppp-modal button {
    font-family: inherit;
    line-height: 1.5;
    letter-spacing: normal;
    text-transform: none;
    text-decoration: none;
    box-shadow: none;
    outline: none;
}

/* -----------------------------------------------
   Password form
----------------------------------------------- */
.wppp-password-wrap {
    --wppp-accent: #2271b1;
    max-width: 420px;
    margin: 40px auto;
    padding: 36px 32px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 16px rgba(0,0,0,0.07);
}
.wppp-password-wrap h2 {
    margin-top: 0;
    margin-bottom: 20px;
}
.wppp-password-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    text-align: left;
}
.wppp-password-form input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
    box-sizing: border-box;
    background: #fff;
    color: #222;
}
.wppp-password-form button {
    background: var(--wppp-accent, #2271b1);
    color: #fff;
    border: none;
    padding: 11px 28px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    transition: filter 0.15s;
}
.wppp-password-form button:hover {
    filter: brightness(0.85);
}

.wppp-error {
    color: #c00;
    margin: 8px 0;
    font-size: 14px;
}

/* -----------------------------------------------
   Gallery wrapper
----------------------------------------------- */
.wppp-gallery {
    --wppp-accent: #2271b1;
    max-width: 1200px;
    margin: 0 auto;
}

/* Brand logo */
.wppp-brand-logo {
    max-height: 60px;
    margin-bottom: 12px;
    display: block;
}

.wppp-header {
    margin-bottom: 20px;
}
.wppp-header h2 { margin-bottom: 4px; }
.wppp-greeting { margin: 0 0 4px; color: #555; }
.wppp-round-note { margin: 0 0 4px; color: #888; font-size: 13px; font-style: italic; }
.wppp-subtitle  { margin: 0 0 12px; color: #666; }
.wppp-selection-count {
    font-size: 18px;
    font-weight: 700;
    color: var(--wppp-accent, #2271b1);
}

/* -----------------------------------------------
   Tabs
----------------------------------------------- */
.wppp-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
}
.wppp-tab {
    padding: 10px 22px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.wppp-tab:hover  { color: var(--wppp-accent, #2271b1); }
.wppp-tab.active { color: var(--wppp-accent, #2271b1); border-bottom-color: var(--wppp-accent, #2271b1); }

.wppp-tab-content         { display: none; }
.wppp-tab-content.active  { display: block; }

/* -----------------------------------------------
   Mosaic grid
----------------------------------------------- */
.wppp-mosaic {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

/* -----------------------------------------------
   Individual photo tile
----------------------------------------------- */
.wppp-photo {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 6px;
    border: 3px solid transparent;
    aspect-ratio: 1 / 1;
    background: #f0f0f0;
    transition: border-color 0.15s, transform 0.1s;
}
.wppp-photo:hover {
    transform: scale(1.02);
    border-color: var(--wppp-accent, #2271b1);
    opacity: 0.85;
}
.wppp-photo.selected {
    border-color: var(--wppp-accent, #2271b1);
}
.wppp-photo.confirmed {
    cursor: default;
    border-color: var(--wppp-accent, #2271b1);
}
.wppp-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.15s;
}
.wppp-photo.selected img { opacity: 0.75; }

/* -----------------------------------------------
   Checkmark badge
----------------------------------------------- */
.wppp-check {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 28px;
    height: 28px;
    background: var(--wppp-accent, #2271b1);
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.15s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.wppp-photo.selected .wppp-check,
.wppp-photo.confirmed .wppp-check {
    opacity: 1;
}

/* -----------------------------------------------
   Comment badge — bottom-left icon, visible when photo has a comment
----------------------------------------------- */
.wppp-comment-badge {
    position: absolute;
    bottom: 7px;
    left: 7px;
    width: 26px;
    height: 26px;
    background: rgba(0,0,0,0.45);
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    cursor: pointer;
    z-index: 6;
}
.wppp-comment-badge.has-comment {
    opacity: 1;
    background: var(--wppp-accent, #2271b1);
}
.wppp-photo:hover .wppp-comment-badge {
    opacity: 0.8;
}
.wppp-comment-badge:hover {
    opacity: 1 !important;
}

/* Comment popup */
.wppp-comment-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 10px;
    padding: 24px 28px;
    z-index: 9999;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}
.wppp-comment-popup h4 {
    margin: 0 0 12px;
    font-size: 17px;
    font-weight: 700;
    color: #222;
}
.wppp-comment-popup textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
    background: #fff;
    color: #222;
}
.wppp-comment-actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
}
#wppp-comment-save {
    background: var(--wppp-accent, #2271b1);
    color: #fff;
    border: none;
    padding: 9px 22px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    flex: 1;
    transition: filter 0.15s;
}
#wppp-comment-save:not(:disabled):hover { filter: brightness(0.85); }
#wppp-comment-save:disabled { background: #bbb; cursor: not-allowed; }
#wppp-comment-cancel {
    background: #f0f0f0;
    border: 1px solid #ccc;
    padding: 9px 22px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}
#wppp-comment-cancel:hover { background: #e4e4e4; }

/* -----------------------------------------------
   Star ratings on photo tiles
----------------------------------------------- */
.wppp-stars {
    position: absolute;
    top: 7px;
    left: 7px;
    display: flex;
    gap: 1px;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 6;
}
.wppp-stars.has-rating {
    opacity: 1;
}
.wppp-photo:hover .wppp-stars {
    opacity: 1;
}
.wppp-stars [data-star] {
    font-size: 18px;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    line-height: 1;
    transition: color 0.1s;
}
.wppp-stars [data-star]:hover,
.wppp-stars [data-star].active {
    color: #f5c518;
}

/* Lightbox star rating */
#wppp-lb-stars {
    display: flex;
    gap: 2px;
    align-items: center;
}
#wppp-lb-stars [data-star] {
    font-size: 22px;
    color: #ccc;
    cursor: pointer;
    line-height: 1;
    transition: color 0.1s;
}
#wppp-lb-stars [data-star]:hover,
#wppp-lb-stars [data-star].active {
    color: #f5c518;
}

/* Lightbox controls (slideshow button) */
#wppp-lb-controls {
    display: flex;
    align-items: center;
}
#wppp-lb-slideshow {
    background: none;
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    color: rgba(0,0,0,0.45);
    font-size: 12px;
    cursor: pointer;
    padding: 3px 8px;
    line-height: 1;
    transition: color 0.15s, border-color 0.15s;
}
#wppp-lb-slideshow:hover {
    color: rgba(0,0,0,0.7);
    border-color: rgba(0,0,0,0.4);
}
#wppp-lb-slideshow.playing {
    color: var(--wppp-accent, #2271b1);
    border-color: var(--wppp-accent, #2271b1);
}

/* -----------------------------------------------
   Filename overlay
----------------------------------------------- */
.wppp-filename {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.65));
    color: #fff;
    font-size: 11px;
    padding: 18px 6px 5px;
    opacity: 0;
    transition: opacity 0.15s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wppp-photo:hover .wppp-filename { opacity: 1; }

/* Empty selected tab message */
.wppp-empty-selection {
    color: #888;
    margin: 20px 0;
    font-style: italic;
}

/* -----------------------------------------------
   Confirm bar
----------------------------------------------- */
.wppp-confirm-bar {
    position: sticky;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    border-top: 2px solid #e0e0e0;
    padding: 14px 0;
    margin-top: 28px;
    text-align: right;
    backdrop-filter: blur(4px);
}
.wppp-confirm-button {
    background: var(--wppp-accent, #2271b1);
    color: #fff;
    border: none;
    padding: 12px 32px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s;
}
.wppp-confirm-button:not(:disabled):hover {
    filter: brightness(0.85);
}
.wppp-confirm-button:disabled {
    background: #bbb;
    cursor: not-allowed;
}

/* -----------------------------------------------
   Modal overlay
----------------------------------------------- */
.wppp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9998;
}

/* -----------------------------------------------
   Modal
----------------------------------------------- */
.wppp-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 10px;
    padding: 32px;
    z-index: 9999;
    max-width: 460px;
    width: 90%;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}
.wppp-modal h3 {
    margin-top: 0;
    font-size: 20px;
}
.wppp-modal label {
    display: block;
    margin: 16px 0 5px;
    font-weight: 600;
}
.wppp-modal input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
    box-sizing: border-box;
    background: #fff;
    color: #222;
}
.wppp-modal-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}
#wppp-modal-confirm {
    background: var(--wppp-accent, #2271b1);
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    flex: 1;
    transition: filter 0.15s;
}
#wppp-modal-confirm:not(:disabled):hover {
    filter: brightness(0.85);
}
#wppp-modal-confirm:disabled { background: #bbb; cursor: not-allowed; }
#wppp-modal-cancel {
    background: #f0f0f0;
    border: 1px solid #ccc;
    padding: 10px 22px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
}
#wppp-modal-cancel:hover { background: #e4e4e4; }

/* -----------------------------------------------
   Confirmed state banner
----------------------------------------------- */
.wppp-confirmed-banner {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 18px 22px;
    margin-bottom: 24px;
}
.wppp-confirmed-banner h2 { margin-top: 0; }
.wppp-confirmed-msg  { color: #155724; font-size: 16px; margin: 6px 0 4px; font-weight: 600; }
.wppp-confirmed-note { color: #4a6741; font-size: 14px; margin: 0; }

/* -----------------------------------------------
   Watermark overlay
----------------------------------------------- */
.wppp-watermark,
#wppp-lb-watermark {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    user-select: none;
    z-index: 5;
}
#wppp-lb-watermark { z-index: 1; }

/* -----------------------------------------------
   Download protection — transparent shield
----------------------------------------------- */
.wppp-img-shield {
    position: absolute;
    inset: 0;
    z-index: 4;
    background: transparent;
}

/* -----------------------------------------------
   Action overlay — base layout is inline; CSS handles responsive sizing
----------------------------------------------- */

/* Touch zoom button hidden by default — shown only in touch mode via .wppp-touch */
.wppp-action-zoom-touch {
    display: none;
}

@media (max-width: 480px) {
    .wppp-photo .wppp-actions {
        gap: 8px !important;
    }
    .wppp-photo .wppp-actions > div {
        width: 40px !important;
        height: 40px !important;
    }
    .wppp-photo .wppp-actions svg {
        width: 18px !important;
        height: 18px !important;
    }
}

/* -----------------------------------------------
   Lightbox — appended to <body> to avoid theme stacking issues
----------------------------------------------- */
#wppp-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.97);
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.5;
}

#wppp-lb-img-wrap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 10px 32px;
    box-sizing: border-box;
}
#wppp-lb-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    border: none;
    box-shadow: none;
    outline: none;
}
#wppp-lb-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: #333;
    font-size: 36px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.75;
    padding: 4px 8px;
    z-index: 1;
}
#wppp-lb-close:hover { opacity: 1; }
.wppp-lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.06);
    border: none;
    color: #333;
    font-size: 44px;
    cursor: pointer;
    padding: 14px 16px;
    line-height: 1;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1;
}
#wppp-lightbox:hover .wppp-lb-nav { opacity: 0.6; }
.wppp-lb-nav:hover { opacity: 1 !important; background: rgba(0,0,0,0.12); }
#wppp-lb-prev { left: 6px; }
#wppp-lb-next { right: 6px; }
#wppp-lb-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    color: rgba(0,0,0,0.45);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    z-index: 1;
}

/* -----------------------------------------------
   Responsive — tablets
----------------------------------------------- */
@media (max-width: 768px) {
    .wppp-mosaic {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 6px;
    }
    .wppp-header h2 { font-size: 20px; }
    .wppp-subtitle { font-size: 14px; }

    /* Lightbox info bar — stack vertically */
    #wppp-lb-info {
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 12px;
        justify-content: center;
        text-align: center;
    }
    #wppp-lb-filename {
        width: 100%;
        text-align: center;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* -----------------------------------------------
   Responsive — phones
----------------------------------------------- */
@media (max-width: 480px) {
    .wppp-gallery { padding: 0 4px; }
    .wppp-mosaic {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }
    .wppp-confirm-bar {
        text-align: center;
        padding: 12px 8px;
    }
    .wppp-confirm-button {
        width: 100%;
        padding: 14px 20px;
    }
    .wppp-brand-logo { max-height: 40px; }

    /* Tabs full-width */
    .wppp-tabs { gap: 0; }
    .wppp-tab {
        flex: 1;
        text-align: center;
        padding: 10px 8px;
        font-size: 13px;
    }

    /* Smaller overlays on tiles */
    .wppp-check {
        width: 22px;
        height: 22px;
        font-size: 12px;
        top: 4px;
        right: 4px;
    }
    .wppp-stars {
        top: 4px;
        left: 4px;
    }
    .wppp-stars [data-star] {
        font-size: 14px;
    }
    .wppp-comment-badge {
        width: 22px;
        height: 22px;
        bottom: 4px;
        left: 4px;
    }
    .wppp-comment-badge svg { width: 12px; height: 12px; }
    .wppp-filename {
        font-size: 9px;
        padding: 12px 4px 3px;
    }

    /* Password form */
    .wppp-password-wrap {
        margin: 20px auto;
        padding: 24px 20px;
    }

    /* Lightbox nav — smaller but still tappable */
    .wppp-lb-nav {
        padding: 12px 14px;
        font-size: 30px;
    }
    #wppp-lb-prev { left: 2px; }
    #wppp-lb-next { right: 2px; }
    #wppp-lb-img-wrap { padding: 44px 6px 50px; }
}

/* -----------------------------------------------
   Touch devices — no hover, so show persistent corner icons
----------------------------------------------- */
@media (pointer: coarse) {
    .wppp-lb-nav {
        opacity: 0.5;
        padding: 16px 18px;
        font-size: 32px;
    }
    .wppp-tab { padding: 12px 18px; }
    .wppp-confirm-button { padding: 14px 28px; }
}

/* When JS detects touch: persistent UI, no hover overlay */
.wppp-touch .wppp-photo .wppp-actions {
    display: none !important;
}

/* Always show checkmark circle on touch — faded when unselected, solid when selected */
.wppp-touch .wppp-check {
    opacity: 0.4;
    background: rgba(0,0,0,0.35);
}
.wppp-touch .wppp-photo.selected .wppp-check {
    opacity: 1;
    background: var(--wppp-accent, #2271b1);
}

/* Always show zoom icon — bottom-right corner */
.wppp-touch .wppp-photo .wppp-action-zoom-touch {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0,0,0,0.45);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11;
    cursor: pointer;
}

/* Always show comment badge on touch */
.wppp-touch .wppp-comment-badge {
    opacity: 0.5;
}
.wppp-touch .wppp-comment-badge.has-comment {
    opacity: 1;
}

/* Always show stars on touch */
.wppp-touch .wppp-stars {
    opacity: 0.5;
}
.wppp-touch .wppp-stars.has-rating {
    opacity: 1;
}
