/**
 * XDOM - Advanced Features Styles
 * File: xdom-advanced.css
 * 
 * Include questo file nel tuo index.php:
 * <link href="css/xdom-advanced.css" rel="stylesheet">
 */

/* ============================================
   1. URGENCY BANNER
   ============================================ */
.urgency-banner {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    color: white;
    padding: 12px 20px;
    text-align: center;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    position: relative;
    z-index: 99;
    animation: slideDown 0.5s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.urgency-banner strong {
    font-weight: 700;
}

#spots-left {
    background: white;
    color: #FF6B6B;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    margin: 0 5px;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@media (max-width: 768px) {
    .urgency-banner {
        font-size: 14px;
        padding: 10px 15px;
    }
}

/* ============================================
   2. TRUST BAR
   ============================================ */
.trust-bar {
    background: #f8f9fa;
    padding: 25px 0;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}

.trust-bar .trust-item {
    text-align: center;
    padding: 10px;
    transition: transform 0.3s ease;
}

.trust-bar .trust-item:hover {
    transform: translateY(-5px);
}

.trust-bar .trust-item .icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.trust-bar .trust-item p {
    margin: 0;
    font-weight: 500;
    font-size: 14px;
    color: #495057;
}

@media (max-width: 768px) {
    .trust-bar .trust-item {
        padding: 15px 5px;
    }
    .trust-bar .trust-item .icon {
        font-size: 24px;
    }
    .trust-bar .trust-item p {
        font-size: 12px;
    }
}

/* ============================================
   3. LIVE STATS COUNTER
   ============================================ */
.stats-bar {
    background: linear-gradient(135deg, #107549 0%, #0a5234 100%);
    color: white;
    padding: 50px 0;
    position: relative;
    overflow: hidden;
}

.stats-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120"><path d="M321.39,56.44c58-10.79,114.16-30.13,172-41.86,82.39-16.72,168.19-17.73,250.45-.39C823.78,31,906.67,72,985.66,92.83c70.05,18.48,146.53,26.09,214.34,3V0H0V27.35A600.21,600.21,0,0,0,321.39,56.44Z" fill="rgba(255,255,255,0.1)"></path></svg>') no-repeat;
    background-size: cover;
    opacity: 0.3;
}

.stats-bar .counter {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 10px;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.stats-bar p {
    color: rgba(255,255,255,0.9);
    font-size: 16px;
    margin: 0;
}

@media (max-width: 768px) {
    .stats-bar {
        padding: 40px 0;
    }
    .stats-bar .counter {
        font-size: 36px;
    }
}

/* ============================================
   4. ROI CALCULATOR
   ============================================ */
.roi-calculator {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    margin: 40px 0;
    transition: transform 0.3s ease;
}

.roi-calculator:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 50px rgba(0,0,0,0.15);
}

.roi-calculator h3 {
    margin-bottom: 30px;
    color: #333;
    font-size: 28px;
}

.roi-calculator label {
    display: block;
    margin: 20px 0 8px;
    font-weight: 600;
    color: #495057;
    font-size: 15px;
}

.roi-calculator input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s;
}

.roi-calculator input:focus {
    outline: none;
    border-color: #107549;
    box-shadow: 0 0 0 3px rgba(16, 117, 73, 0.1);
}

.roi-calculator .results {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #fcb808 0%, #f39c12 100%);
    border-radius: 8px;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.roi-calculator .results h4 {
    color: white;
    margin-bottom: 15px;
    font-size: 22px;
}

.roi-calculator .big-number {
    font-size: 48px;
    font-weight: 700;
    color: white;
    margin: 10px 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.roi-calculator .results p {
    color: white;
    margin: 8px 0;
}

.roi-calculator .highlight {
    background: white;
    color: #f39c12;
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    font-size: 18px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .roi-calculator {
        padding: 25px 20px;
    }
    .roi-calculator h3 {
        font-size: 22px;
    }
    .roi-calculator .big-number {
        font-size: 36px;
    }
}

/* ============================================
   5. EXIT INTENT POPUP
   ============================================ */
.exit-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.exit-popup-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.exit-popup {
    background: white;
    padding: 50px 40px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    position: relative;
    animation: slideUp 0.4s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.exit-popup .close-popup {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
    line-height: 1;
    font-weight: 300;
}

.exit-popup .close-popup:hover {
    color: #333;
    transform: rotate(90deg);
    transition: all 0.3s;
}

.exit-popup h3 {
    font-size: 32px;
    margin-bottom: 15px;
    color: #333;
}

.exit-popup h4 {
    color: #107549;
    margin: 20px 0;
    font-size: 22px;
}

.exit-popup input[type="email"] {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 16px;
    margin: 20px 0;
    transition: border-color 0.3s;
}

.exit-popup input[type="email"]:focus {
    outline: none;
    border-color: #fcb808;
}

.exit-popup button {
    width: 100%;
    padding: 15px;
    background: #fcb808;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.exit-popup button:hover {
    background: #f39c12;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(252, 184, 8, 0.4);
}

.exit-popup .small {
    font-size: 14px;
    color: #6c757d;
    margin-top: 15px;
}

@media (max-width: 768px) {
    .exit-popup {
        padding: 40px 25px;
    }
    .exit-popup h3 {
        font-size: 26px;
    }
    .exit-popup h4 {
        font-size: 18px;
    }
}

/* ============================================
   6. STICKY CTA
   ============================================ */
.sticky-cta {
    position: fixed;
    top: -100px;
    left: 0;
    width: 100%;
    background: #107549;
    padding: 15px 20px;
    text-align: center;
    z-index: 9999;
    transition: top 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.sticky-cta.visible {
    top: 0;
}

.sticky-cta p {
    color: white;
    margin: 0;
    display: inline-block;
    margin-right: 20px;
    font-size: 16px;
    font-weight: 500;
}

.sticky-cta .btn {
    display: inline-block;
    padding: 10px 30px;
    background: #fcb808;
    color: white !important;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: all 0.3s;
}

.sticky-cta .btn:hover {
    background: #f39c12;
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .sticky-cta {
        padding: 12px 15px;
    }
    .sticky-cta p {
        display: block;
        margin-bottom: 10px;
        font-size: 14px;
    }
    .sticky-cta .btn {
        display: block;
        width: 100%;
        padding: 12px 20px;
    }
}

/* ============================================
   7. MOBILE CTA BUTTONS
   ============================================ */
.mobile-cta-call {
    display: none;
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: #107549;
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(16, 117, 73, 0.4);
    z-index: 998;
    font-size: 16px;
    transition: all 0.3s;
}

.mobile-cta-call:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(16, 117, 73, 0.6);
    color: white;
}

@media (max-width: 768px) {
    .mobile-cta-call {
        display: block;
    }
}

/* ============================================
   8. WHATSAPP BUTTON
   ============================================ */
.whatsapp-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    z-index: 999;
    transition: all 0.3s;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

.whatsapp-float img {
    width: 35px;
    height: 35px;
}

/* ============================================
   9. CASE STUDY MINI CARDS
   ============================================ */
.case-study-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    transition: all 0.3s;
}

.case-study-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 50px rgba(0,0,0,0.15);
}

.case-study-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s;
}

