/* ==============================================
   MODULES.CSS - Moduli e Componenti Speciali
   Gallery, Accordion, Modals, Tooltips, etc.
   Botanica Veneta - Tuttifiori
   ============================================== */

/* ==============================================
   1. GALLERY
   ============================================== */

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

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

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

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

/* Gallery Item */
.gallery-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--radius-medium);
    background: linear-gradient(135deg, var(--sabbia-chiara), var(--perla));
    cursor: pointer;
    transition: var(--transition);
}

.gallery-item:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-lg);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.gallery-item:hover img {
    transform: scale(1.08);
}

/* Gallery Overlay */
.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        transparent 60%, 
        rgba(45, 74, 59, 0.8) 100%
    );
    opacity: 0;
    transition: var(--transition);
    display: flex;
    align-items: flex-end;
    padding: var(--space-lg);
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-caption {
    color: white;
    font-size: var(--text-sm);
    transform: translateY(20px);
    transition: var(--transition);
}

.gallery-item:hover .gallery-caption {
    transform: translateY(0);
}

/* Lightbox Base (attivato via JS) */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    padding: var(--space-xl);
    cursor: zoom-out;
}

.lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.lightbox-image {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: var(--space-xl);
    right: var(--space-xl);
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.lightbox-close:hover {
    transform: rotate(90deg);
}

/* ==============================================
   2. ACCORDION / COLLAPSIBLE
   ============================================== */

.accordion {
    border: 0.5px solid var(--perla);
    border-radius: var(--radius-medium);
    overflow: hidden;
    margin-bottom: var(--space-lg);
}

.accordion-item {
    border-bottom: 0.5px solid var(--perla);
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    width: 100%;
    padding: var(--space-lg);
    background: var(--crema);
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.accordion-header:hover {
    background: var(--sabbia-chiara);
}

.accordion-title {
    font-size: var(--text-base);
    font-weight: 400;
    color: var(--verde-botanico);
    margin: 0;
}

.accordion-icon {
    color: var(--oro-caldo);
    font-size: var(--text-lg);
    transition: var(--transition);
    display: inline-block;
}

.accordion-item.active .accordion-icon {
    transform: rotate(45deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-item.active .accordion-content {
    max-height: 500px;
}

.accordion-body {
    padding: 0 var(--space-lg) var(--space-lg);
    color: var(--text-quiet);
    line-height: 1.7;
}

/* Details/Summary native version */
.collapsible {
    border: 0.5px solid var(--perla);
    border-radius: var(--radius-medium);
    margin-bottom: var(--space-md);
    overflow: hidden;
}

.collapsible summary {
    padding: var(--space-lg);
    background: var(--crema);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.collapsible summary:hover {
    background: var(--sabbia-chiara);
}

.collapsible summary::after {
    content: '+';
    color: var(--oro-caldo);
    font-size: var(--text-xl);
    font-weight: 300;
    transition: var(--transition);
}

.collapsible[open] summary::after {
    transform: rotate(45deg);
}

.collapsible-content {
    padding: 0 var(--space-lg) var(--space-lg);
    animation: slideDown 0.3s ease;
}

/* ==============================================
   3. ANNOUNCEMENT BAR
   ============================================== */

.announcement-bar {
    background: var(--verde-botanico);
    color: white;
    padding: var(--space-md) var(--space-lg);
    text-align: center;
    position: relative;
}

.announcement-bar.gradient {
    background: linear-gradient(90deg, var(--verde-botanico) 0%, var(--oro-caldo) 100%);
}

.announcement-bar.light {
    background: var(--sabbia-chiara);
    color: var(--verde-botanico);
}

.announcement-text {
    font-size: var(--text-sm);
    font-weight: 400;
    letter-spacing: 0.02em;
}

.announcement-text a {
    color: var(--oro-caldo);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.announcement-bar.light .announcement-text a {
    color: var(--verde-botanico);
}

.announcement-close {
    position: absolute;
    right: var(--space-lg);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    opacity: 0.8;
    transition: var(--transition);
}

.announcement-close:hover {
    opacity: 1;
    transform: translateY(-50%) rotate(90deg);
}

/* ==============================================
   4. MODAL
   ============================================== */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    padding: var(--space-xl);
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-dialog {
    background: white;
    border-radius: var(--radius-large);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: var(--space-xl);
    border-bottom: 0.5px solid var(--perla);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    color: var(--verde-botanico);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: var(--radius-small);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--sabbia-chiara);
}

.modal-body {
    padding: var(--space-xl);
    overflow-y: auto;
    max-height: calc(90vh - 160px);
}

.modal-footer {
    padding: var(--space-xl);
    border-top: 0.5px solid var(--perla);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
}

/* Modal animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==============================================
   5. TOOLTIPS
   ============================================== */

.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip-trigger {
    border-bottom: 1px dotted var(--text-quiet);
}

.tooltip-content {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--verde-botanico);
    color: white;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-small);
    font-size: var(--text-xs);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--verde-botanico);
}

.tooltip:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* Tooltip positions */
.tooltip-top .tooltip-content {
    bottom: calc(100% + 8px);
    top: auto;
}

.tooltip-bottom .tooltip-content {
    top: calc(100% + 8px);
    bottom: auto;
}

.tooltip-bottom .tooltip-content::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--verde-botanico);
}

