/* Contributor Photo Gallery — frontend.css
   Adjustments: refined circle/card visuals and caption typography for a cleaner, modern look.
   Only circle-related rules and caption text styles were updated; other styles preserved.
*/

/* ====== BASE GALLERY GRID ====== */
.cpg-gallery-grid {
    display: grid;
    gap: 1.5rem;
    padding: 1rem 0;
}

/* ====== CARD STYLES ====== */

/* Default Card Style */
.cpg-photo-card.cpg-style-default {
    background: var(--cpg-card-bg, #fff);
    border-radius: 8px;
    overflow: hidden;
    border: var(--cpg-card-border, 1px solid #e5e5e5);
    box-shadow: var(--cpg-card-shadow, 0 1px 3px rgba(0, 0, 0, 0.1));
    transition: all 0.3s ease;
}

.cpg-photo-card.cpg-style-default:hover {
    transform: translateY(-2px);
    box-shadow: var(--cpg-card-shadow-hover, 0 4px 12px rgba(0, 0, 0, 0.15));
}

/* Polaroid Style */
.cpg-photo-card.cpg-style-polaroid {
    background: var(--cpg-card-bg, #ffffff);
    padding: 12px 12px 0;
    border-radius: 4px;
    border: var(--cpg-card-border, 1px solid #e5e5e5);
    box-shadow: var(--cpg-card-shadow, 0 2px 8px rgba(0, 0, 0, 0.1));
    transition: all 0.3s ease;
}

.cpg-photo-card.cpg-style-polaroid:hover {
    transform: translateY(-3px) rotate(1deg);
    box-shadow: var(--cpg-card-shadow-hover, 0 6px 20px rgba(0, 0, 0, 0.15));
}

.cpg-photo-card.cpg-style-polaroid .cpg-photo-image {
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.cpg-photo-card.cpg-style-polaroid .cpg-photo-content {
    padding: 8px 4px 12px;
    text-align: center;
}

.cpg-photo-card.cpg-style-polaroid .cpg-photo-content p {
    font-family: "Courier New", Courier, monospace;
    font-size: 13px;
    color: #222;
    margin: 0;
    line-height: 1.4;
    letter-spacing: 0.4px;
    text-align: left; /* typewriter vibe feels more natural left aligned */
	 text-shadow: 0.5px 0.8px 0 rgba(0,0,0,0.05);
    opacity: 0.96;
}

/* ====== ENHANCED CIRCLE STYLE (REFINED) ====== */
/* Reworked to remove heavy/dashed visuals and provide a subtle outer ring + soft shadow.
   Preserves core layout but improves visual polish and consistency across themes.
*/

.cpg-photo-card.cpg-style-circle {
    background: transparent;
    border: none;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    box-shadow: none;
    /* keep height flexible — allow captions to size card naturally */
    min-height: auto;
}

/* circular image wrapper — keeps a perfect square and a refined outer ring via ::before */
.cpg-photo-card.cpg-style-circle .cpg-photo-image {
    width: 200px;
    height: 200px;
    position: relative;
    border-radius: 50%;
    overflow: visible;
    /* allow pseudo-element ring to sit outside */
    box-shadow: none;
    transition: transform 260ms cubic-bezier(.2, .9, .2, 1), box-shadow 260ms ease;
    flex-shrink: 0;
    margin: 0 auto 14px;
    display: block;
    aspect-ratio: 1 / 1;
    background: transparent;
}

/* subtle outer ring using a pseudo-element so the image itself remains untouched */
.cpg-photo-card.cpg-style-circle .cpg-photo-image::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% + 12px);
    height: calc(100% + 12px);
    border-radius: 50%;
    border: 3px solid rgba(59, 130, 246, 0.10);
    /* soft accent ring (tune via CSS variable if needed) */
    box-shadow: 0 10px 28px rgba(12, 20, 30, 0.06);
    /* soft outer shadow */
    pointer-events: none;
    z-index: 1;
    box-sizing: border-box;
}

/* image itself — full cover, centered, and clipped to circle */
.cpg-photo-card.cpg-style-circle .cpg-photo-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    border-radius: 50%;
    display: block;
    z-index: 2;
}

/* link container within circle card */
.cpg-photo-card.cpg-style-circle a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    width: 100%;
}

/* hover/focus behaviour — refined scale and shadow */
.cpg-photo-card.cpg-style-circle:hover .cpg-photo-image,
.cpg-photo-card.cpg-style-circle:focus-within .cpg-photo-image {
    transform: translateY(-6px);
    /* slightly stronger shadow on hover for depth */
    box-shadow: 0 12px 34px rgba(12, 20, 30, 0.08);
}

/* caption container for circle style */
.cpg-photo-card.cpg-style-circle .cpg-photo-content {
    padding: 10px 0 0;
    background: transparent;
    text-align: center;
    width: 100%;
}

/* no-captions adjustments */
.cpg-gallery-grid.cpg-no-captions .cpg-photo-card.cpg-style-circle {
    min-height: 0;
}

.cpg-gallery-grid.cpg-no-captions .cpg-photo-card.cpg-style-circle .cpg-photo-image {
    margin-bottom: 0;
}

/* RESPONSIVE: Mobile optimization */
@media (max-width: 768px) {
    .cpg-photo-card.cpg-style-circle .cpg-photo-image {
        width: 160px;
        height: 160px;
    }
}

@media (max-width: 480px) {
    body .cpg-gallery-grid .cpg-photo-card.cpg-style-circle .cpg-photo-image {
        width: 120px;
        height: 120px;
    }
}

/* ====== COMMON STYLES ====== */
.cpg-photo-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cpg-photo-content {
    padding: 1rem;
}

/* Updated caption typography for a cleaner, modern and slightly bolder look */
.cpg-photo-content p {
    margin: 0;
    font-size: 15px;
    color: var(--cpg-caption-color, #2c3338);
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
}

.columns-6 .cpg-photo-content p {
    font-size: 11px;
}

/* Hide captions when disabled */
.cpg-gallery-grid.cpg-no-captions .cpg-photo-content {
    display: none !important;
}

.cpg-photos-error {
    padding: 1rem;
    background: #fff3cd;
    border: 1px solid #f0ad4e;
    border-radius: 8px;
    color: #856404;
}

/* ====== RESPONSIVE DESIGN ====== */
@media (max-width: 768px) {
    .cpg-gallery-grid {
        gap: 1rem;
    }

    .cpg-photo-card.cpg-style-fixed .cpg-photo-image {
        height: 150px;
    }

    .cpg-photo-card.cpg-style-polaroid {
        padding: 8px 8px 0;
    }

    body .cpg-gallery-grid.columns-6 {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    body .cpg-gallery-grid.columns-5,
    body .cpg-gallery-grid.columns-4 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 576px) {

    body .cpg-gallery-grid.columns-6,
    body .cpg-gallery-grid.columns-5,
    body .cpg-gallery-grid.columns-4,
    body .cpg-gallery-grid.columns-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .cpg-gallery-grid {
        gap: 0.75rem;
    }

    .cpg-photo-card.cpg-style-fixed .cpg-photo-image {
        height: 120px;
    }

    body .cpg-gallery-grid.columns-6,
    body .cpg-gallery-grid.columns-5,
    body .cpg-gallery-grid.columns-4,
    body .cpg-gallery-grid.columns-3 {
        grid-template-columns: repeat(1, 1fr) !important;
    }
}

/* ====== HIGH SPECIFICITY CIRCLE FIXES (kept but refined) ====== */
/* These stronger selectors remain to guard against theme overrides but are less invasive */
.cpg-gallery-grid .cpg-photo-card.cpg-style-circle .cpg-photo-image {
    width: 100%;
    height: auto;
    border-radius: 50%;
    overflow: visible;
    position: relative;
    aspect-ratio: 1 / 1;
}

.cpg-gallery-grid .cpg-photo-card.cpg-style-circle .cpg-photo-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 50%;
}

/* Ensure circle cards don't inherit theme background/borders */
.cpg-gallery-grid .cpg-photo-card.cpg-style-circle {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

/* Strengthen the no-captions rule so frontend theme CSS won't override it */
.cpg-gallery-grid.cpg-no-captions .cpg-photo-content {
    display: none !important;
}

/* ====== GRID COLUMN HELPERS (ensure these exist in your critical CSS or main stylesheet) ====== */
.cpg-gallery-grid.columns-1 {
    grid-template-columns: repeat(1, 1fr);
}

.cpg-gallery-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.cpg-gallery-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.cpg-gallery-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.cpg-gallery-grid.columns-5 {
    grid-template-columns: repeat(5, 1fr);
}

.cpg-gallery-grid.columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* Admin styles — additions for slider display and user-id validation status
   Merge these rules into your existing admin.css (or replace file).
*/

/* Field status messages (under inputs) */
.cpg-field-status {
    margin-top: 6px;
    min-height: 18px;
    font-size: 13px;
    line-height: 1.25;
    color: #374151;
}

.cpg-field-status.cpg-status-error {
    color: #b91c1c;
    /* red-700 */
}

.cpg-field-status.cpg-status-success {
    color: #065f46;
    /* green-800 */
}

/* Range slider display (right side badge) */
.cpg-range-value {
    display: inline-block;
    background: #111827;
    color: #fff;
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 6px 16px rgba(2, 6, 23, 0.16);
}

/* When slider is used inline, ensure it's full-width on small screens */
.cpg-range-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cpg-range-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #e6e7ea;
    outline: none;
}

.cpg-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #111827;
    box-shadow: 0 6px 18px rgba(2, 6, 23, 0.16);
    cursor: pointer;
    border: 4px solid #ffffff;
}

.cpg-range-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #111827;
    cursor: pointer;
    border: 4px solid #ffffff;
}

