/* ======================================
   IL COLLABORAZIONISTA - Stile Giornale Antico
   ====================================== */

@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700;900&family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400&family=Old+Standard+TT:ital,wght@0,400;0,700;1,400&family=IM+Fell+English:ital@0;1&display=swap');

:root {
    --paper-color: #f5f0e1;
    --paper-dark: #e8dcc8;
    --ink-color: #1a1208;
    --ink-light: #3d3425;
    --border-color: #2c1810;
    --accent-color: #8b0000;
    --gold-color: #8b7355;
    --shadow: rgba(44, 24, 16, 0.15);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #d4c4a8 0%, #c9b896 50%, #baa97e 100%);
    min-height: 100vh;
    font-family: 'Old Standard TT', 'Times New Roman', serif;
    color: var(--ink-color);
}

/* Container principale giornale */
.newspaper-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    perspective: 2000px;
}

/* Effetto libro sfogliabile */
.flipbook-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

/* Singola pagina del giornale */
.newspaper-page {
    background: var(--paper-color);
    background-image:
        linear-gradient(rgba(139, 115, 85, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 115, 85, 0.03) 1px, transparent 1px),
        radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.05) 100%);
    background-size: 20px 20px, 20px 20px, 100% 100%;
    box-shadow:
        0 0 0 1px var(--border-color),
        inset 0 0 80px rgba(139, 115, 85, 0.1),
        0 15px 40px var(--shadow),
        0 5px 15px rgba(0,0,0,0.1);
    padding: 40px 50px;
    position: relative;
    overflow: hidden;
}

.newspaper-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
}

/* Testata del giornale */
.newspaper-header {
    text-align: center;
    border-bottom: 3px double var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 30px;
    position: relative;
}

.newspaper-header::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.newspaper-masthead {
    font-family: 'Merriweather', Georgia, serif;
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 900;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin: 0;
    color: var(--ink-color);
    text-shadow: 2px 2px 0 rgba(139, 115, 85, 0.2);
    line-height: 1.1;
}

.newspaper-subtitle {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    margin: 15px 0 10px;
    color: var(--ink-light);
    line-height: 1.4;
}

.newspaper-date-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--gold-color);
}

.newspaper-date-line span {
    font-style: italic;
}

/* Ornamenti */
.ornament {
    font-size: 1.5rem;
    color: var(--gold-color);
    letter-spacing: 5px;
}

.ornament-divider {
    text-align: center;
    margin: 20px 0;
    color: var(--gold-color);
    font-size: 1.2rem;
}

/* Griglia articoli stile giornale */
.newspaper-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 25px;
    margin-top: 30px;
}

/* Articolo principale */
.article-main {
    grid-column: span 8;
}

/* Articoli sidebar */
.article-sidebar {
    grid-column: span 4;
    border-left: 1px solid var(--border-color);
    padding-left: 25px;
}

/* Articoli a due colonne */
.article-half {
    grid-column: span 6;
}

/* Articolo a tutta larghezza */
.article-full {
    grid-column: span 12;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    padding: 20px 0;
    margin: 20px 0;
}

/* Stili articolo */
.article {
    margin-bottom: 25px;
}

.article-category {
    font-family: 'Old Standard TT', serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--accent-color);
    margin-bottom: 8px;
    font-weight: 700;
}

.article-title {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    line-height: 1.1;
    margin: 0 0 10px;
    color: var(--ink-color);
}

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

.article-title a:hover {
    color: var(--accent-color);
}

.article-subtitle {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: 1.1rem;
    color: var(--ink-light);
    margin-bottom: 15px;
    line-height: 1.4;
}

.article-meta {
    font-size: 0.8rem;
    color: var(--gold-color);
    margin-bottom: 15px;
    font-style: italic;
}

.article-excerpt {
    font-size: 1rem;
    line-height: 1.7;
    text-align: justify;
    hyphens: auto;
    margin-bottom: 15px;
}

.article-excerpt::first-letter {
    font-family: 'UnifrakturMaguntia', serif;
    font-size: 3.5rem;
    float: left;
    line-height: 0.8;
    padding-right: 10px;
    color: var(--accent-color);
}

/* Immagine articolo */
.article-image {
    width: 100%;
    margin-bottom: 15px;
    position: relative;
}

.article-image img {
    width: 100%;
    height: auto;
    display: block;
    filter: sepia(20%) contrast(1.05);
    border: 1px solid var(--border-color);
}

.article-image figcaption {
    font-size: 0.8rem;
    font-style: italic;
    text-align: center;
    padding: 8px;
    background: var(--paper-dark);
    border: 1px solid var(--border-color);
    border-top: none;
}

