/* EliPage - CSS Unificato per Mini-Sito Arduino */

/* Reset CSS base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
}

/* Layout base senza Bootstrap */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

/* Sistema di colonne semplificato */
.col {
    padding: 0 15px;
    flex: 1;
}

.col-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0 15px;
}

.col-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
    padding: 0 15px;
}

.col-8 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
    padding: 0 15px;
}

.col-12 {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 15px;
}

/* Utilities essenziali */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }
.align-items-center { align-items: center; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }

/* Margini e padding */
.m-0 { margin: 0; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }

/* Tipografia */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5rem;
    font-weight: 500;
    line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

/* Immagini responsive */
img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

/* Buttons semplici */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: transparent;
    color: #333;
}

.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
    border-color: #545b62;
}

/* Stili specifici per Arduino */
.arduino-container {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.arduino-code {
    background-color: #2d3748;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    overflow-x: auto;
    margin: 10px 0;
}

.arduino-highlight {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
}

/* Stili per le bandierine di navigazione lingue */
.language-switcher {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    z-index: 10;
}

/* Ancora le bandierine al blocco testata */
.block-testata {
    position: relative;
}

.language-switcher .flag {
    width: 24px;
    height: 16px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 2px;
    transition: transform 0.2s;
    background-size: cover;
    background-position: center;
}

.language-switcher .flag:hover {
    transform: scale(1.1);
}

.language-switcher .flag.active {
    border: 2px solid #007bff;
}

/* Bandiere specifiche */
.language-switcher .flag.it {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Crect width='1' height='2' fill='%23009246'/%3E%3Crect x='1' width='1' height='2' fill='%23fff'/%3E%3Crect x='2' width='1' height='2' fill='%23ce2b37'/%3E%3C/svg%3E");
}

.language-switcher .flag.en {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 30"><clipPath id="s"><path d="M0,0 v30 h60 v-30 z"/></clipPath><clipPath id="t"><path d="M30,15 h30 v15 z v15 h-30 z h-30 v-15 z v-15 h30 z"/></clipPath><g clip-path="url(%23s)"><path d="M0,0 v30 h60 v-30 z" fill="%23012169"/><path d="M0,0 L60,30 M60,0 L0,30" stroke="%23fff" stroke-width="6"/><path d="M0,0 L60,30 M60,0 L0,30" clip-path="url(%23t)" stroke="%23C8102E" stroke-width="4"/><path d="M30,0 v30 M0,15 h60" stroke="%23fff" stroke-width="10"/><path d="M30,0 v30 M0,15 h60" stroke="%23C8102E" stroke-width="6"/></g></svg>');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.language-switcher .flag.es {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Crect width='3' height='2' fill='%23c60b1e'/%3E%3Crect y='0.5' width='3' height='1' fill='%23ffc400'/%3E%3C/svg%3E");
}

.language-switcher .flag.fr {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Crect width='1' height='2' fill='%23002395'/%3E%3Crect x='1' width='1' height='2' fill='%23fff'/%3E%3Crect x='2' width='1' height='2' fill='%23ed2939'/%3E%3C/svg%3E");
}

.language-switcher .flag.de {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Crect width='3' height='0.67' fill='%23000'/%3E%3Crect y='0.67' width='3' height='0.67' fill='%23dd0000'/%3E%3Crect y='1.33' width='3' height='0.67' fill='%23ffce00'/%3E%3C/svg%3E");
}

/* ===== STILI BLOCCHI UNIFICATI ===== */

/* Blocchi canvas - Stili base per tutti i blocchi */
.canvas-block {
    display: block;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 0px;
    width: 100%;
    box-sizing: border-box;
    transition: box-shadow 0.3s ease;
    overflow: hidden;
}

.canvas-block:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Nascondi elementi editor solo nella visualizzazione finale (non nell'editor) */
body:not(.editor-mode) .block-controls {
    display: none !important;
}

.drop-zone {
    display: none !important;
}

/* Stili specifici per tipo di blocco */

/* Block Testata */
.block-testata {
    /* Non impostare background qui - viene gestito dal template HTML inline */
    color: white;
    text-align: center;
    padding: 40px 20px;
    border: none;
}

.block-testata h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.block-testata p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 0;
}