/* Responsive tweak: on narrow screens place badge below slider */
@media (max-width: 640px) {
    .cpg-range-container {
        flex-direction: column;
        align-items: stretch;
    }

    .cpg-range-value {
        align-self: flex-end;
    }
}

/* ===== FIX: lock image frames for all NON-circle cards, keep current look ===== */

/* 1) Make the wrapper define the frame (so every upload crops consistently) */
.cpg-photo-card:not(.cpg-style-circle) .cpg-photo-image {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 3;          /* matches your current ratio comment */
    overflow: hidden;              /* ensures rounded corners actually clip */
  }
  
  /* 2) Make the image fill that frame without distortion */
  .cpg-photo-card:not(.cpg-style-circle) .cpg-photo-image img {
    position: absolute;
    inset: 0;                      /* top/right/bottom/left: 0 */
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }
  
  /* 3) Polaroid-specific: keep your rounded image corners while using the wrapper frame */
  .cpg-photo-card.cpg-style-polaroid .cpg-photo-image {
    aspect-ratio: 3 / 3;           /* same visual as before */
    margin-bottom: 8px;            /* keep your spacing */
  }
  .cpg-photo-card.cpg-style-polaroid .cpg-photo-image img {
  }
  
  /* 4) Circle guard: ensure nothing above affects circles */
  .cpg-photo-card.cpg-style-circle .cpg-photo-image {
    aspect-ratio: 1 / 1 !important;
    overflow: hidden;
  }

