/* ============================================================================
   FINANZAI.IT - CSS COMPLETO
   Homepage + Archivio con dimensioni miosito2 + Badge colorati ovunque
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&family=Playfair+Display:wght@400;600;700&display=swap');

/* ========== CSS VARIABLES ========== */
:root {
    --primary-blue: #0066cc;
    --primary-blue-dark: #004499;
    --primary-blue-light: #4a8fc7;
    --primary-blue-pale: #e7f3ff;
    
    --text-primary: #1a1a1a;
    --text-secondary: #333333;
    --text-muted: #666666;
    
    --accent-green: #28a745;
    --accent-orange: #ff9800;
    --accent-red: #c41e3a;
    --accent-purple: #9c27b0;
    --accent-teal: #009688;
    
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #e0e0e0;
    --gray-300: #d6d6d6;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    
    --bg-body: #f8f8f8;
    --bg-content: #ffffff;
    --bg-sidebar: #ffffff;
    
    --max-width: 1200px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --spacing-3xl: 64px;
    
    --font-primary: 'Open Sans', 'Arial', sans-serif;
    --font-serif: 'Playfair Display', 'Georgia', serif;
    
    --line-height-tight: 1.3;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.7;
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    
    --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 50%;
}

/* ========== RESET ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    line-height: var(--line-height-normal);
    color: var(--text-secondary);
    background-color: var(--bg-body);
    overflow-x: hidden;
}

/* ========== TIPOGRAFIA ========== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    color: var(--text-primary);
    line-height: var(--line-height-tight);
    font-weight: 600;
}

a {
    color: var(--primary-blue);
    text-decoration: none;
    transition: color var(--transition-normal);
}

a:hover {
    color: var(--primary-blue-dark);
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ========== HEADER UNIFICATO ========== */
.site-header {
    background-color: #ffffff;
    padding: 16px 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 4px solid var(--accent-red);
}

.container-header {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

/* ========== LOGO ========== */
.logo {
    flex: 0 0 auto;
}

.logo a {
    text-decoration: none;
    color: inherit;
}

.logo h1 {
    font-family: var(--font-serif);
    color: var(--accent-red);
    font-size: 36px;
    font-weight: 900;
    margin-bottom: 4px;
    line-height: 1;
}

.logo p {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    margin: 0;
    line-height: 1;
}

/* ========== MENU ========== */
.main-nav {
    flex: 1 1 auto;
    display: flex;
    justify-content: flex-end;
}

.menu-principale {
    list-style: none;
    display: flex;
    gap: 24px;
    margin: 0;
    padding: 0;
}

.menu-principale li {
    margin: 0;
    position: relative;
}

.menu-principale li a,
.menu-link {
    text-decoration: none;
    color: #333333;
    font-weight: 600;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 16px;
    display: block;
    transition: all 0.3s ease;
    border-radius: 4px;
    border: none;
}

.menu-principale li a:hover,
.menu-link:hover {
    color: #c41e3a;
    background-color: rgba(196, 30, 58, 0.08);
    border: none;
}

/* ========== MOBILE MENU TOGGLE ========== */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1002;
    position: relative;
}

.hamburger-icon {
    display: block;
    width: 25px;
    height: 3px;
    background: #c41e3a;
    position: relative;
    transition: all 0.3s ease;
}

.hamburger-icon::before,
.hamburger-icon::after {
    content: '';
    display: block;
    width: 25px;
    height: 3px;
    background: #c41e3a;
    position: absolute;
    transition: all 0.3s ease;
    left: 0;
}

.hamburger-icon::before {
    top: -8px;
}

.hamburger-icon::after {
    top: 8px;
}

.mobile-menu-toggle.active .hamburger-icon {
    background: transparent;
}

.mobile-menu-toggle.active .hamburger-icon::before {
    transform: rotate(45deg);
    top: 0;
}

.mobile-menu-toggle.active .hamburger-icon::after {
    transform: rotate(-45deg);
    top: 0;
}

/* Overlay scuro */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-overlay.active {
    display: block;
    opacity: 1;
}

/* ========== HERO HOMEPAGE ========== */
.hero-homepage {
    position: relative;
    width: 100%;
    max-height: 350px;
    overflow: hidden;
    margin-bottom: var(--spacing-2xl);
}

.hero-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    filter: brightness(0.7);
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.6));
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-content {
    text-align: center;
    color: white;
    padding: var(--spacing-xl);
}

