/**
 * Patient Gallery - Optimized CSS
 * Consolidated styles for Patient Gallery plugin
 * Version: 2.0.0
 */

/* ========================================
   CSS Variables
   ======================================== */
:root {
    --pg-primary-color: #007bff;
    --pg-border-color: #e6e6e6;
    --pg-text-color: #333;
    --pg-bg-white: #fff;
    --pg-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --pg-transition: all 0.3s ease;
    --pg-border-radius: 10px;
    --pg-spacing-sm: 8px;
    --pg-spacing-md: 16px;
    --pg-spacing-lg: 24px;
}

/* ========================================
   Container & Layout
   ======================================== */
.pg-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 16px;
}

/* ========================================
   Grid System
   ======================================== */
.pg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.view-grid::before{
    display: none !important;
}
.view-grid > .photo-card > .photo-content > .photo-images{
    min-width: auto;
}
.view-grid > .photo-card > .photo-content > .photo-images > .image-box > .patient-image-size{
    min-width: auto;
} 
.pg-cases-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

/* Grid View para archive */
.p-gallery-row.view-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.p-gallery-row.view-grid .photo-card {
    width: 100%;
}

.p-gallery-row.view-grid .photo-content > .details {
    display: none;
}

.p-gallery-row.view-grid .photo-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.p-gallery-row.view-grid .image-box {
    width: 100%;
}

/* Responsive para view-grid */
@media (max-width: 1024px) {
    .p-gallery-row.view-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .p-gallery-row.view-grid {
        grid-template-columns: 1fr;
    }
}

.pg-case {
    border: 1px solid var(--pg-border-color);
    border-radius: 5px;
    overflow: hidden;
    background: var(--pg-bg-white);
    width: 48%;
    transition: var(--pg-transition);
}

.pg-case:hover {
    box-shadow: var(--pg-shadow);
    transform: translateY(-2px);
}

/* ========================================
   Child Category Tiles
   ======================================== */
.pg-child-tile {
    border: 1px solid var(--pg-border-color);
    border-radius: var(--pg-border-radius);
    padding: var(--pg-spacing-md);
    text-decoration: none;
    background: var(--pg-bg-white);
    display: block;
    transition: var(--pg-transition);
}

.pg-child-tile:hover {
    box-shadow: var(--pg-shadow);
    transform: translateY(-2px);
    border-color: var(--pg-primary-color);
}

/* ========================================
   Filter Controls
   ======================================== */
.patient-gallery__filters {
    margin-bottom: var(--pg-spacing-lg);
    padding: var(--pg-spacing-md);
    background: #f8f9fa;
    border-radius: var(--pg-border-radius);
}

/* Parent categories */
.parent-categories {
    list-style: none;
    padding: 0;
    margin: 0;
}

.parent-categories .child-categories {
    display: none;
    list-style: none;
    padding-left: 0px;
    
}
ul.parent-categories .child-category-name {
    display: block;
    padding: 10px 4px 10px 40px;
    cursor: pointer;
    list-style: none;
    color: #3f3f3f;
    font-size: 16px;
    margin: 0;
    vertical-align: middle;
    background: #f1f9fb;
}
.parent-categories > li.open .child-categories {
    display: block;
}

.patient-gallery__filter-group {
    margin-bottom: var(--pg-spacing-md);
}

.patient-gallery__filter-group:last-child {
    margin-bottom: 0;
}

.patient-gallery__filter-label {
    display: block;
    margin-bottom: var(--pg-spacing-sm);
    font-weight: 600;
    color: var(--pg-text-color);
}

.patient-gallery__filter-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--pg-border-color);
    border-radius: 5px;
    background: var(--pg-bg-white);
    font-size: 14px;
    transition: var(--pg-transition);
}