/* ======================================
   ARTICOLI CON LAYOUT ALTERNATO
   ====================================== */

.articles-list {
    margin-top: 30px;
}

.article-row {
    display: grid;
    grid-template-columns: 1fr 250px;
    gap: 25px;
    margin-bottom: 35px;
    padding-bottom: 35px;
    border-bottom: 1px solid var(--border-color);
    align-items: start;
}

/* Pari: immagine a sinistra, testo a destra */
.article-row.image-left {
    grid-template-columns: 250px 1fr;
}

.article-row.image-left .article-content-col {
    grid-column: 2;
    grid-row: 1;
}

.article-row.image-left .article-image-col {
    grid-column: 1;
    grid-row: 1;
}

.article-row .article-content-col {
    min-width: 0;
    overflow: hidden;
}

.article-row .article-image-col a {
    display: block;
}

.article-row .article-image-col img {
    width: 250px;
    height: 180px;
    object-fit: cover;
    filter: sepia(20%) contrast(1.05);
    border: 1px solid var(--border-color);
    display: block;
}

.article-row .article-title {
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    margin-bottom: 8px;
    line-height: 1.2;
}

.article-row .article-subtitle {
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.article-row .article-excerpt {
    font-size: 0.9rem;
    line-height: 1.5;
}

.article-row .article-excerpt::first-letter {
    font-size: 2rem;
    padding-right: 5px;
}

.article-row .article-meta {
    font-size: 0.75rem;
    margin-bottom: 10px;
}

/* Mobile: una colonna */
@media (max-width: 768px) {
    .article-row,
    .article-row.image-left {
        grid-template-columns: 1fr;
    }

    .article-row .article-image-col {
        order: -1;
    }

    .article-row .article-image-col img {
        width: 100%;
        height: 200px;
    }
}

/* Link leggi tutto */
.read-more {
    font-family: 'Old Standard TT', serif;
    font-size: 0.85rem;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.read-more:hover {
    text-decoration: underline;
}

/* Separatore tra articoli */
.article-divider {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-color), transparent);
    margin: 25px 0;
}

/* Colonne testo */
.text-columns {
    column-count: 2;
    column-gap: 30px;
    column-rule: 1px solid var(--border-color);
}

/* ======================================
   PAGINA SINGOLO ARTICOLO
   ====================================== */

.article-single {
    max-width: 900px;
    margin: 0 auto;
}

.article-single .article-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    text-align: center;
    margin-bottom: 20px;
}

.article-single .article-subtitle {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 25px;
}

.article-single .article-meta {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
    text-align: justify;
}

.article-content p {
    margin-bottom: 1.5em;
}

.article-content h2,
.article-content h3 {
    font-family: 'Playfair Display', serif;
    margin-top: 2em;
    margin-bottom: 0.5em;
}

.article-content blockquote {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: 1.2rem;
    border-left: 3px solid var(--accent-color);
    padding-left: 20px;
    margin: 30px 0;
    color: var(--ink-light);
}

/* Liste puntate e numerate */
/* Tabelle nel contenuto articolo */
.article-content table,
.timeline-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
    font-size: 0.95rem;
    background: var(--paper-dark);
    border: 2px solid var(--border-color);
}

