/* Grid Component Frontend Styles */
/*================================*/

/* Base Section & Container */
.pb-grid-section {
    width: 100%;
    min-height: 100vh;
    padding: 60px 20px;
    box-sizing: border-box;
    position: relative;
    background-size: cover;
    background-position: center;
}

.pb-grid-container {
    max-width: 1200px;
    margin: 0 auto;
    position:relative;
    z-index: 2;
}

/* Card Hover Effect */
.pb-grid-card {
    transition: transform 0.3s ease;
}

.pb-grid-card:hover {
    transform: translateY(-5px);
}


/* ============================================
FRONTEND GRID LAYOUT (grid-style-v1)
============================================ */

/* Featured Layout – Top Row */
.pb-grid-featured-top {
    display: flex;
    gap: var(--grid-gap);
    margin-bottom: var(--grid-gap);
}

.pb-grid-col-large {
    flex: 2;
}

.pb-grid-col-small-stack {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--grid-gap);
}

/* Bottom Row (3 equal columns) */
.pb-grid-bottom-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--grid-gap);
}

/* Simple Grid (3 columns) */
.pb-grid-simple {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--grid-gap);
}

/* Card Content Areas */
.pb-grid-card-content {
    padding: 15px;
    min-height: 120px;
}

.pb-grid-card-content-large {
    min-height: 120px;
}

/* Card Images & Placeholders */
.pb-grid-card-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
}
.pb-grid-card-image-large {
    height: 500px;
}
.pb-grid-card-large {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.pb-grid-card-large > div {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pb-grid-image-placeholder {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #a0aec0;
    font-size: 2rem;
    width: 100%;
    text-align: center;
    min-height: 160px;
}

.pb-grid-card-large .pb-grid-image-placeholder {
    min-height: 400px;
}

.pb-grid-image-placeholder i {
    font-size: 3rem;
    margin-bottom: 10px;
}

.pb-grid-image-placeholder span {
    font-size: 0.85rem;
}

/* Full Card Background Fallback (no image) */
.pb-grid-card-full-bg-no-img {
    background: #1a1a1a;
}

/* Card Button */
.pb-grid-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--btn-bg);
    color: var(--btn-text);
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    width: auto;
    max-width: max-content;
    font-family: var(--btn-font);
    font-weight: var(--btn-bold);
    font-style: var(--btn-italic);
    letter-spacing: var(--btn-letter-spacing);
    text-transform: var(--btn-transform);
    transition: all 0.3s ease;
}

.pb-grid-button:hover {
    background: var(--btn-hover-bg) !important;
    color: var(--btn-hover-text) !important;
}

.pb-grid-button-wrapper {
    margin-top: 10px;
    text-align: var(--btn-align);
}

/* Title Overlay for Full Card Mode */
.pb-grid-card-title-overlay {
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 15px 15px;
    z-index: 2;
    text-decoration: none;
}

/* Video Card Overlay (play button when controls are off) */
.pb-grid-video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.pb-grid-video-play-overlay:hover {
    background: rgba(0, 0, 0, 0.2);
}

.pb-grid-video-replay-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    transition: transform 0.2s;
    cursor: pointer;
}

.pb-grid-video-replay-icon:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

/* Global Grid Button (appears below whole grid) */
.pb-grid-global-btn-wrapper {
    text-align: center;
    position: relative;
    z-index: 2;
}

/* Link reset inside cards */
.pb-grid-card a {
    text-decoration: none;
}

/* ============================================
   Admin Settings Styles (Custom Cards UI)
   ============================================ */

.pb-grid-sub-tab-content input[type="radio"] {
    margin: 0;
    accent-color: #2271b1;
}

.pb-grid-sub-tab-content label:has(input[type="radio"]) {
    background: #f0f0f1;
    padding: 6px 14px;
    border-radius: 20px;
    transition: 0.2s;
}

.pb-grid-sub-tab-content label:has(input[type="radio"]:checked) {
    background: #2271b1;
    color: white;
}

.pb-grid-sub-tab-content label:has(input[type="radio"]:checked) span {
    color: white;
}