.patient-gallery__filter-select:focus {
    outline: none;
    border-color: var(--pg-primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}
.photo-card-list.active, .photo-card-grid.active {
    display: block !important;
}
.photo-card {
    border: 1px solid #f1f8fe !important;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 5px;
}
.photo-content {
    display: flex;
    grid-column-gap: 20px;
}
.photo-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-width: 300px;
}
.image-box.pg-image-box {
    width: 48%;
}
div.patient-image-size {
    position: relative;
    width: 100%;
    overflow: hidden;
    min-width: 150px;
}
img.photo-image {
    aspect-ratio: 4 / 5;
}
.details {
    display: flex;
    flex-direction: column;
    grid-row-gap: 10px;
}
.details p {
    margin-bottom: 0 !important;
    color: #030303 !important;
    font-size: 16px;
    font-weight: 100 !important;
}
.inhead {
    display: block;
    margin-bottom: 0;
    padding: 0;
}
.inhead li {
    list-style: none;
    padding: 5px 10px !important;
    border: 1px solid;
    border-radius: 50px;
    margin: 5px;
    font-size: 14px;
    display: inline-block;
    color: #3f3f3f;
}
.data {
    display: flex;
    flex-direction: row;
}
.patientdata {
    display: flex;
}
.patient-galleries1 ul {
    margin-left: 0;
}

ul.indata {
    padding: 0;
    font-size: 16px;
}
.data li {
    list-style: none;
    color: #3f3f3f;
    font-size: 16px;
}
.patient-galleries1 ul {
    margin-left: 0;
}

.indata1 {
    font-weight: 600;
    width: 225px;
    padding-left: 20px;
    font-size: 16px;
    color: #3f3f3f;
}

.desktop {
    padding-right: 0px !important;
    margin-bottom: 15px;
}
.pg-filter-panel {
    padding: 5px;
    border-radius: 5px;
    height: auto;
}
.pg-filter-panel1 {
    padding: 0 8px 2px 8px;
    height: auto;
}
.pg-filter-panel h4 {
    font-size: 22px;
    color: #3f3f3f;
    font-family: helvatica !important;
}
.pg-form-group {
    border: 1px solid #e4f1fa !important;
    margin-top: 18px;
    border-radius: 5px;
}
.pg-form-group div {
    background-color: #fff;
    width: 100%;
    list-style: none;
    border: 1px silver;
    color: #3f3f3f;
    font-size: 16px;
    margin: 0;
    text-align: left;
    vertical-align: middle;
    margin-bottom: 2px !important;
    justify-content: space-between;
}
.pg-form-group .pg-form-gorup1 span.category-name {
    display: block;
    padding: 5px 15px !important;
    cursor: pointer;
    background-color: #fff;
    list-style: none;
    color: #3f3f3f;
    font-size: 16px;
    margin: 0;
    text-align: left;
    vertical-align: middle;
    margin-bottom: 2px !important;
}
.bi-dot::before {
    width: 24px;
    height: 24px;
    font-size: 30px;
    color: #767676;
}

.bi-dot::before {
    content: "\f2e9";
}
ul.parent-categories, ul.child-categories {
    list-style: none;
    padding: 0;
    margin: 0;
}
ul.parent-categories>li {
    position: relative;
}
ul.parent-categories .category-name {
    display: block;
    padding: 10px 15px;
    cursor: pointer;
    background-color: #fff;
    width: 242px;
    list-style: none;
    border: 1px silver;
    color: #3f3f3f;
    font-size: 16px;
    margin: 0;
    text-align: left;
    vertical-align: middle;
}
.down {
    transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
}

.arrow {
    border: solid #000;
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 3px;
    float: inline-end;
    margin-top: 12px;
}
ul.child-categories {
    display: none;
    position: initial;
}
.pg-filter-panel2 {
    margin-top: 10px;
    padding: 0 8px 2px 8px;
    height: auto;
}
.pg-form-group {
    border: 1px solid #e4f1fa !important;
    margin-top: 18px;
    border-radius: 5px;
}
h2.taxonomy-heading {
    display: block;
    padding: 10px 15px;
    cursor: pointer;
    list-style: none;
    color: #3f3f3f;
    font-size: 16px;
    margin: 0;
    text-align: left;
    vertical-align: middle;
    font-family: Helvatica;
    font-weight: 400;
}
.bi-dot::before {
    width: 24px;
    height: 24px;
    font-size: 30px;
    color: #767676;
}