.hero-title {
    font-family: var(--font-serif);
    font-size: clamp(24px, 4vw, 42px);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hero-subtitle {
    font-size: clamp(16px, 2vw, 20px);
    font-weight: 400;
    opacity: 0.95;
}

/* ========== CONTAINER MAIN ========== */
.container-main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg);
}

/* ========== SECTION TITLES ========== */
.section-title {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-md);
    border-bottom: 3px solid var(--primary-blue);
    display: inline-block;
}

/* ========== FEATURED GRID ========== */
.featured-section {
    margin-bottom: var(--spacing-3xl);
}

.featured-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
}

@media (min-width: 768px) {
    .featured-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .article-featured {
        grid-column: 1 / -1;
    }
}

/* ========== ARTICLE CARDS - DIMENSIONI MIOSITO2 ========== */
.article-card {
    background: var(--bg-content);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.article-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.article-image {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.article-card:hover .article-image img {
    transform: scale(1.05);
}

/* ========== BADGE CATEGORIE COLORATI - HOME + ARCHIVIO ========== */
.article-category {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
}

/* Colori specifici - TUTTI I CONTESTI */
.category-mercati { 
    background: #0066cc !important;
}

.category-crypto { 
    background: #ff9800 !important;
}

.category-investimenti { 
    background: #28a745 !important;
}

.category-economia { 
    background: #9c27b0 !important;
}

.category-trading { 
    background: #009688 !important;
}

.category-risparmio { 
    background: #c41e3a !important;
}

/* ========== ARTICLE CONTENT ========== */
.article-content {
    padding: var(--spacing-lg);
}

.article-title {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    line-height: var(--line-height-tight);
    font-weight: 600;
}

.article-featured .article-title {
    font-size: 20px;
}

.article-excerpt {
    font-size: 15px;
    color: var(--text-muted);
    line-height: var(--line-height-normal);
    margin-bottom: var(--spacing-md);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    font-size: 13px;
    color: var(--text-muted);
}

.article-author {
    font-weight: 600;
}

.separator {
    color: var(--gray-400);
}

.read-time {
    color: var(--text-muted);
}

/* ========== IMAGE SIZES - MIOSITO2 (RIDOTTE) ========== */
/* Tutte le card hanno dimensioni uniformi e più piccole come miosito2 */
.article-card .article-image {
    height: 220px;
}

.article-featured .article-image {
    height: 220px;
}

.article-medium .article-image {
    height: 220px;
}

/* ========== LAYOUT GRID - DUE COLONNE ========== */
.layout-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-3xl);
    margin-top: var(--spacing-3xl);
}

@media (min-width: 1024px) {
    .layout-grid {
        grid-template-columns: 2.5fr 1fr;
    }
}

/* ========== ARTICLES GRID - LAYOUT ARMONICO TIPO MONEY.IT ========== */
/* Usato in: Archivio, Categorie (trading, investimenti, etc.) */
.articles-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
    margin-top: var(--spacing-lg);
}

/* 2 colonne su tablet */
@media (min-width: 768px) {
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-xl);
    }
}

/* 3 colonne su desktop */
@media (min-width: 1024px) {
    .articles-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-xl);
    }
}

/* Card standard nella griglia */
.articles-grid .article-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.articles-grid .article-card .article-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.articles-grid .article-card .article-excerpt {
    flex: 1;
}

/* ========== ARTICLES LIST - GRIGLIA HOMEPAGE ========== */
/* Usato in: Homepage per "Ultime Notizie di Oggi" */
.articles-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
}

/* 2 colonne su tablet e desktop (homepage ha già la sidebar) */
@media (min-width: 768px) {
    .articles-list {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-xl);
    }
}