/* Custom Cards Editor Layout */
.pb-custom-cards-ui {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.pb-custom-card-item {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.pb-custom-card-item > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.pb-custom-card-item h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

/* Radio group styling */
.content-type-radio-group {
    display: flex;
    gap: 20px;
    background: #f6f7f7;
    padding: 8px 16px;
    border-radius: 40px;
    border: 1px solid #e2e4e7;
}

.content-type-radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
}

/* Common field containers */
.pb-custom-card-image-field,
.pb-custom-card-video-field,
.pb-custom-card-text-field {
    margin-bottom: 20px;
    /* No display:block !important – JS will control visibility via classes */
}

/* Hide helper class (used instead of inline style) */
.pb-field-hidden {
    display: none !important;
}

/* Flex row layouts */
.pb-flex-row {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
}

.pb-flex-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Media preview boxes (image, video, poster) */
.pb-media-preview {
    flex-shrink: 0;
    width: 250px;
    height: 150px;
    background: #eaebec;
    border: 2px dashed #c3c4c7;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.pb-media-preview-small {
    width: 100px;
    height: 70px;
}

.pb-media-placeholder {
    color: #646970;
    text-align: center;
}

.pb-media-placeholder i {
    font-size: 32px;
    margin-bottom: 5px;
    display: block;
}

.pb-media-tag {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.pb-media-tag.visible {
    display: block;
}

/* Input wrapper with buttons */
.pb-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pb-input-group input {
    flex: 1;
}

/* Video controls row */
.pb-video-controls {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 5px;
}

/* Toggle custom button style */
.pb-factory-toggle-custom {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f0f0f1;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    color: #50575e;
    transition: all 0.2s;
    cursor: pointer;
}

.pb-factory-toggle-label input:checked + .pb-factory-toggle-custom {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

/* Title + Title Link row */
.pb-card-title-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

/* Button settings row */
.pb-card-button-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eef0f2;
}

.pb-card-button-settings .pb-factory-toggle {
    flex: 0 0 auto;
}

.pb-card-button-settings .pb-factory-fld {
    flex: 1;
    min-width: 150px;
}

/* Full card mode notice */
.pb-fullcard-mode-notice {
    background: #e8f0fe;
    border-left: 4px solid #2271b1;
    padding: 12px 15px;
    margin-top: 15px;
    border-radius: 4px;
}

/* Helper classes for margins */
.pb-mb-20 { margin-bottom: 20px; }
.pb-mt-15 { margin-top: 15px; }
.pb-ml-0 { margin-left: 0; }

/* Alignment options override */
.pb-grid-sub-tab-content .pb-factory-alignment-options label {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.pb-grid-sub-tab-content .pb-factory-alignment-options input:checked + span {
    background: #fff !important;
    color: #2271b1 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.pb-grid-sub-tab-content .pb-factory-alignment-options label:has(input:checked) span {
    color: #2271b1 !important;
}

/* ============================================
   CLASSES FOR DYNAMIC UI (used by JavaScript)
   ============================================ */

/* Card header flex container */
.pb-card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* Editor card item */
.pb-custom-card-editor-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    background: #fefef5;
}

/* Media preview box for editor */
.pb-editor-media-preview {
    flex-shrink: 0;
    width: 250px;
    height: 150px;
    background: #eaebec;
    border: 2px dashed #c3c4c7;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

/* Poster preview box (slightly different border) */
.pb-editor-poster-preview {
    flex-shrink: 0;
    width: 250px;
    height: 150px;
    background: #eaebec;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
}

/* Editor media placeholder */
.pb-editor-media-placeholder {
    color: #646970;
    text-align: center;
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
}

.pb-editor-media-placeholder i {
    font-size: 32px;
    margin-bottom: 5px;
    display: block;
}

/* Editor media tag */
.pb-editor-media-tag {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Flex row for editor fields */
.pb-editor-flex-row {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

/* Right column for editor fields */
.pb-editor-field-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Input group with buttons */
.pb-editor-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pb-editor-input-group input {
    flex: 1;
}

/* Video controls row */
.pb-editor-video-controls {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 5px;
}

/* Title row – two equal columns, each input takes full width */
.pb-editor-title-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

.pb-editor-title-row input {
    width: 100%;
}

.pb-editor-title-row > div {
    flex: 1;
}

/* Button settings row – closer items, not stretching full width */
.pb-editor-button-settings {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    margin-bottom: 15px;
}
/* The toggle (Show Button) keeps its natural width */
.pb-editor-button-settings .pb-factory-toggle {
    flex: 0 0 auto;
}
/* Each input field takes equal space but with a max-width to keep row compact */
.pb-editor-button-settings .pb-factory-fld {
    min-width: 140px;
}
.pb-editor-button-settings input {
    width: 100%;
}
/* Optional: if you want the whole row to occupy about half the card width */
.pb-editor-button-settings { max-width: 60%; }

/* Full width input */
.pb-editor-full-width {
    width: 100%;
}

/* Excerpt field – full width on its own row */
.pb-editor-excerpt-field {
    margin-bottom: 15px;
}

.pb-editor-excerpt-field input {
    width: 100%;
}

/* For textarea in text-only mode */
.pb-custom-card-text-field textarea {
    width: 100%;
}

/* Notice icon spacing */
.pb-editor-notice-icon {
    margin-right: 5px;
}

/* Make the active Content Source button clearly visible */
.pb-button-group-btns .pb-button-group-btn.active {
    background: #2271b1 !important;    /* WordPress blue */
    color: #ffffff !important;         /* white text */
    border-color: #2271b1 !important;
    box-shadow: none;
}

/* Ensure icons also become white */
.pb-button-group-btns .pb-button-group-btn.active i,
.pb-button-group-btns .pb-button-group-btn.active span {
    color: #ffffff !important;
}

/* Optional: keep hover effect consistent */
.pb-button-group-btns .pb-button-group-btn.active:hover {
    background: #135e96 !important;
    color: #ffffff !important;
}