.article-content table th,
.timeline-table th {
    background: var(--border-color);
    color: var(--paper-color);
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 15px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

.article-content table td,
.timeline-table td {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.article-content table tr:nth-child(even),
.timeline-table tr:nth-child(even) {
    background: rgba(139, 115, 85, 0.08);
}

.article-content table tr:hover,
.timeline-table tr:hover {
    background: rgba(139, 115, 85, 0.15);
}

/* Responsive tabelle */
@media (max-width: 768px) {
    .article-content table,
    .timeline-table {
        font-size: 0.85rem;
    }

    .article-content table th,
    .article-content table td,
    .timeline-table th,
    .timeline-table td {
        padding: 8px 10px;
    }
}

.article-content ul,
.article-content ol {
    margin: 1.5em 0;
    padding-left: 2em;
}

.article-content ul {
    list-style-type: disc;
}

.article-content ol {
    list-style-type: decimal;
}

.article-content li {
    margin-bottom: 0.5em;
    line-height: 1.6;
    text-align: left;
}

.article-content ul ul,
.article-content ol ol,
.article-content ul ol,
.article-content ol ul {
    margin: 0.5em 0;
}

.article-content ul ul {
    list-style-type: circle;
}

.article-content ul ul ul {
    list-style-type: square;
}

.article-content img {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
    filter: sepia(15%);
}

/* Immagine in evidenza stile giornale */
.article-featured-image {
    float: right;
    width: 320px;
    margin: 0 0 20px 30px;
    border: 1px solid var(--border-color);
    background: var(--paper-dark);
    padding: 8px;
}

.article-featured-image img {
    width: 100%;
    height: auto;
    display: block;
    filter: sepia(20%) contrast(1.05);
    margin: 0;
}

.article-featured-image figcaption {
    font-size: 0.8rem;
    font-style: italic;
    text-align: center;
    padding-top: 8px;
    color: var(--ink-light);
}

@media (max-width: 768px) {
    .article-featured-image {
        float: none;
        width: 100%;
        margin: 0 0 20px 0;
    }
}

/* ======================================
   IMMAGINI EMBEDDED NEL CONTENUTO
   Usare [media:ID] nel contenuto articolo
   ====================================== */

.article-embedded-image {
    border: 1px solid var(--border-color);
    background: var(--paper-dark);
    padding: 8px;
    box-sizing: border-box;
}

.article-embedded-image img {
    width: 100%;
    height: auto;
    display: block;
    filter: sepia(20%) contrast(1.05);
    margin: 0;
}

.article-embedded-image figcaption {
    font-size: 0.85rem;
    font-style: italic;
    text-align: center;
    padding-top: 8px;
    color: var(--ink-light);
    border-top: 1px dotted var(--border-color);
    margin-top: 8px;
}

/* Immagine centrata */
.embedded-center {
    max-width: 80%;
    margin: 25px auto;
    display: block;
    clear: both;
}

/* Immagine a larghezza piena */
.embedded-full {
    width: 100%;
    max-width: 100%;
    margin: 30px 0;
    clear: both;
}

/* Immagine a sinistra (con testo a fianco) */
.embedded-left {
    float: left;
    max-width: 45%;
    margin: 5px 25px 15px 0;
}

/* Immagine a destra (con testo a fianco) */
.embedded-right {
    float: right;
    max-width: 45%;
    margin: 5px 0 15px 25px;
}

/* Clearfix per immagini float */
.article-content::after {
    content: '';
    display: table;
    clear: both;
}

/* Responsive: su mobile tutte le immagini a larghezza piena */
@media (max-width: 768px) {
    .embedded-left,
    .embedded-right,
    .embedded-center {
        float: none;
        max-width: 100%;
        width: 100%;
        margin: 20px 0;
    }
}

/* ======================================
   LIGHTBOX
   ====================================== */

.lightbox-trigger {
    cursor: zoom-in;
    display: block;
}

.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: #fff;
    cursor: pointer;
    z-index: 10001;
    line-height: 1;
    transition: color 0.2s;
}

.lightbox-close:hover {
    color: var(--accent-color);
}

.lightbox-content {
    max-width: 90%;
    max-height: 80vh;
    position: relative;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 75vh;
    display: block;
    margin: 0 auto;
    box-shadow: 0 5px 30px rgba(0,0,0,0.5);
    border: 3px solid var(--paper-color);
}

.lightbox-caption {
    color: var(--paper-color);
    text-align: center;
    padding: 15px 20px;
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto;
}

/* Video embed */
.video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin: 25px 0;
    border: 1px solid var(--border-color);
}

.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ======================================
   NAVIGAZIONE PAGINE (FLIP)
   ====================================== */

.page-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-top: 30px;
    border-top: 2px solid var(--border-color);
}

.page-nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 25px;
    background: var(--paper-dark);
    border: 2px solid var(--border-color);
    color: var(--ink-color);
    text-decoration: none;
    font-family: 'Old Standard TT', serif;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.page-nav-btn:hover {
    background: var(--border-color);
    color: var(--paper-color);
}

.page-nav-btn:disabled,
.page-nav-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-indicator {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    color: var(--gold-color);
}

/* ======================================
   MENU LINGUA
   ====================================== */

.lang-switch {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 5px;
}

