/* Automation & AI Page Styles */
/* codice realizzato da Alessandro Terracciano - per info info@whooho.it */

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    touch-action: pan-y pinch-zoom;
}

.automation-hero,
.workflow-showcase,
.benefits-section,
#services {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Container base */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Hero Section con Network Animation */
.automation-hero {
    background: #000;
    position: relative;
    overflow: hidden;
}

.automation-payoff {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.2;
    margin-bottom: 30px;
    background: linear-gradient(45deg, #FFC700, #FF8A00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.automation-description {
    font-size: 1.2rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 50px;
    max-width: 700px;
}

/* Canvas per animazione tubi 3D */
#workflowCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.6;
    cursor: grab;
}

#workflowCanvas:active {
    cursor: grabbing;
}

.hero-content {
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.hero-content * {
    pointer-events: auto;
}

/* Statistiche Workflow */
.workflow-stats {
    position: absolute;
    bottom: 60px;
    right: 60px;
    display: flex;
    gap: 40px;
    z-index: 3;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.stat-number {
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(135deg, #FFC700, #FF8A00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Montserrat', sans-serif;
}

.stat-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Workflow Showcase Section */
.workflow-showcase {
    padding: 120px 20px 60px;
    background: #fff;
    position: relative;
    overflow: hidden;
}

.workflow-showcase .container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.workflow-showcase .section-title {
    color: #111;
    margin-bottom: 40px !important;
    text-align: center;
}

.workflow-showcase .section-subtitle {
    color: #666;
    max-width: 900px;
    margin: 0 auto 80px;
    line-height: 1.8;
    font-size: 1.2rem;
    font-weight: 400;
    text-align: center;
}

.section-subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 80px;
    font-weight: 400;
    text-align: center;
    padding: 0 20px;
}

/* Diagramma Workflow */
.workflow-diagram {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 80px;
    padding: 40px 20px;
}

/* Nodi Workflow */
.workflow-node {
    position: relative;
    z-index: 2;
    animation: float 4s ease-in-out infinite;
}

.workflow-node:nth-child(2) {
    animation-delay: 0.5s;
}

.workflow-node:nth-child(3) {
    animation-delay: 1s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
}

.node-inner {
    background: #fff;
    border: 3px solid #111;
    border-radius: 20px;
    padding: 30px 25px;
    text-align: center;
    min-width: 200px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.workflow-node:hover .node-inner {
    transform: scale(1.02);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.node-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #111;
}

.node-label {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #111;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.node-examples {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

/* SVG Connessioni */
.workflow-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    touch-action: none;
}

.connection-line {
    opacity: 1;
}

.flow-particle {
    filter: drop-shadow(0 0 8px rgba(255, 199, 0, 0.5));
}

/* Benefits Section */
.benefits-section {
    background: #000;
    padding: 120px 20px;
    color: #fff;
}

.benefits-section .container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.benefits-section .section-title {
    color: #fff;
    margin-bottom: 80px;
    text-align: center;
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.benefit-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px 30px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.benefit-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #FFC700, #FF8A00);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.benefit-card:hover::before {
    transform: scaleX(1);
}

.benefit-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 199, 0, 0.3);
    transform: translateY(-5px);
}

.benefit-number {
    font-size: 4rem;
    font-weight: 900;
    background: linear-gradient(135deg, #FFC700, #FF8A00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 20px;
    font-family: 'Montserrat', sans-serif;
}

.benefit-card h3 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 15px;
    font-weight: 700;
}

.benefit-card p {
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

/* Interactive Workflow Section */
.interactive-workflow {
    background: #ffffff !important;
    padding: 60px 20px 120px;
    position: relative;
    overflow: hidden;
}

.interactive-workflow .section-title {
    color: #111;
    margin-bottom: 40px !important;
}

.interactive-workflow .section-subtitle {
    color: #555;
    max-width: 900px;
    margin: 0 auto 60px;
    line-height: 1.8;
    font-size: 1.1rem;
}

.workflow-canvas-container {
    position: relative;
    width: 100%;
    max-width: 1400px;
    height: 700px;
    margin: 60px auto 0;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
}

.workflow-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Draggable Nodes */
.draggable-node {
    position: absolute;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 0;
    cursor: default;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    min-width: 200px;
    user-select: none;
    pointer-events: none;
}

.draggable-node:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Node Headers */
.node-header {
    background: #f8f9fa;
    padding: 10px 14px;
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.node-header.small {
    padding: 8px 10px;
}

/* Node Icon Wrapper */
.node-icon-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0088cc;
    flex-shrink: 0;
}

.node-icon-wrapper.small {
    width: 24px;
    height: 24px;
}

.node-icon-wrapper.ai {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
}

.node-icon-wrapper i {
    font-size: 1.1rem;
    color: #ffffff;
}

.node-icon-wrapper.small i {
    font-size: 0.85rem;
}

/* Node Title */
.node-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    flex-grow: 1;
}

.node-title.small {
    font-size: 0.8rem;
}

/* Node Content */
.node-content {
    padding: 14px;
    background: #fff;
    color: #000;
}

.node-content.small {
    padding: 10px 12px;
}

.node-content h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 6px 0;
    color: #111;
}

