/* Clinutripal FFQ Styles */

/* ===== FFQ Form Styles ===== */
.clnutripal-ffq .clnutripal-ffq-stats {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 12px 0;
    font-size: 14px;
    color: #555;
}

/* Group Header */
.clnutripal-ffq-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #43a047 0%, #66bb6a 100%);
    border-radius: 10px;
    color: #fff;
}

.clnutripal-ffq-group-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.clnutripal-ffq-group-count {
    font-size: 13px;
    opacity: 0.9;
}

/* Food Table */
.clnutripal-ffq-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -10px;
    padding: 0 10px;
}

.clnutripal-ffq-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    direction: rtl;
}

.clnutripal-ffq-table thead th {
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 700;
    padding: 10px 8px;
    text-align: center;
    border-bottom: 2px solid #43a047;
    white-space: nowrap;
    font-size: 13px;
}

.clnutripal-ffq-table tbody tr {
    transition: background 0.2s;
}

.clnutripal-ffq-table tbody tr:nth-child(even) {
    background: #f9fbe7;
}

.clnutripal-ffq-table tbody tr:hover {
    background: #e8f5e9;
}

.clnutripal-ffq-table td {
    padding: 8px 6px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
}

/* Column widths */
.ffq-col-name {
    min-width: 100px;
    max-width: 150px;
}
.ffq-col-unit {
    min-width: 80px;
    max-width: 120px;
    font-size: 12px;
    color: #666;
}
.ffq-col-freq {
    min-width: 100px;
    text-align: center;
}
.ffq-col-amount {
    min-width: 80px;
    text-align: center;
}

/* Food name */
.ffq-food-name {
    font-weight: 600;
    color: #1a1a2e;
    font-size: 13px;
}

/* Seasonal fruit badge */
.ffq-seasonal-badge {
    display: inline-block;
    background: #ff9800;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 4px;
    vertical-align: middle;
    line-height: 1.6;
}

/* Seasonal fruit row highlight */
.clnutripal-ffq-table tbody tr.ffq-seasonal-fruit {
    background: #fff8e1;
}

.clnutripal-ffq-table tbody tr.ffq-seasonal-fruit:nth-child(even) {
    background: #fff3e0;
}

.clnutripal-ffq-table tbody tr.ffq-seasonal-fruit:hover {
    background: #ffe0b2;
}

/* Frequency dropdown */
.clnutripal-ffq-freq {
    width: 100%;
    padding: 8px 6px;
    border: 2px solid #a5d6a7;
    border-radius: 8px;
    font-size: 13px;
    font-family: Tahoma, Arial, sans-serif;
    background: #fff;
    color: #1a1a2e;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    direction: rtl;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2343a047' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 8px center;
}

.clnutripal-ffq-freq:focus {
    border-color: #43a047;
    outline: none;
    box-shadow: 0 0 0 3px rgba(67,160,71,0.2);
}

/* Amount input */
.clnutripal-ffq-amount {
    width: 70px;
    padding: 8px 6px;
    border: 2px solid #a5d6a7;
    border-radius: 8px;
    font-size: 16px;
    font-family: Tahoma, Arial, sans-serif;
    text-align: center;
    color: #1a1a2e;
    background: #fff;
    outline: none;
    transition: all 0.2s;
    -moz-appearance: textfield;
    direction: ltr;
}

.clnutripal-ffq-amount::-webkit-outer-spin-button,
.clnutripal-ffq-amount::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.clnutripal-ffq-amount:focus {
    border-color: #43a047;
    background: #e8f5e9;
    box-shadow: 0 0 0 3px rgba(67,160,71,0.2);
}

.clnutripal-ffq-amount:disabled {
    background: #f5f5f5;
    border-color: #e0e0e0;
    color: #bdbdbd;
    cursor: not-allowed;
}

/* ===== FFQ Report Styles ===== */