.lang-btn {
    padding: 8px 15px;
    background: var(--paper-color);
    border: 2px solid var(--border-color);
    color: var(--ink-color);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

.lang-btn:hover,
.lang-btn.active {
    background: var(--border-color);
    color: var(--paper-color);
}

/* ======================================
   FOOTER GIORNALE
   ====================================== */

.newspaper-footer {
    text-align: center;
    padding: 30px 0 20px;
    margin-top: 40px;
    border-top: 3px double var(--border-color);
}

.newspaper-footer p {
    font-size: 0.85rem;
    color: var(--ink-light);
    margin: 5px 0;
}

/* ======================================
   RESPONSIVE
   ====================================== */

@media (max-width: 992px) {
    .newspaper-grid {
        grid-template-columns: 1fr;
    }

    .article-main,
    .article-sidebar,
    .article-half,
    .article-full {
        grid-column: span 1;
    }

    .article-sidebar {
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding-left: 0;
        padding-top: 25px;
    }

    .text-columns {
        column-count: 1;
    }

    .newspaper-page {
        padding: 25px 20px;
    }
}

@media (max-width: 768px) {
    .newspaper-masthead {
        font-size: 2rem;
    }

    .newspaper-date-line {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }

    .article-title {
        font-size: 1.5rem;
    }

    .page-navigation {
        flex-direction: column;
        gap: 15px;
    }

    .lang-switch {
        position: relative;
        top: 0;
        right: 0;
        justify-content: center;
        margin-bottom: 20px;
    }
}

/* ======================================
   EFFETTO FLIP PAGINA (Turn.js style)
   ====================================== */

.flipbook {
    width: 100%;
    height: auto;
}

.flipbook .page {
    background: var(--paper-color);
}

.flipbook .page-wrapper {
    perspective: 2000px;
}

/* Hard cover effect */
.flipbook .hard {
    background: linear-gradient(135deg, #3d3425 0%, #2c1810 100%);
    color: var(--paper-color);
    font-family: 'Playfair Display', serif;
}

/* Page curl shadow */
.page-curl {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.1) 50%);
    cursor: pointer;
}

/* Animazione sfoglio */
@keyframes pageFlip {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(-180deg); }
}

.page-flipping {
    animation: pageFlip 0.6s ease-in-out;
    transform-origin: left center;
}

/* ======================================
   CATEGORIE MENU
   ====================================== */

.category-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 25px;
}

.category-nav a {
    padding: 5px 15px;
    font-family: 'Old Standard TT', serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ink-color);
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.category-nav a:hover,
.category-nav a.active {
    border-color: var(--border-color);
    background: var(--paper-dark);
}

/* ======================================
   PAGINAZIONE
   ====================================== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 40px 0 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.pagination a,
.pagination span {
    padding: 8px 15px;
    font-family: 'Old Standard TT', serif;
    font-size: 0.9rem;
    color: var(--ink-color);
    text-decoration: none;
    border: 1px solid var(--border-color);
    background: var(--paper-color);
    transition: all 0.3s ease;
}

.pagination a:hover,
.pagination span.current {
    background: var(--border-color);
    color: var(--paper-color);
}

/* ======================================
   PRINT STYLES
   ====================================== */

/* ======================================
   WIDGET MERCATI - TAB LAYOUT
   ====================================== */

.markets-widget {
    margin: 25px 0;
    background: var(--paper-dark);
    border: 2px solid var(--border-color);
    position: relative;
}

.markets-widget::before {
    content: '§';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--paper-dark);
    padding: 0 10px;
    font-size: 1.2rem;
    color: var(--gold-color);
}

.markets-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-bottom: 1px solid var(--border-color);
}

.markets-tab {
    padding: 12px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    background: var(--paper-dark);
    border-right: 1px solid var(--border-color);
}

.markets-tab:last-child {
    border-right: none;
}

.markets-tab:hover {
    background: var(--paper-color);
}

.markets-tab.active {
    background: var(--paper-color);
    border-bottom-color: var(--accent-color);
}

.markets-tab-title {
    font-family: 'Playfair Display', serif;
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    color: var(--ink-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.markets-content {
    padding: 15px 20px 20px;
    background: var(--paper-color);
}

.markets-content .no-data {
    text-align: center;
    font-family: 'IM Fell English', serif;
    font-style: italic;
    color: var(--ink-light);
    padding: 20px;
}

/* Griglia mercati */
.markets-grid {
    display: grid;
    gap: 15px;
}

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

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

/* Card singolo mercato */
.market-card {
    padding: 12px;
    background: var(--paper-dark);
    border: 1px solid var(--border-color);
}

.market-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.market-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.market-name {
    font-family: 'Old Standard TT', serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ink-color);
}

.market-price {
    text-align: center;
    font-family: 'Old Standard TT', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink-color);
    padding: 8px 0;
    border-bottom: 1px dotted var(--border-color);
    margin-bottom: 8px;
}

.market-change {
    text-align: center;
    font-family: 'Old Standard TT', serif;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 6px;
    border-radius: 3px;
}

.market-change.trend-up {
    background: rgba(46, 125, 50, 0.1);
    color: #2e7d32;
}

.market-change.trend-down {
    background: rgba(198, 40, 40, 0.1);
    color: #c62828;
}