/* ==============================================
   6. ALERTS / NOTIFICATIONS
   ============================================== */

.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-medium);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    border: 1px solid;
    position: relative;
}

.alert-success {
    background: rgba(139, 150, 128, 0.1);
    border-color: var(--verde-salvia);
    color: var(--verde-botanico);
}

.alert-info {
    background: rgba(212, 165, 116, 0.1);
    border-color: var(--oro-caldo);
    color: var(--cannella);
}

.alert-warning {
    background: rgba(244, 162, 97, 0.1);
    border-color: #f4a261;
    color: #e76f51;
}

.alert-error {
    background: rgba(220, 53, 69, 0.1);
    border-color: #dc3545;
    color: #dc3545;
}

.alert-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.alert-message {
    font-size: var(--text-sm);
    line-height: 1.6;
}

.alert-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    transition: var(--transition);
}

.alert-close:hover {
    opacity: 1;
}

/* ==============================================
   7. PROGRESS INDICATORS
   ============================================== */

.progress {
    height: 8px;
    background: var(--perla);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--space-md);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--verde-botanico) 0%, var(--oro-caldo) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Progress with label */
.progress-container {
    margin-bottom: var(--space-lg);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
    font-size: var(--text-sm);
}

.progress-label {
    color: var(--text-quiet);
}

.progress-value {
    color: var(--oro-caldo);
    font-weight: 500;
}

/* Circular Progress */
.progress-circle {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.progress-circle svg {
    transform: rotate(-90deg);
}

.progress-circle-bg {
    fill: none;
    stroke: var(--perla);
    stroke-width: 8;
}

.progress-circle-fill {
    fill: none;
    stroke: var(--verde-botanico);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s ease;
}

.progress-circle-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: var(--text-lg);
    color: var(--verde-botanico);
    font-weight: 500;
}

/* ==============================================
   8. TIMELINE
   ============================================== */

.timeline {
    position: relative;
    padding-left: var(--space-xl);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--perla);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-2xl);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: calc(var(--space-xl) * -1 - 6px);
    top: 4px;
    width: 12px;
    height: 12px;
    background: var(--verde-botanico);
    border: 2px solid var(--crema);
    border-radius: 50%;
    z-index: 1;
}

.timeline-item.highlight .timeline-marker {
    background: var(--oro-caldo);
    width: 16px;
    height: 16px;
    left: calc(var(--space-xl) * -1 - 8px);
}

.timeline-date {
    font-size: var(--text-xs);
    color: var(--text-quiet);
    margin-bottom: var(--space-xs);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.timeline-title {
    font-size: var(--text-base);
    color: var(--verde-botanico);
    margin-bottom: var(--space-sm);
    font-weight: 400;
}

.timeline-content {
    font-size: var(--text-sm);
    color: var(--text-quiet);
    line-height: 1.7;
}

/* ==============================================
   9. LOADING STATES
   ============================================== */

.skeleton {
    background: linear-gradient(90deg, 
        var(--perla) 25%, 
        var(--sabbia-chiara) 50%, 
        var(--perla) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-small);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    margin-bottom: var(--space-sm);
    border-radius: var(--radius-small);
}

.skeleton-title {
    height: 28px;
    margin-bottom: var(--space-md);
    width: 60%;
}

.skeleton-card {
    height: 200px;
    border-radius: var(--radius-medium);
    margin-bottom: var(--space-lg);
}

.skeleton-image {
    width: 100%;
    height: 240px;
    border-radius: var(--radius-medium);
}

/* Pulsing dots loader */
.loader-dots {
    display: inline-flex;
    gap: var(--space-xs);
}

.loader-dots span {
    width: 8px;
    height: 8px;
    background: var(--verde-botanico);
    border-radius: 50%;
    animation: pulse 1.4s ease-in-out infinite;
}

.loader-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loader-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ==============================================
   10. DECORATIVE ELEMENTS
   ============================================== */

/* Flower Divider SVG */
.divider-flower {
    text-align: center;
    margin: var(--space-2xl) 0;
    position: relative;
}

.divider-flower svg {
    width: 60px;
    height: 30px;
    fill: var(--oro-caldo);
    opacity: 0.3;
}

/* Leaf Pattern */
.leaf-pattern {
    position: absolute;
    width: 100px;
    height: 100px;
    opacity: 0.05;
    pointer-events: none;
}

.leaf-pattern::before,
.leaf-pattern::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 60px;
    background: var(--verde-botanico);
    border-radius: 0 100% 0 100%;
}

.leaf-pattern::after {
    transform: rotate(90deg);
    left: 30px;
    top: -10px;
}

/* Quote Mark Decoration */
.quote-mark {
    position: relative;
    padding-left: var(--space-2xl);
}

.quote-mark::before {
    content: '"';
    position: absolute;
    left: 0;
    top: -10px;
    font-size: 60px;
    color: var(--oro-caldo);
    opacity: 0.2;
    font-family: var(--font-heading);
}

/* Badge Ribbon */
.ribbon {
    position: absolute;
    top: 20px;
    right: -30px;
    background: var(--oro-caldo);
    color: white;
    padding: var(--space-sm) var(--space-xl);
    transform: rotate(45deg);
    font-size: var(--text-xs);
    font-weight: 500;
    letter-spacing: 0.02em;
    box-shadow: var(--shadow-md);
    z-index: 10;
}