/* Card orizzontali nella lista - ora in layout verticale come le altre */
.article-horizontal {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.article-horizontal .article-image {
    width: 100%;
    height: 220px;
}

.article-horizontal .article-content {
    flex: 1;
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
}

.article-horizontal .article-title {
    font-size: 20px;
    margin-bottom: var(--spacing-md);
}

.article-horizontal .article-excerpt {
    -webkit-line-clamp: 3;
    flex: 1;
}

/* ========== SIDEBAR ========== */
.sidebar-column {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.widget {
    background: var(--bg-content);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

.widget-title {
    color: var(--text-primary);
    font-size: 18px;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--gray-200);
    font-weight: 700;
}

/* ========== SCROLL TO TOP ========== */
.scroll-top {
    position: fixed;
    bottom: 20px; /* Spostato più in alto per non sovrapporsi a Telegram (30px) e WhatsApp (100px) */
    right: var(--spacing-xl);
    width: 50px;
    height: 50px;
    background: var(--primary-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-size: 22px;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
}

.scroll-top::before {
    content: '↑';
}

.scroll-top.visible {
    opacity: 1;
    pointer-events: all;
}

.scroll-top:hover {
    background: var(--primary-blue-dark);
    transform: translateY(-5px);
}

/* ========== FLOATING SOCIAL BUTTONS ========== */
.floating-social-buttons {
    position: fixed;
    bottom: 100px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 998;
}

.floating-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
}

.floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.whatsapp-btn {
    background: #25D366;
}

.telegram-btn {
    background: #0088cc;
}

/* ========== FOOTER ========== */
#footer-principale {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: white;
    padding: var(--spacing-3xl) var(--spacing-lg) var(--spacing-xl);
    margin-top: var(--spacing-3xl);
}

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
}

.footer-logo {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.fallback-logo {
    font-family: var(--font-serif);
    font-size: 42px;
    font-weight: 900;
    color: var(--accent-red);
    margin: 0;
}

.footer-social {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.footer-social h3 {
    color: white;
    font-size: 17px;
    margin-bottom: var(--spacing-lg);
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    color: white;
    font-weight: 700;
    font-size: 17px;
    transition: all var(--transition-normal);
}

.social-link:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.social-facebook { background: #1877f2; }
.social-instagram { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.social-twitter { background: #000000; }
.social-youtube { background: #ff0000; }
.social-linkedin { background: #0a66c2; }
.social-tiktok { background: #000000; }

.footer-info {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.footer-description {
    color: #cccccc;
    font-size: 14px;
    line-height: var(--line-height-relaxed);
    max-width: 700px;
    margin: 0 auto;
}

.footer-links {
    margin-bottom: var(--spacing-xl);
}

.footer-links ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--spacing-lg);
    margin: 0;
    padding: 0;
}

.footer-links a {
    color: #e0e0e0;
    font-size: 13px;
    text-transform: uppercase;
    font-weight: 500;
}

.footer-links a:hover {
    color: var(--primary-blue-light);
}

.footer-divider {
    border-top: 1px solid var(--gray-600);
    margin: var(--spacing-xl) 0;
}

.copyright {
    color: #b0b0b0;
    font-size: 13px;
    text-align: center;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .site-header {
        padding: 12px 16px;
    }
    
    .container-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        position: relative;
    }
    
      .mobile-menu-toggle {
        display: block;
        order: 3;            /* ← Metti dopo il logo */
        margin-left: right;   /* ← CAMBIA: sposta a destra */
    }
    
    .logo {
        text-align: center;
        order: 2;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .logo h1 {
        font-size: 28px;
        margin-bottom: 0;
    }
    
    .logo p {
        display: none;
    }
    
    .main-nav {
        width: auto;
        order: 3;
    }
    
    .menu-principale {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        height: 100vh;
        background: #ffffff;
        flex-direction: column;
        gap: 0;
        padding: 80px 0 20px 0;
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.2);
        z-index: 999;
        overflow-y: auto;
        transition: left 0.3s ease;
        margin: 0;
    }
    
    .menu-principale.active {
        left: 0;
    }
    
    .menu-principale li {
        width: 100%;
        border-bottom: 1px solid var(--gray-200);
    }
    
    .menu-principale li a,
    .menu-link {
        text-align: left;
        border-radius: 0;
        padding: 16px 24px;
        font-size: 16px;
    }
    
    .hero-homepage {
        max-height: 250px;
    }
    
    .article-horizontal {
        flex-direction: column;
    }
    
    .article-horizontal .article-image {
        flex: 0 0 auto;
        width: 100%;
        height: 200px;
    }
    
    .footer-links ul {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-md);
    }
    
    .footer-links .separator {
        display: none;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 24px;
    }
    
    .scroll-top {
        width: 45px;
        height: 45px;
        bottom: var(--spacing-lg);
        right: var(--spacing-lg);
    }
    
    .hero-homepage {
        max-height: 200px;
    }
    
    .hero-title {
        font-size: 20px;
    }
    
    .hero-subtitle {
        font-size: 14px;
    }
}

/* ========== FINE CSS ========== */
