/* ============================================
   PORTFOLIO MANAGER - FRONTEND STYLES
   Modern, elegant design for commercial spaces
   ============================================ */

:root {
    --pm-accent: #c8965a;
    --pm-dark-bg: #1a1a2e;
    --pm-text: #e0e0e0;
    --pm-card-bg: #16213e;
    --pm-light-bg: #f8f8f8;
    --pm-border: rgba(200, 150, 90, 0.3);
    --pm-card-ratio: 3/4;
}

/* ============================================
   SINGLE PROJECT PAGE
   ============================================ */

/* Force full width - compatibilità con i temi più comuni */
.pm-fullwidth-page .site-content,
.pm-fullwidth-page .content-area,
.pm-fullwidth-page .entry-content,
.pm-fullwidth-page .post-content,
.pm-fullwidth-page main,
.pm-fullwidth-page #primary,
.pm-fullwidth-page #content,
.pm-fullwidth-page .elementor-section.elementor-section-boxed > .elementor-container,
.pm-fullwidth-page .ast-container,
.pm-fullwidth-page .site-main {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Nasconde sidebar se presente */
.pm-fullwidth-page #secondary,
.pm-fullwidth-page .sidebar,
.pm-fullwidth-page aside.widget-area {
    display: none !important;
}

/* Rimuovi padding del content wrapper del tema */
.pm-fullwidth-page .site-content > .ast-container,
.pm-fullwidth-page .site-content > .container,
.pm-fullwidth-page .site-content > .wrapper {
    max-width: 100% !important;
    padding: 0 !important;
}

.pm-single-project {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* Hero Section */
.pm-hero {
    position: relative;
    width: 100%;
    height: 70vh;
    min-height: 500px;
    max-height: 800px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}

.pm-hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.pm-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.1) 100%);
    z-index: 2;
}

.pm-hero-content {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 40px;
    color: #fff;
}

.pm-hero-category {
    display: inline-block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--pm-accent);
    margin-bottom: 15px;
    font-weight: 600;
}

.pm-hero-title {
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 700;
    line-height: 1.15;
    margin: 0 0 15px 0;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.pm-hero-location {
    font-size: 18px;
    color: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Details Section */
.pm-details-section {
    background: var(--pm-dark-bg);
    padding: 60px 40px;
}

.pm-details-container {
    max-width: 1200px;
    margin: 0 auto;
}

.pm-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0;
    border: 1px solid var(--pm-border);
    border-radius: 12px;
    overflow: hidden;
}

.pm-detail-item {
    padding: 30px;
    border-right: 1px solid var(--pm-border);
    border-bottom: 1px solid var(--pm-border);
    transition: background 0.3s;
}

.pm-detail-item:hover {
    background: rgba(200, 150, 90, 0.05);
}

.pm-detail-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--pm-accent);
    margin-bottom: 8px;
    font-weight: 600;
}

.pm-detail-value {
    font-size: 18px;
    color: var(--pm-text);
    font-weight: 500;
    line-height: 1.4;
}

/* Materiali - riga separata sotto i dettagli */
.pm-details-materiali {
    margin-top: 20px;
    padding: 30px;
    border: 1px solid var(--pm-border);
    border-radius: 12px;
    width: 100%;
}

.pm-details-materiali .pm-detail-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--pm-accent);
    margin-bottom: 10px;
    font-weight: 600;
}

.pm-details-materiali .pm-detail-value {
    font-size: 16px;
    color: var(--pm-text);
    line-height: 1.8;
}

/* Description */
.pm-description-section {
    background: #fff;
    padding: 80px 40px;
}

.pm-description-container {
    max-width: 800px;
    margin: 0 auto;
}

.pm-section-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 30px;
    position: relative;
    padding-bottom: 15px;
}

.pm-section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--pm-accent);
    border-radius: 2px;
}

.pm-description-content {
    font-size: 17px;
    line-height: 1.8;
    color: #555;
}

.pm-description-content p {
    margin-bottom: 20px;
}

/* Gallery Section */
.pm-gallery-section {
    background: var(--pm-light-bg);
    padding: 80px 40px;
}

.pm-gallery-container {
    max-width: 1200px;
    margin: 0 auto;
}

.pm-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.pm-gallery-grid-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    aspect-ratio: 4/3;
    background: #ddd;
}

.pm-gallery-grid-item:first-child {
    grid-column: span 2;
    grid-row: span 2;
}

.pm-gallery-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.pm-gallery-grid-item:hover img {
    transform: scale(1.05);
}

.pm-gallery-grid-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0);
    transition: background 0.3s;
}

.pm-gallery-grid-item:hover::after {
    background: rgba(0,0,0,0.15);
}