/* Base: make "fixed" style fluid */
.cpg-photo-card.cpg-style-fixed .cpg-photo-image {
  width: 100%;
  aspect-ratio: var(--cpg-fixed-ratio, 4 / 3);
  height: auto !important;
  position: relative;
  overflow: hidden;
}
.cpg-photo-card.cpg-style-fixed .cpg-photo-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Tune the ratio by column density */
.cpg-gallery-grid.columns-1 .cpg-photo-card.cpg-style-fixed .cpg-photo-image { --cpg-fixed-ratio: 16 / 9; }
.cpg-gallery-grid.columns-2 .cpg-photo-card.cpg-style-fixed .cpg-photo-image { --cpg-fixed-ratio: 4 / 3; }
.cpg-gallery-grid.columns-3 .cpg-photo-card.cpg-style-fixed .cpg-photo-image { --cpg-fixed-ratio: 4 / 3; }
.cpg-gallery-grid.columns-4 .cpg-photo-card.cpg-style-fixed .cpg-photo-image { --cpg-fixed-ratio: 3 / 2; }
.cpg-gallery-grid.columns-6 .cpg-photo-card.cpg-style-fixed .cpg-photo-image { --cpg-fixed-ratio: 1 / 1; }

/* Safety: remove legacy small-screen heights */
@media (max-width: 768px),
       (max-width: 480px) {
  .cpg-photo-card.cpg-style-fixed .cpg-photo-image { 
	  height: auto !important; 
		   }
}