/* Energy Summary */
.ffq-energy-section {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.ffq-energy-section h3 {
    color: #2e7d32;
    border-bottom: 2px solid #43a047;
    padding-bottom: 8px;
    margin-bottom: 12px;
}

/* Chart Section */
.ffq-chart-section {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.ffq-chart-section h3 {
    color: #1a1a2e;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.ffq-macro-chart-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 24px;
    justify-content: center;
}

.ffq-pie-chart {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.ffq-chart-legend {
    flex: 1;
    min-width: 220px;
}

.ffq-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
}

.ffq-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.ffq-legend-label {
    font-weight: 600;
    font-size: 14px;
    min-width: 70px;
}

.ffq-legend-value {
    font-weight: 700;
    font-size: 16px;
    color: #1a1a2e;
}

.ffq-legend-detail {
    font-size: 12px;
    color: #666;
}

.ffq-legend-total {
    border-top: 2px solid #333;
    border-bottom: none;
    padding-top: 8px;
    margin-top: 4px;
    font-weight: 700;
}

.ffq-formula-note {
    width: 100%;
    text-align: center;
    margin-top: 8px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 11px;
    color: #666;
}

/* Report Tables */
.ffq-report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    direction: rtl;
    margin: 0;
}

.ffq-report-table thead th {
    background: #43a047;
    color: #fff;
    padding: 10px 12px;
    text-align: right;
    font-weight: 700;
    font-size: 13px;
}

.ffq-report-table thead th:first-child {
    border-radius: 0 8px 0 0;
}

.ffq-report-table thead th:last-child {
    border-radius: 8px 0 0 0;
}

.ffq-report-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.2s;
}

.ffq-report-table tbody tr:nth-child(even) {
    background: #f9fbe7;
}

.ffq-report-table tbody tr:hover {
    background: #e8f5e9;
}

.ffq-report-table td {
    padding: 8px 12px;
    vertical-align: middle;
}

.ffq-report-table .ffq-total-row {
    background: #e8f5e9 !important;
    font-weight: 700;
    border-top: 2px solid #43a047;
}

/* Group table specific */
.ffq-groups-table .ffq-group-name {
    font-weight: 600;
    color: #2e7d32;
}

.ffq-groups-table .ffq-group-value {
    font-weight: 700;
    text-align: center;
    direction: ltr;
    font-size: 14px;
}

.ffq-groups-table .ffq-group-count {
    text-align: center;
    color: #666;
}

/* Nutrient table specific */
.ffq-nutrient-name {
    font-weight: 600;
    color: #1a1a2e;
    min-width: 180px;
}

.ffq-nutrient-value {
    text-align: center;
    font-weight: 700;
    direction: ltr;
    color: #2e7d32;
    font-size: 14px;
}

/* Multi-column table divider */
.ffq-col-divider {
    width: 2px;
    background: #43a047;
    padding: 0 !important;
    min-width: 2px;
}

/* Multi-column nutrient table */
.ffq-multi-col .ffq-nutrient-name {
    min-width: 100px;
    font-size: 11px;
}

.ffq-multi-col .ffq-nutrient-value {
    min-width: 60px;
    font-size: 12px;
}

/* Recommendations */
.ffq-recommendations-section {
    background: #fff3e0;
    border-radius: 12px;
    padding: 16px;
}

.ffq-recommendations-section h3 {
    color: #e65100;
    border-bottom: 2px solid #ff9800;
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.ffq-rec-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ffq-rec-list li {
    padding: 8px 12px;
    margin-bottom: 6px;
    background: #fff;
    border-right: 4px solid #ff9800;
    border-radius: 0 8px 8px 0;
    font-size: 13px;
    line-height: 1.6;
}

.ffq-rec-list li:last-child {
    background: #ffe0b2;
    border-right-color: #e65100;
    font-weight: 600;
}

/* ===== Print Styles ===== */
@media print {
    .ffq-pie-chart {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .ffq-report-table thead th,
    .ffq-legend-color,
    .clnutripal-ffq-group-header {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .ffq-rec-list li {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .ffq-energy-section,
    .ffq-recommendations-section {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ===== Mobile Responsive ===== */
@media (max-width: 600px) {
    .clnutripal-ffq-table {
        font-size: 12px;
    }

    .clnutripal-ffq-table thead th {
        padding: 8px 4px;
        font-size: 11px;
    }

    .clnutripal-ffq-table td {
        padding: 6px 4px;
    }

    .ffq-col-name {
        min-width: 80px;
        max-width: 100px;
    }

    .ffq-col-unit {
        min-width: 60px;
        max-width: 80px;
        font-size: 10px;
    }

    .clnutripal-ffq-freq {
        font-size: 11px;
        padding: 6px 4px;
    }

    .clnutripal-ffq-amount {
        width: 55px;
        font-size: 14px;
        padding: 6px 4px;
    }

    .ffq-pie-chart {
        width: 120px;
        height: 120px;
    }

    .ffq-macro-chart-wrap {
        gap: 16px;
    }

    .ffq-legend-label {
        min-width: 55px;
        font-size: 12px;
    }

    .ffq-legend-value {
        font-size: 14px;
    }

    .ffq-legend-detail {
        font-size: 10px;
    }

    .ffq-report-table {
        font-size: 11px;
    }

    .ffq-report-table td,
    .ffq-report-table th {
        padding: 6px 8px;
    }
}