/* Lightbox */
.pm-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.pm-lightbox.active {
    display: flex;
}

.pm-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    z-index: 10;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transition: background 0.3s;
}

.pm-lightbox-close:hover {
    background: rgba(255,255,255,0.2);
}

.pm-lightbox img {
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

.pm-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transition: background 0.3s;
}

.pm-lightbox-nav:hover {
    background: rgba(255,255,255,0.2);
}

.pm-lightbox-prev {
    left: 20px;
}

.pm-lightbox-next {
    right: 20px;
}

.pm-lightbox-counter {
    color: rgba(255,255,255,0.6);
    margin-top: 15px;
    font-size: 14px;
    letter-spacing: 2px;
}

/* Back Link */
.pm-back-link-section {
    padding: 40px;
    text-align: center;
    background: #fff;
}

.pm-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--pm-accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
    padding: 12px 30px;
    border: 2px solid var(--pm-accent);
    border-radius: 50px;
}

.pm-back-link:hover {
    background: var(--pm-accent);
    color: #fff;
}

/* ============================================
   PORTFOLIO GRID (shortcode)
   ============================================ */

.pm-portfolio-wrapper {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 0;
}

/* Filters */
.pm-portfolio-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 40px;
}

.pm-filter-btn {
    padding: 10px 24px;
    border: 2px solid #ddd;
    background: transparent;
    color: #666;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.3s;
    font-weight: 500;
}

.pm-filter-btn:hover,
.pm-filter-btn.active {
    border-color: var(--pm-accent);
    color: var(--pm-accent);
    background: rgba(200, 150, 90, 0.05);
}

/* Grid */
.pm-portfolio-grid {
    display: grid;
    gap: 4px;
}

.pm-cols-2 { grid-template-columns: repeat(2, 1fr); }
.pm-cols-3 { grid-template-columns: repeat(3, 1fr); }
.pm-cols-4 { grid-template-columns: repeat(4, 1fr); }

.pm-portfolio-item {
    transition: opacity 0.4s, transform 0.4s;
}

.pm-portfolio-item.pm-hidden {
    opacity: 0;
    transform: scale(0.9);
    position: absolute;
    pointer-events: none;
}

.pm-portfolio-link {
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    aspect-ratio: var(--pm-card-ratio, 3/4);
}

.pm-portfolio-link img,
.pm-portfolio-link > img,
.pm-portfolio-item img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: transform 0.6s ease;
}

.pm-portfolio-link:hover img,
.pm-portfolio-item:hover img {
    transform: scale(1.05) !important;
}

.pm-portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.1) 40%, rgba(0,0,0,0) 60%);
    pointer-events: none;
    z-index: 2;
}

.pm-portfolio-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 25px 28px;
    z-index: 3;
}

.pm-portfolio-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: #fff;
    line-height: 1.3;
}

.pm-portfolio-meta {
    margin: 0;
    font-size: 14px;
    color: rgba(255,255,255,0.75);
}

.pm-no-thumb {
    width: 100%;
    height: 100%;
    background: #2a2a3e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.pm-no-projects {
    text-align: center;
    padding: 60px;
    color: #999;
    font-size: 18px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .pm-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .pm-gallery-grid-item:first-child {
        grid-column: span 2;
    }
    .pm-cols-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .pm-hero {
        height: 50vh;
        min-height: 350px;
    }
    
    .pm-hero-content {
        padding: 30px 20px;
    }
    
    .pm-hero-title {
        font-size: 28px;
    }
    
    .pm-details-section {
        padding: 40px 20px;
    }
    
    .pm-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pm-description-section,
    .pm-gallery-section {
        padding: 50px 20px;
    }
    
    .pm-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .pm-gallery-grid-item:first-child {
        grid-column: span 1;
        grid-row: span 1;
    }
    
    .pm-cols-3,
    .pm-cols-4 { grid-template-columns: repeat(2, 1fr); }
    
    .pm-portfolio-filters {
        gap: 6px;
    }
    
    .pm-filter-btn {
        padding: 8px 16px;
        font-size: 12px;
    }

    .pm-portfolio-title {
        font-size: 16px;
    }
    
    .pm-portfolio-meta {
        font-size: 12px;
    }
    
    .pm-portfolio-info {
        padding: 18px 20px;
    }

    .pm-lightbox-nav {
        width: 44px;
        height: 44px;
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .pm-details-grid {
        grid-template-columns: 1fr;
    }
    
    .pm-detail-item {
        border-right: none;
    }
    
    .pm-cols-2,
    .pm-cols-3,
    .pm-cols-4 { grid-template-columns: 1fr; }
    
    .pm-gallery-grid {
        grid-template-columns: 1fr;
    }
}