.node-content h5 {
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: #111;
}

.node-content p {
    font-size: 0.75rem;
    color: #777;
    margin: 4px 0 0 0;
}

.node-type {
    font-size: 0.7rem;
    color: #999;
    font-style: italic;
}

.node-updates {
    font-size: 0.7rem;
    color: #777;
}

.node-function {
    font-size: 0.75rem;
    color: #666;
    font-family: 'Courier New', monospace;
}

.node-hint {
    font-size: 0.7rem;
    color: #aaa;
}

.node-tools {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.tool-badge {
    background: #f0f0f0;
    border: 1px solid #d0d0d0;
    color: #555;
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 500;
}

/* Node Footer */
.node-footer {
    position: relative;
    height: 10px;
    background: #fafafa;
    border-radius: 0 0 6px 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 14px;
}

.connection-point {
    width: 10px;
    height: 10px;
    background: #888;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: default;
    transition: none;
    position: relative;
    z-index: 150;
}

.connection-point.input {
    margin-right: auto;
}

.connection-point.output {
    margin-left: auto;
}

/* Node Type Variations */
.telegram-input .node-icon-wrapper,
.telegram-output .node-icon-wrapper,
.telegram-input.tool-node .node-icon-wrapper,
.telegram-output.tool-node .node-icon-wrapper,
.document .node-icon-wrapper {
    background: #0088cc;
}

.ai-agent {
    min-width: 250px;
}

.tool-node {
    min-width: 140px;
    max-width: 180px;
}

.openai .node-icon-wrapper {
    background: linear-gradient(135deg, #10a37f, #1a7f64);
}

.memory .node-icon-wrapper {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}

.image-gen .node-icon-wrapper {
    background: linear-gradient(135deg, #ec4899, #d946ef);
}

/* Responsive */
@media (max-width: 768px) {
    /* Hero Section Mobile */
    .automation-hero {
        padding: 0 15px;
    }

    .automation-hero .hero-content {
        padding-left: 5%;
        padding-right: 5%;
        max-width: 100%;
        text-align: left; /* Tutto allineato a sinistra */
    }

    .automation-hero .page-title {
        font-size: clamp(2.5rem, 10vw, 4rem) !important;
        margin-bottom: 30px;
        word-wrap: break-word;
        text-align: left; /* Esplicitamente a sinistra */
    }

    .automation-payoff {
        font-size: clamp(1.5rem, 6vw, 2rem) !important;
        margin-bottom: 20px;
        text-align: left; /* Esplicitamente a sinistra */
        word-wrap: break-word;
        hyphens: auto;
    }

    .automation-description {
        font-size: 0.95rem !important;
        line-height: 1.5;
        margin-bottom: 30px;
        width: 100%;
        max-width: 100%;
        padding-right: 0;
        text-align: left; /* Esplicitamente a sinistra */
    }

    /* Statistiche mobile */
    .workflow-stats {
        position: static;
        margin-top: 40px;
        justify-content: center;
        gap: 15px;
        flex-wrap: wrap;
        padding: 20px 0;
    }

    /* Riduci opacità canvas su mobile e permetti scroll */
    #workflowCanvas {
        opacity: 0.5;
        touch-action: pan-y;
    }

    .stat-item {
        flex: 0 0 auto;
    }

    .stat-number {
        font-size: 1.8rem;
    }

    .stat-label {
        font-size: 0.7rem;
        white-space: nowrap;
    }

    /* Workflow Diagram Mobile */
    .workflow-showcase {
        padding: 80px 0 40px;
        width: 100%;
        box-sizing: border-box;
    }

    .workflow-showcase .container {
        padding: 0 !important;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .workflow-showcase .section-title,
    .workflow-showcase .section-subtitle {
        padding: 0 20px;
    }

    .workflow-diagram {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: auto;
        gap: 40px;
        padding: 20px 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Nascondi linee SVG orizzontali su mobile */
    .workflow-diagram .workflow-connections {
        display: none;
    }

    /* Crea linee verticali tratteggiate tra i nodi su mobile */
    .workflow-node:not(:last-child)::after {
        content: '';
        position: absolute;
        left: 50%;
        bottom: -40px;
        margin-left: -2px;
        width: 4px;
        height: 32px;
        background: repeating-linear-gradient(
            180deg,
            #FFC700 0px,
            #FFC700 6px,
            transparent 6px,
            transparent 10px,
            #FF8A00 10px,
            #FF8A00 16px,
            transparent 16px,
            transparent 20px
        );
        background-size: 4px 20px;
        animation: dashedFlowDown 0.8s linear infinite;
        filter: drop-shadow(0 0 4px rgba(255, 199, 0, 0.5));
    }

    @keyframes dashedFlowDown {
        0% { background-position: 0 0; }
        100% { background-position: 0 20px; }
    }

    .workflow-node {
        position: relative;
        width: 90%;
        max-width: 320px;
        margin: 0 auto;
    }

    .node-inner {
        min-width: auto;
        max-width: 100%;
        padding: 25px 20px;
    }

    .node-icon {
        font-size: 2.5rem;
    }

    .node-label {
        font-size: 1rem;
    }

    .node-examples {
        font-size: 0.8rem;
    }

    /* Benefits Grid Mobile */
    .benefits-section {
        padding: 80px 15px;
    }

    .benefits-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .benefit-card {
        padding: 30px 20px;
    }

    .benefit-number {
        font-size: 3rem;
    }

    .benefit-card h3 {
        font-size: 1.3rem;
    }

    .benefit-card p {
        font-size: 0.95rem;
    }

    /* Section Titles Mobile */
    .section-title {
        font-size: clamp(2rem, 8vw, 3rem) !important;
        margin-bottom: 40px !important;
        padding: 0 10px;
        word-wrap: break-word;
    }

    .section-subtitle {
        font-size: 0.95rem;
        margin-bottom: 40px;
        padding: 0 10px;
    }

    /* Service Cards Mobile */
    .cards-wrapper {
        grid-template-columns: 1fr !important;
        gap: 30px;
        padding: 0;
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }

    .service-card {
        margin: 0 auto;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    .service-card * {
        max-width: 100%;
        box-sizing: border-box;
    }

    .service-card i {
        font-size: 2.5rem;
    }

    .service-card h3 {
        font-size: 1.3rem;
    }

    .service-card p {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    /* Services Section Container */
    #services {
        padding: 80px 15px;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    #services .container {
        padding: 0 10px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    #services .section-title {
        padding: 0 10px;
        text-align: center;
    }

    #services .container {
        padding: 0 10px;
    }

    #services .services-grid {
        padding: 0;
    }

    /* Interactive Workflow Mobile */
    .interactive-workflow {
        padding: 40px 15px 80px;
    }

    .workflow-canvas-container {
        height: auto;
        min-height: 900px;
        padding: 20px 10px;
    }

    .workflow-canvas,
    .workflow-canvas-container .workflow-connections {
        display: none;
    }

    .draggable-node {
        position: relative !important;
        margin: 20px auto !important;
        max-width: 90%;
        left: auto !important;
        top: auto !important;
        transform: none !important;
    }

    .draggable-node:hover {
        transform: scale(1.02) !important;
    }

    /* Linee verticali tratteggiate tra i nodi workflow interattivi */
    .draggable-node:not(:last-child)::after {
        content: '';
        position: absolute;
        left: 50%;
        bottom: -20px;
        transform: translateX(-50%);
        width: 4px;
        height: 18px;
        background: repeating-linear-gradient(
            180deg,
            #FFC700 0px,
            #FFC700 4px,
            transparent 4px,
            transparent 7px,
            #FF8A00 7px,
            #FF8A00 11px,
            transparent 11px,
            transparent 14px
        );
        background-size: 4px 14px;
        animation: dashedFlowDown 0.6s linear infinite;
        filter: drop-shadow(0 0 4px rgba(255, 199, 0, 0.5));
        z-index: 1;
    }

    .tool-badge {
        font-size: 0.65rem;
        padding: 3px 6px;
    }
}

/* Mobile Small (< 480px) */
@media (max-width: 480px) {
    .automation-hero .page-title {
        font-size: 2.5rem !important;
    }

    .automation-payoff {
        font-size: 1.5rem !important;
        line-height: 1.3;
    }

    .automation-description {
        font-size: 0.9rem !important;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .workflow-stats {
        gap: 10px;
        padding: 15px 0;
    }

    .section-title {
        font-size: 2rem !important;
    }

    .benefit-number {
        font-size: 2.5rem;
    }

    .benefit-card {
        padding: 25px 15px;
    }

    .benefit-card h3 {
        font-size: 1.2rem;
    }

    .node-inner {
        padding: 20px 15px;
    }

    .node-icon {
        font-size: 2rem;
    }

    .workflow-showcase {
        padding: 60px 0 30px;
    }

    .workflow-showcase .container {
        padding: 0 !important;
    }

    .workflow-showcase .section-title,
    .workflow-showcase .section-subtitle {
        padding: 0 15px;
    }

    .workflow-diagram {
        padding: 20px 0;
    }

    /* Nascondi linee SVG orizzontali su mobile */
    .workflow-diagram .workflow-connections {
        display: none;
    }

    /* Crea linee verticali tratteggiate tra i nodi su mobile */
    .workflow-node:not(:last-child)::after {
        content: '';
        position: absolute;
        left: 50%;
        bottom: -40px;
        margin-left: -1.5px;
        width: 3px;
        height: 30px;
        background: repeating-linear-gradient(
            180deg,
            #FFC700 0px,
            #FFC700 5px,
            transparent 5px,
            transparent 9px,
            #FF8A00 9px,
            #FF8A00 14px,
            transparent 14px,
            transparent 18px
        );
        background-size: 3px 18px;
        animation: dashedFlowDown 0.7s linear infinite;
        filter: drop-shadow(0 0 3px rgba(255, 199, 0, 0.4));
    }

    .benefits-section {
        padding: 60px 10px;
    }

    /* Interactive Workflow Small Mobile */
    .interactive-workflow {
        padding: 30px 10px 60px;
    }

    .workflow-canvas-container {
        min-height: 800px;
        padding: 15px 5px;
    }

    .workflow-canvas,
    .workflow-canvas-container .workflow-connections {
        display: none;
    }

    .draggable-node {
        min-width: auto;
        max-width: 95%;
    }

    .node-content h4,
    .node-content h5 {
        font-size: 0.9rem;
    }

    .node-header i {
        font-size: 1.2rem;
    }
}

/* Mobile Landscape - Orientamento orizzontale */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .automation-hero {
        min-height: 100vh;
        display: flex;
        align-items: center;
    }
    
    .hero-content {
        padding-top: 80px !important;
        padding-bottom: 40px !important;
        max-width: 90%;
    }
    
    .automation-hero .page-title {
        font-size: 1.8rem !important;
        margin-bottom: 0.5rem !important;
        line-height: 1.1 !important;
    }
    
    .automation-payoff {
        font-size: 1.2rem !important;
        margin-bottom: 0.5rem !important;
        line-height: 1.2 !important;
    }
    
    .automation-description {
        font-size: 0.85rem !important;
        line-height: 1.4 !important;
        margin-bottom: 0.5rem !important;
    }
    
    .workflow-stats {
        position: static;
        margin-top: 20px;
        gap: 10px;
    }
    
    .stat-number {
        font-size: 1.3rem;
    }
    
    .stat-label {
        font-size: 0.6rem;
    }
    
    .scroll-indicator {
        display: none;
    }
}

/* Pulsating effect per i nodi */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 10px 40px rgba(255, 199, 0, 0.3);
    }
}

/* Particelle aggiuntive per desktop */
@media (min-width: 769px) {
    .workflow-showcase::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: 
            radial-gradient(circle at 20% 30%, rgba(255, 199, 0, 0.03) 0%, transparent 50%),
            radial-gradient(circle at 80% 70%, rgba(255, 138, 0, 0.03) 0%, transparent 50%);
        pointer-events: none;
    }
}
