/**
 * OliveData Hub Enterprise - Public CSS (BEM & Modern CSS Variables)
 */

:root {
    --odh-primary: #4A5D23;
    --odh-primary-dark: #334216;
    --odh-primary-light: #6E8437;
    --odh-accent: #C5A059;
    --odh-bg-surface: #FFFFFF;
    --odh-bg-soft: #F8FAF6;
    --odh-border: #E2E8DC;
    --odh-text-main: #1F2913;
    --odh-text-muted: #64748B;
    --odh-radius: 12px;
    --odh-shadow: 0 4px 20px -2px rgba(74, 93, 35, 0.08);
}

/* ==========================================================================
   1. TICKER COMPONENT
   ========================================================================== */
.olivedata-ticker-wrapper {
    display: flex;
    align-items: center;
    background: linear-gradient(90deg, #2D3B18 0%, #445826 100%);
    color: #FFFFFF;
    border-radius: var(--odh-radius);
    overflow: hidden;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    font-size: 14px;
}

.olivedata-ticker-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1F2A0E;
    padding: 12px 18px;
    font-weight: 700;
    white-space: nowrap;
    z-index: 2;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.15);
}

.olivedata-pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #22C55E;
    border-radius: 50%;
    animation: odh-pulse 1.8s infinite;
}

@keyframes odh-pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.olivedata-ticker-track-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    white-space: nowrap;
    padding: 10px 0;
}

.olivedata-ticker-track {
    display: inline-flex;
    white-space: nowrap;
    animation: odh-marquee 30s linear infinite;
}

.olivedata-ticker-track:hover {
    animation-play-state: paused;
}

@keyframes odh-marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.olivedata-ticker-content {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.olivedata-ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
}