/* Trend badges */
.market-trends {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.trend-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 2px;
    font-family: 'Old Standard TT', serif;
    font-size: 0.65rem;
    font-weight: 700;
    text-align: center;
    border-radius: 2px;
    background: var(--paper-color);
}

.trend-badge.trend-up {
    color: #2e7d32;
}

.trend-badge.trend-down {
    color: #c62828;
}

.trend-badge.trend-flat {
    color: var(--ink-light);
}

.markets-updated {
    text-align: center;
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: 0.75rem;
    color: var(--gold-color);
    margin: 15px 0 0;
    padding-top: 10px;
    border-top: 1px dotted var(--border-color);
}

/* Responsive markets widget */
@media (max-width: 992px) {
    .markets-tabs {
        grid-template-columns: repeat(4, 1fr);
    }

    .markets-tab-title {
        font-size: 0.8rem;
    }

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

@media (max-width: 768px) {
    .markets-tabs {
        grid-template-columns: repeat(2, 1fr);
    }

    .markets-tab-title {
        font-size: 0.75rem;
        letter-spacing: 0;
    }

    .markets-grid-3,
    .markets-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .market-card {
        padding: 10px;
    }

    .market-price {
        font-size: 1rem;
    }

    .trend-badge {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .markets-tabs {
        grid-template-columns: repeat(2, 1fr);
    }

    .markets-grid-3,
    .markets-grid-4 {
        grid-template-columns: 1fr;
    }

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

/* Stili legacy per compatibilità */
.currency-widget {
    margin: 25px 0;
    padding: 20px;
    background: var(--paper-dark);
    border: 2px solid var(--border-color);
    position: relative;
}

.currency-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 5px;
    color: var(--ink-color);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.currency-subtitle {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: 0.9rem;
    color: var(--ink-light);
    margin: 0;
}

.currency-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.currency-card {
    display: flex;
    flex-direction: column;
    padding: 12px;
    background: var(--paper-color);
    border: 1px solid var(--border-color);
}

.currency-header-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.currency-flag {
    font-size: 1.5rem;
    line-height: 1;
}

.currency-info {
    display: flex;
    flex-direction: column;
}

.currency-code {
    font-family: 'Old Standard TT', serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink-color);
    letter-spacing: 1px;
}

.currency-name {
    font-family: 'IM Fell English', serif;
    font-size: 0.7rem;
    color: var(--ink-light);
    font-style: italic;
}

.currency-rate {
    text-align: center;
    padding: 8px 0;
    border-bottom: 1px dotted var(--border-color);
    margin-bottom: 8px;
}

.rate-value {
    font-family: 'Old Standard TT', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink-color);
}

.currency-trends {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.trend-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 2px;
    background: var(--paper-dark);
    border-radius: 2px;
}

.trend-label {
    font-family: 'Old Standard TT', serif;
    font-size: 0.65rem;
    color: var(--ink-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.trend-value {
    font-family: 'Old Standard TT', serif;
    font-size: 0.7rem;
    font-weight: 700;
}

.trend-value.trend-up {
    color: #2e7d32;
}

.trend-value.trend-down {
    color: #c62828;
}

.trend-value.trend-flat {
    color: var(--ink-light);
}

/* Safe Haven Widget - griglia a 3 colonne */
.safehaven-grid {
    grid-template-columns: repeat(3, 1fr);
}

.safehaven-icon {
    font-size: 1.3rem;
}

.safehaven-widget {
    margin-top: 15px;
}

.currency-updated {
    text-align: center;
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: 0.75rem;
    color: var(--gold-color);
    margin: 15px 0 0;
    padding-top: 10px;
    border-top: 1px dotted var(--border-color);
}

/* Responsive currency widget */
@media (max-width: 992px) {
    .currency-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 768px) {
    .currency-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .safehaven-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .currency-title {
        font-size: 1.1rem;
    }

    .currency-flag {
        font-size: 1.3rem;
    }

    .rate-value {
        font-size: 1rem;
    }

    .currency-trends {
        grid-template-columns: repeat(4, 1fr);
        gap: 3px;
    }

    .trend-label {
        font-size: 0.6rem;
    }

    .trend-value {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .currency-grid,
    .safehaven-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .currency-card {
        padding: 10px;
    }

    .currency-header-row {
        justify-content: center;
    }

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

/* ======================================
   PRINT STYLES
   ====================================== */

@media print {
    body {
        background: white;
    }

    .newspaper-page {
        box-shadow: none;
        padding: 20px;
    }

    .lang-switch,
    .page-navigation {
        display: none;
    }
}