/* Block Hero */
.block-hero {
    background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)), url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 600"><rect fill="%23f0f0f0" width="1200" height="600"/></svg>');
    background-size: cover;
    background-position: center;
    color: white;
    text-align: center;
    padding: 80px 20px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.block-hero h1,
.block-hero .hero-title {
    font-size: 4rem !important;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5) !important;
    text-align: center;
}

.block-hero h2,
.block-hero .hero-subtitle {
    font-size: 1.5rem !important;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5) !important;
    text-align: center;
}

.block-hero p {
    font-size: 1.1rem !important;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5) !important;
    text-align: center;
}

/* Block Testo */
.block-testo {
    background-color: #ffffff;
    padding: 30px;
}

.block-testo h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.block-testo p {
    color: #666;
    line-height: 1.8;
    font-size: 1.1rem;
}

/* Block Split50 */
.block-split50 {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    min-height: 300px !important;
    padding: 0 !important;
    overflow: hidden !important;
}

.block-split50 .split-image {
    flex: 0 0 50% !important;
    background-size: cover !important;
    background-position: center !important;
    min-height: 300px !important;
    order: 1 !important;
}

.block-split50 .split-content {
    flex: 0 0 50% !important;
    padding: 30px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    order: 2 !important;
}

.block-split50 h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.6rem;
}

.block-split50 p {
    color: #666;
    line-height: 1.7;
}

/* Block Foto + Testo */
.block-foto-testo {
    background-color: #ffffff;
}

.block-foto-testo .row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 25px !important;
}

.block-foto-testo .col-md-6 {
    flex: 0 0 calc(50% - 12.5px) !important;
    max-width: calc(50% - 12.5px) !important;
}

.foto-testo-container {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    gap: 0 !important;
}

.foto-section {
    flex: 0 0 50% !important;
    padding: 20px !important;
}

.foto-image,
.block-foto-testo img {
    width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
    border-radius: 12px !important;
    display: block !important;
}

.testo-section {
    flex: 0 0 50% !important;
    padding: 30px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}

.foto-testo-title {
    margin-bottom: 15px !important;
}

.foto-testo-content {
    line-height: 1.7 !important;
}

/* Block Audio */
.block-audio {
    background-color: #f8f9fa;
    text-align: center;
    padding: 40px 30px;
}

.block-audio h5 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.block-audio audio {
    width: 100%;
    max-width: 500px;
    margin: 20px 0;
}

.block-audio p {
    color: #666;
    font-style: italic;
    margin-top: 15px;
}

/* Block Footer */
.block-footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 0;
}

.block-footer h6 {
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.block-footer p {
    opacity: 0.8;
    margin-bottom: 0;
}

.block-footer a {
    color: #3498db;
    text-decoration: none;
}

.block-footer a:hover {
    text-decoration: underline;
}

/* Media queries per responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .col-6, .col-4, .col-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    
    .block-testata h1 {
        font-size: 2rem;
    }
    
    .block-hero h2 {
        font-size: 2.2rem;
    }
    
    .block-hero p {
        font-size: 1.1rem;
    }
    
    .block-split50 {
        flex-direction: column;
    }
    
    .block-split50 .split-image {
        min-height: 200px;
    }
    
    .block-foto-testo .row {
        flex-direction: column !important;
    }
    
    .block-foto-testo .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    .foto-testo-container {
        flex-direction: column !important;
    }
    
    .foto-section, .testo-section {
        flex: 1 1 auto !important;
    }
    
    .canvas-block {
        margin-bottom: 1.5rem;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 5px;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .block-testata {
        padding: 30px 15px;
    }
    
    .block-hero {
        padding: 60px 15px;
        min-height: 300px;
    }
    
    .block-hero h2 {
        font-size: 1.8rem;
    }
    
    .canvas-block {
        padding: 10px;
    }
}

/* Performance optimizations */
.no-animation * {
    animation: none !important;
    transition: none !important;
}

/* Print styles */
@media print {
    .btn, .arduino-highlight, .no-print, .language-switcher {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .canvas-block {
        break-inside: avoid;
        margin-bottom: 1rem;
        border: 1px solid #ccc;
    }
}