.case-study-card:hover img {
    transform: scale(1.05);
}

.case-study-card .case-content {
    padding: 30px;
}

.case-study-card h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 20px;
}

.case-study-card .result {
    color: #107549;
    font-weight: 600;
    margin: 15px 0;
    font-size: 16px;
}

.case-study-card ul {
    list-style: none;
    padding: 0;
}

.case-study-card ul li {
    padding: 8px 0;
    color: #495057;
    font-size: 15px;
}

.case-study-card .btn-link {
    color: #107549;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    margin-top: 15px;
    transition: all 0.3s;
}

.case-study-card .btn-link:hover {
    color: #fcb808;
    transform: translateX(5px);
}

/* ============================================
   10. VIDEO GRID
   ============================================ */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.video-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.video-card iframe {
    width: 100%;
    height: 200px;
    display: block;
}

.video-card h4 {
    padding: 20px 20px 10px;
    margin: 0;
    font-size: 18px;
    color: #333;
}

.video-card p {
    padding: 0 20px 20px;
    margin: 0;
    color: #6c757d;
    font-size: 14px;
}

@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ============================================
   11. BADGES & CERTIFICATIONS
   ============================================ */
.certification-badges {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    margin: 40px 0;
}

.certification-badges img {
    height: 60px;
    opacity: 0.8;
    transition: all 0.3s;
    filter: grayscale(50%);
}

.certification-badges img:hover {
    opacity: 1;
    filter: grayscale(0%);
    transform: scale(1.1);
}

/* ============================================
   12. PROGRESS BAR
   ============================================ */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 10px;
    margin: 20px 0;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #107549 0%, #fcb808 100%);
    border-radius: 10px;
    transition: width 0.5s ease;
}

/* ============================================
   13. POPULAR BADGE
   ============================================ */
.popular-badge {
    position: absolute;
    top: -12px;
    right: 20px;
    background: #FF6B6B;
    color: white;
    padding: 6px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(255, 107, 107, 0.3);
    animation: wiggle 1s ease-in-out infinite;
}

@keyframes wiggle {
    0%, 100% {
        transform: rotate(-3deg);
    }
    50% {
        transform: rotate(3deg);
    }
}

/* ============================================
   14. ENHANCED TESTIMONIALS
   ============================================ */
.review-4 {
    position: relative;
}

.review-4::before {
    content: '"';
    position: absolute;
    top: -20px;
    left: 15px;
    font-size: 80px;
    color: #fcb808;
    opacity: 0.2;
    font-family: Georgia, serif;
    line-height: 1;
}

/* ============================================
   15. LOADING STATE
   ============================================ */
.btn-submit {
    position: relative;
}

.btn-submit .btn-loader {
    display: none;
}

.btn-submit.loading .btn-text {
    display: none;
}

.btn-submit.loading .btn-loader {
    display: inline-block;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   16. SMOOTH TRANSITIONS
   ============================================ */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

a, button, .btn {
    transition: all 0.3s ease;
}

/* ============================================
   17. PRINT STYLES
   ============================================ */
@media print {
    .sticky-cta,
    .mobile-cta-call,
    .whatsapp-float,
    .exit-popup-overlay,
    .urgency-banner,
    header,
    footer {
        display: none !important;
    }
}

/* ============================================
   18. ACCESSIBILITY IMPROVEMENTS
   ============================================ */
:focus {
    outline: 2px solid #fcb808;
    outline-offset: 2px;
}

button:focus,
a:focus,
input:focus,
textarea:focus {
    outline: 2px solid #fcb808;
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: #107549;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100000;
}

.skip-to-main:focus {
    top: 0;
}

/* ============================================
   19. DARK MODE SUPPORT (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles here if needed */
}

/* ============================================
   20. PERFORMANCE - Reduce Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