.bi-dot::before {
    content: "\f2e9";
}
[class^="bi-"]::before, [class*=" bi-"]::before {
    display: inline-block;
    font-family: bootstrap-icons !important;
    font-style: normal;
    font-weight: normal !important;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    vertical-align: text-bottom;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.taxonomy-list {
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
}
.taxonomy-list .term-name {
    font-size: 16px;
}

.taxonomy-list .term-name {
    display: block;
    padding: 5px 4px 10px 40px;
    color: #3f3f3f;
    cursor: pointer;
}
.photo-card:hover {
    background: #f1f9fb;
}
.view-photo-button {
    background-color: #119fc3;
    color: #fff;
    padding: 10px 20px;
    border: none !important;
    text-decoration: none;
    width: 168px;
    transition: all .4s ease;
    margin-top: 60px;
    font-size: 16px;
}
#load-more {
    font-size: 16px;
    background-color: #119fc3;
    color: #fff;
    font-family: Helvatica;
    border: none;
    border-radius: 0;
    padding: 10px 20px;
    width: 168px;
}
.list1 {
    display: flex;
    grid-gap: 14px;
}
.list1 li {
    list-style: none;
}
.list1 li i {
    padding: 5px;
    font-size: 20px;
    font-weight: 900 !important;
    cursor: pointer;
}
.bi-list-ul::before {
    content: "\f455";
}

[class^="bi-"]::before, [class*=" bi-"]::before {
    display: inline-block;
    font-family: bootstrap-icons !important;
    font-style: normal;
    font-weight: normal !important;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    vertical-align: text-bottom;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.bi-grid::before {
    content: "\f3dc";
}

.pg-mobile {
    display: none;
}
.pg-mobile .pg-form-group {
    margin-top: 0px;
}
/* ========================================
   View Toggle (List/Grid)
   ======================================== */
.list1 {
    display: flex;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.list1 li {
    display: inline-block;
    cursor: pointer;
    
    border-radius: 5px;
    transition: var(--pg-transition);
}

.list1 li:hover {
    background: #f8f9fa;
    border-color: var(--pg-primary-color);
}

.list1 li.active-view {
    background: var(--pg-primary-color);
    border-color: var(--pg-primary-color);
}

.list1 li.active-view i {
    color: white;
}

.list1 i {
    font-size: 18px;
    color: #333333;
    transition: var(--pg-transition);
}

.patient-gallery__view-toggle {
    display: flex;
    gap: var(--pg-spacing-sm);
    margin-bottom: var(--pg-spacing-md);
}

.patient-gallery__view-btn {
    padding: 8px 16px;
    border: 1px solid var(--pg-border-color);
    background: var(--pg-bg-white);
    cursor: pointer;
    border-radius: 5px;
    transition: var(--pg-transition);
}

.patient-gallery__view-btn:hover {
    background: #f8f9fa;
}

.patient-gallery__view-btn.active {
    background: var(--pg-primary-color);
    color: white;
    border-color: var(--pg-primary-color);
}

/* ========================================
   Gallery Items
   ======================================== */
.patient-gallery__items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--pg-spacing-lg);
}

.patient-gallery__items.list-view {
    grid-template-columns: 1fr;
}

.patient-gallery__item {
    border: 1px solid var(--pg-border-color);
    border-radius: var(--pg-border-radius);
    overflow: hidden;
    background: var(--pg-bg-white);
    transition: var(--pg-transition);
}

.patient-gallery__item:hover {
    box-shadow: var(--pg-shadow);
    transform: translateY(-2px);
}

.patient-gallery__item-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.patient-gallery__images {
    display: flex;
    gap: 2px;
    height: 300px;
}

.list-view .patient-gallery__images {
    height: 400px;
}

.patient-gallery__image {
    width: 50%;
    object-fit: cover;
}

.patient-gallery__item-info {
    padding: 12px 14px;
}

.patient-gallery__item-title {
    font-weight: 600;
    margin: 0 0 var(--pg-spacing-sm);
    color: var(--pg-text-color);
}

.patient-gallery__item-meta {
    font-size: 14px;
    color: #666;
}

/* ========================================
   Single Patient Gallery
   ======================================== */
.image_section_group {
    margin-bottom: var(--pg-spacing-lg);
}

.image-section {
    margin-bottom: var(--pg-spacing-lg);
    border: 1px solid var(--pg-border-color);
    border-radius: var(--pg-border-radius);
    overflow: hidden;
    background: var(--pg-bg-white);
}

.single-patient-heading {
    padding: var(--pg-spacing-md);
    background: #f8f9fa;
    border-bottom: 1px solid var(--pg-border-color);
}