.olivedata-country-name { font-weight: 600; color: #E2E8DC; }
.olivedata-category-name { color: #C5D4B2; font-size: 13px; }
.olivedata-price-val { color: #FFFFFF; background: rgba(255, 255, 255, 0.15); padding: 2px 8px; border-radius: 4px; }
.olivedata-trend-badge { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.trend-up { background-color: rgba(16, 185, 129, 0.25); color: #34D399; }
.trend-down { background-color: rgba(239, 68, 68, 0.25); color: #F87171; }
.trend-neutral { background-color: rgba(255, 255, 255, 0.1); color: #E5E7EB; }
.olivedata-separator { color: rgba(255, 255, 255, 0.25); margin-left: 6px; }

/* ==========================================================================
   2. PRICE MATRIX COMPONENT (4-WAY DENSITY CONVERTER)
   ========================================================================== */
.olivedata-table-wrapper {
    background: var(--odh-bg-surface);
    border: 1px solid var(--odh-border);
    border-radius: var(--odh-radius);
    box-shadow: var(--odh-shadow);
    margin: 25px 0;
    overflow: hidden;
}

.olivedata-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: var(--odh-bg-soft);
    border-bottom: 1px solid var(--odh-border);
    flex-wrap: wrap;
    gap: 12px;
}

.olivedata-table-header-left { display: flex; align-items: center; gap: 12px; }
.olivedata-table-icon { font-size: 24px; }
.olivedata-table-title { margin: 0; font-size: 18px; font-weight: 700; color: var(--odh-text-main); }
.olivedata-table-sub { font-size: 12px; color: var(--odh-text-muted); }

.olivedata-currency-switch {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #EAEFE5;
    padding: 4px;
    border-radius: 8px;
}

.olivedata-currency-switch .switch-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--odh-text-muted);
    padding: 0 6px;
}

.olivedata-currency-switch .curr-btn {
    background: transparent;
    border: none;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--odh-text-main);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.olivedata-currency-switch .curr-btn.active {
    background: var(--odh-primary);
    color: #FFFFFF;
}

.olivedata-matrix-filters {
    display: flex;
    gap: 8px;
    padding: 12px 24px;
    background: #FAFBF9;
    border-bottom: 1px solid var(--odh-border);
    overflow-x: auto;
}

.filter-tab {
    background: transparent;
    border: 1px solid var(--odh-border);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--odh-text-main);
    transition: all 0.2s;
}

.filter-tab.active {
    background: var(--odh-primary);
    color: #FFFFFF;
    border-color: var(--odh-primary);
}

.olivedata-table-responsive { overflow-x: auto; width: 100%; }
.olivedata-main-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.olivedata-main-table thead th {
    background: #FAFBF9;
    color: var(--odh-text-muted);
    font-weight: 600;
    padding: 12px 18px;
    border-bottom: 1px solid var(--odh-border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.olivedata-main-table tbody tr { border-bottom: 1px solid #F0F4EC; transition: background-color 0.15s ease; }
.olivedata-main-table tbody tr:hover { background-color: #F7FAF3; }
.olivedata-main-table td { padding: 14px 18px; vertical-align: middle; color: var(--odh-text-main); }

.country-cell { display: flex; align-items: center; gap: 10px; }
.country-flag { font-size: 20px; }
.market-loc { display: block; font-size: 11px; color: var(--odh-text-muted); }

.cat-badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.cat-extra_virgin { background: #E8F5E9; color: #2E7D32; border: 1px solid #C8E6C9; }
.cat-virgin { background: #E0F2F1; color: #00695C; border: 1px solid #B2DFDB; }
.cat-lampante { background: #FFF8E1; color: #F57F17; border: 1px solid #FFE082; }

.price-unit-value strong { font-size: 16px; color: var(--odh-primary-dark); }
.price-100kg-value { color: var(--odh-text-muted); font-size: 13px; }
.table-trend-badge { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.date-badge { background: #F1F5EB; padding: 3px 8px; border-radius: 4px; font-size: 12px; color: var(--odh-text-muted); }

.olivedata-table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--odh-bg-soft);
    border-top: 1px solid var(--odh-border);
    font-size: 12px;
    color: var(--odh-text-muted);
    flex-wrap: wrap;
    gap: 8px;
}

/* ==========================================================================
   3. CULTIVAR DB CARD COMPONENT
   ========================================================================== */
.olivedata-cultivar-card {
    background: var(--odh-bg-surface);
    border: 1px solid var(--odh-border);
    border-radius: var(--odh-radius);
    padding: 24px;
    margin: 25px 0;
    box-shadow: var(--odh-shadow);
}

.cultivar-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.cultivar-tag { background: #EBF2DF; color: var(--odh-primary); font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 4px; display: inline-block; margin-bottom: 6px; }
.cultivar-title { margin: 0 0 4px 0; font-size: 20px; font-weight: 700; color: var(--odh-text-main); }
.cultivar-origin { font-size: 13px; color: var(--odh-text-muted); }
.cultivar-badge-icon { font-size: 36px; }

.cultivar-specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.spec-card {
    background: #FAFBF9;
    border: 1px solid var(--odh-border);
    padding: 14px;
    border-radius: 8px;
}

.spec-card-label { display: block; font-size: 12px; color: var(--odh-text-muted); margin-bottom: 4px; }
.spec-card-val { font-size: 16px; font-weight: 700; color: var(--odh-text-main); }
.spec-green { color: #16A34A; }

.cultivar-tasting-box {
    background: #F8FAF6;
    border-left: 4px solid var(--odh-primary);
    padding: 16px;
    border-radius: 0 8px 8px 0;
}

.taste-item { margin-bottom: 10px; }
.taste-item:last-child { margin-bottom: 0; }
.taste-desc { margin: 4px 0 0 0; font-size: 13px; color: #334155; }

/* ==========================================================================
   4. HARVEST MAP & DASHBOARD COMPONENT
   ========================================================================== */
.olivedata-harvest-dashboard {
    background: var(--odh-bg-surface);
    border: 1px solid var(--odh-border);
    border-radius: var(--odh-radius);
    padding: 24px;
    margin: 25px 0;
    box-shadow: var(--odh-shadow);
}

.harvest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--odh-border);
    padding-bottom: 14px;
    margin-bottom: 20px;
}

.harvest-header-left { display: flex; align-items: center; gap: 12px; }
.harvest-icon { font-size: 28px; }
.harvest-title { margin: 0 0 4px 0; font-size: 18px; font-weight: 700; color: var(--odh-text-main); }
.harvest-sub { font-size: 13px; color: var(--odh-text-muted); }
.harvest-badge { background: var(--odh-primary); color: #FFFFFF; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }

.harvest-bar-row { margin-bottom: 16px; }
.harvest-bar-meta { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 14px; }
.harvest-progress-track { height: 10px; background: #EAEFE5; border-radius: 10px; overflow: hidden; }
.harvest-progress-fill { height: 100%; background: linear-gradient(90deg, #6E8437 0%, #4A5D23 100%); border-radius: 10px; }
.harvest-bar-sub { display: flex; justify-content: space-between; font-size: 11px; color: var(--odh-text-muted); margin-top: 4px; }
.trend-pill { font-weight: 700; color: #16A34A; }
.harvest-footer { border-top: 1px solid var(--odh-border); padding-top: 12px; margin-top: 20px; font-size: 11px; color: var(--odh-text-muted); }

/* ==========================================================================
   5. CALCULATOR, NEWS & WOOCOMMERCE STYLES
   ========================================================================== */
.olivedata-calculator-card { background: var(--odh-bg-surface); border: 1px solid var(--odh-border); border-radius: var(--odh-radius); box-shadow: var(--odh-shadow); padding: 24px; margin: 25px 0; }
.calc-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; border-bottom: 1px solid var(--odh-border); padding-bottom: 14px; }
.calc-icon { font-size: 28px; }
.calc-title { margin: 0 0 4px 0; font-size: 18px; font-weight: 700; color: var(--odh-text-main); }
.calc-sub { margin: 0; font-size: 13px; color: var(--odh-text-muted); }
.calc-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; }
.calc-field { margin-bottom: 16px; }
.calc-field label { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.field-val-badge { background: #EBF2DF; color: var(--odh-primary); padding: 2px 8px; border-radius: 4px; font-weight: 700; font-size: 12px; }
.odh-range { width: 100%; accent-color: var(--odh-primary); cursor: pointer; }
.calc-field-row { display: flex; gap: 12px; }
.calc-field.half { flex: 1; }
.odh-input { width: 100%; padding: 8px 12px; border: 1px solid var(--odh-border); border-radius: 8px; font-size: 14px; }

.res-card.res-primary { background: linear-gradient(135deg, #4A5D23 0%, #334216 100%); color: #FFFFFF; padding: 20px; border-radius: 10px; margin-bottom: 16px; }
.res-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.85; }
.res-val-big { font-size: 24px; font-weight: 800; margin: 6px 0; }
.res-note { font-size: 11px; opacity: 0.75; }
.res-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box { background: #FAFBF9; border: 1px solid var(--odh-border); padding: 12px; border-radius: 8px; }
.stat-label { display: block; font-size: 11px; color: var(--odh-text-muted); margin-bottom: 4px; }
.stat-val { font-size: 15px; font-weight: 700; color: var(--odh-text-main); }
.stat-highlight { color: #D97706; }
.stat-profit { color: #16A34A; }

.olivedata-news-wrapper { background: var(--odh-bg-surface); border: 1px solid var(--odh-border); border-radius: var(--odh-radius); padding: 24px; margin: 25px 0; box-shadow: var(--odh-shadow); }
.olivedata-news-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--odh-border); padding-bottom: 14px; margin-bottom: 20px; }
.news-header-left { display: flex; align-items: center; gap: 10px; }
.news-icon { font-size: 24px; }
.news-title { margin: 0; font-size: 18px; font-weight: 700; color: var(--odh-text-main); }
.news-sub { font-size: 12px; color: var(--odh-text-muted); }
.news-badge-live { background: #DC2626; color: #FFFFFF; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 4px; }

.olivedata-news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.olivedata-news-card { border: 1px solid var(--odh-border); border-radius: 10px; overflow: hidden; background: #FAFBF9; display: flex; flex-direction: column; }
.news-img-wrap img { width: 100%; height: 160px; object-fit: cover; }
.news-content { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.news-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--odh-text-muted); margin-bottom: 8px; }
.news-headline { margin: 0 0 8px 0; font-size: 15px; font-weight: 700; line-height: 1.4; }
.news-headline a { color: var(--odh-text-main); text-decoration: none; }
.news-excerpt { font-size: 13px; color: #475569; line-height: 1.5; margin: 0 0 14px 0; flex: 1; }
.news-readmore { font-size: 12px; font-weight: 700; color: var(--odh-primary); text-decoration: none; }

.olivedata-wc-badge-card { display: inline-flex; align-items: center; gap: 12px; background: #F4F7EF; border: 1px solid #D7E2CA; padding: 10px 16px; border-radius: 8px; margin: 14px 0; }
.olivedata-wc-badge-icon { font-size: 24px; }
.olivedata-wc-badge-info strong { display: block; font-size: 14px; color: var(--odh-primary-dark); }
.olivedata-wc-badge-sub { font-size: 12px; color: #4B5563; }
.olivedata-wc-score-pill { background: var(--odh-primary); color: #FFFFFF; font-weight: 800; font-size: 13px; padding: 4px 10px; border-radius: 20px; }

.olivedata-wc-analysis-tab { padding: 10px 0; }
.olivedata-wc-specs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 18px 0; }
.spec-item { background: #FAFBF9; border: 1px solid var(--odh-border); padding: 14px; border-radius: 8px; }
.spec-label { display: block; font-size: 12px; color: var(--odh-text-muted); margin-bottom: 4px; }
.spec-val { display: block; font-size: 16px; color: var(--odh-text-main); }
.spec-status { display: inline-block; font-size: 11px; font-weight: 600; color: var(--odh-primary); margin-top: 4px; }

.olivedata-wc-health-box { display: flex; align-items: flex-start; gap: 12px; background: #EFF6FF; border: 1px solid #BFDBFE; padding: 14px 18px; border-radius: 8px; margin-top: 18px; }
.health-icon { font-size: 24px; }
.health-text strong { display: block; font-size: 13px; color: #1E40AF; margin-bottom: 2px; }
.health-text p { margin: 0; font-size: 12px; color: #1E3A8A; line-height: 1.4; }

@media (max-width: 768px) {
    .calc-grid { grid-template-columns: 1fr; }
    .olivedata-table-header { flex-direction: column; align-items: flex-start; }
    .res-stats-grid { grid-template-columns: 1fr; }
}