.single-patient-heading h3 {
    margin: 0;
    font-size: 18px;
    color: var(--pg-text-color);
}

.before-after-container {
    display: flex;
    gap: 2px;
}

.before-after-container img {
    width: 50%;
    height: auto;
    display: block;
}

/* ========================================
   Pagination
   ======================================== */
.pg-pagination {
    margin-top: var(--pg-spacing-lg);
    text-align: center;
}

.pg-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 4px;
    border: 1px solid var(--pg-border-color);
    border-radius: 5px;
    text-decoration: none;
    color: var(--pg-text-color);
    transition: var(--pg-transition);
}

.pg-pagination .page-numbers:hover,
.pg-pagination .page-numbers.current {
    background: var(--pg-primary-color);
    color: white;
    border-color: var(--pg-primary-color);
}

/* ========================================
   Loading State
   ======================================== */
.patient-gallery__items.loading {
    opacity: 0.5;
    pointer-events: none;
}

.patient-gallery__loader {
    text-align: center;
    padding: var(--pg-spacing-lg);
}

/* ========================================
   Magnific Popup Overrides
   ======================================== */
.mfp-wrap {
    z-index: 99999;
}

.mfp-bg {
    z-index: 99998;
}

.mfp-figure figure {
    margin: 0;
}

.mfp-title {
    padding: 10px 0;
    text-align: center;
    color: white;
}

/* ========================================
   Responsive Design
   ======================================== */
@media only screen and (max-width: 1199.98px) {
/* Styles for tablet devices */
    .pg-mobile {
        display: block;
    }

    .desktop {
        display: none !important;
    }
}
@media (max-width: 768px) {
    .pg-mobile {
        display: block;
    }

    .desktop {
        display: none !important;
    }
    .pg-container {
        padding: 0 12px;
        margin: 20px auto;
    }
    
    .pg-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
    }
    
    .pg-cases-grid {
        flex-direction: column;
        gap: 12px;
    }
    
    .pg-case {
        width: 100%;
    }
    
    .patient-gallery__items {
        grid-template-columns: 1fr;
        gap: var(--pg-spacing-md);
    }
    
    .patient-gallery__images {
        height: 200px;
    }
    
    .list-view .patient-gallery__images {
        height: 250px;
    }
    .photo-content,
    .data {
        display: flex;
        flex-direction: column;
    }
    .pg-filter-panel {
        padding: 5px;
        border-radius: 5px;
        height: auto;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
    }
    .pg-mobile > .row > .pg-col-cls:nth-child(1) {
        display: none;
    }
    .pg-filter-panel1 ,
    .pg-filter-panel2{
        margin-top: 10px;
        min-width: 48%;
        min-height: 40px;
        display: flex;
        justify-content: space-between;
        padding: 0 8px 2px 8px !important;
        background: #ffffff;
        align-items: center;
        margin-bottom: 20px;
    }
    .pg-filter-panel1 > h4,
    .pg-filter-panel2 > h4{
        font-size: 16px;
        display: flex;
        justify-content: space-between;
        min-width: 100%;
    }
    .pg-filter-panel1 > h4 > i,
    .pg-filter-panel2 > h4 > i {
        margin-top: 10px;
        height: 8px;
    }
}

@media (max-width: 480px) {
    .before-after-container {
        flex-direction: column;
    }
    
    .before-after-container img {
        width: 100%;
    }
    
    .pg-child-tile {
        padding: 12px;
    }
}

/* ========================================
   Accessibility
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
a:focus-visible,
button:focus-visible,
select:focus-visible {
    outline: 2px solid var(--pg-primary-color);
    outline-offset: 2px;
}

/* ========================================
   Dark Mode Support
   ======================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --pg-bg-white: #1a1a1a;
        --pg-text-color: #e0e0e0;
        --pg-border-color: #333;
    }
    
    .patient-gallery__filters,
    .single-patient-heading {
        background: #222;
    }
    
    .patient-gallery__filter-select {
        background: #1a1a1a;
        color: #e0e0e0;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .patient-gallery__filters,
    .patient-gallery__view-toggle,
    .pg-pagination {
        display: none;
    }
    
    .patient-gallery__items {
        grid-template-columns: 1fr;
    }
    
    .patient-gallery__item {
        page-break-inside: avoid;
        border: 1px solid #000;
    }
}
