/* ========================================
   CALENDAR DISPLAY STYLES - Frontend
   For The Green Almanac calendar blocks
   ======================================== */

/* Calendar Container */
.article-calendars {
    margin-top: 3rem;
    padding: 2rem 0;
    border-top: 2px solid #333;
}

.article-calendars h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.calendars-intro {
    color: #666;
    font-style: italic;
    margin-bottom: 2rem;
}

/* Individual Calendar Block */
.calendar-block {
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.calendar-block:last-child {
    margin-bottom: 0;
}

.calendar-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #333;
}

.calendar-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.calendar-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.75rem;
}

.calendar-meta-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.calendar-meta-item strong {
    font-weight: 600;
    color: #333;
}

.calendar-description {
    font-style: italic;
    color: #555;
    margin-top: 0.5rem;
}

/* Calendar Content Area */
.calendar-content {
    margin-top: 1rem;
}

/* ========================================
   SPECIFIC CALENDAR TYPE STYLES
   ======================================== */

/* Moon Phases Table */
.moon-phases-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.moon-phases-table th,
.moon-phases-table td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid #ccc;
}

.moon-phases-table thead {
    background: #333;
    color: white;
}

.moon-phases-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}

.moon-phases-table tbody tr:hover {
    background: #e8e8e8;
}

.moon-phase-icon {
    font-size: 1.5rem;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Planting Calendar */
.planting-calendar {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.planting-calendar th,
.planting-calendar td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid #ccc;
}

.planting-calendar thead {
    background: #2d5016;
    color: white;
}

.planting-calendar tbody tr:nth-child(even) {
    background: #f4f7f4;
}

.planting-calendar tbody tr:hover {
    background: #e8f5e8;
}

.planting-calendar .crop-name {
    font-weight: 600;
}

.planting-calendar .seed-direct,
.planting-calendar .transplant {
    font-size: 0.9rem;
}

/* Frost Dates Table */
.frost-dates-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.frost-dates-table th,
.frost-dates-table td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid #ccc;
}

.frost-dates-table thead {
    background: #1a5490;
    color: white;
}

.frost-dates-table tbody tr:nth-child(even) {
    background: #f4f8fc;
}

.frost-dates-table tbody tr:hover {
    background: #e6f2ff;
}

.frost-dates-table .location-name {
    font-weight: 600;
}

/* Tasks Checklist */
.tasks-checklist {
    margin-top: 1rem;
}

/* Task Category Sections */
.task-category {
    margin-bottom: 2rem;
}

.task-category .category-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #ddd;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.task-category .category-icon {
    font-size: 1.5rem;
}

/* Checklist Format - With actual checkboxes */
.tasks-checklist-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tasks-checklist-list .task-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    transition: background 0.2s;
}

.tasks-checklist-list .task-item:hover {
    background: #f9f9f9;
}

.tasks-checklist-list .task-checkbox {
    width: 20px;
    height: 20px;
    margin-top: 0.25rem;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #4a7c59;
}

.tasks-checklist-list .task-content {
    flex: 1;
    cursor: pointer;
}

.tasks-checklist-list .task-name {
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
}

.tasks-checklist-list .task-description {
    font-size: 0.9rem;
    color: #666;
    margin: 0.25rem 0;
}

.tasks-checklist-list .task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #666;
}

.tasks-checklist-list .priority-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 3px;
}

.tasks-checklist-list .priority-badge.badge-critical,
.tasks-checklist-list .priority-badge.badge-high {
    background: #ffebee;
    color: #c62828;
}

.tasks-checklist-list .priority-badge.badge-medium {
    background: #fff8e1;
    color: #f57f17;
}

.tasks-checklist-list .priority-badge.badge-low {
    background: #e8f5e9;
    color: #2e7d32;
}

/* Checked state */
.tasks-checklist-list .task-checkbox:checked + .task-content {
    opacity: 0.6;
}

.tasks-checklist-list .task-checkbox:checked + .task-content .task-name {
    text-decoration: line-through;
}

/* Old task styles for backward compatibility */
.tasks-month {
    margin-bottom: 2rem;
}

.tasks-month-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #ccc;
    margin-bottom: 1rem;
}

.task-item {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.task-item:hover {
    background: #f9f9f9;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 1rem;
    margin-top: 0.25rem;
    flex-shrink: 0;
    border: 2px solid #666;
    border-radius: 3px;
    background: white;
}

.task-content {
    flex: 1;
}

.task-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.task-notes {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

.task-priority {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 3px;
    margin-left: 0.5rem;
}

.task-priority.high {
    background: #ffebee;
    color: #c62828;
}

.task-priority.medium {
    background: #fff8e1;
    color: #f57f17;
}

.task-priority.low {
    background: #e8f5e9;
    color: #2e7d32;
}

/* Weather Patterns */
.weather-patterns {
    margin-top: 1rem;
}

.weather-month {
    margin-bottom: 2rem;
}

.weather-month-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #ccc;
    margin-bottom: 1rem;
}

.weather-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.weather-stat {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 1rem;
    border-radius: 4px;
}

.weather-stat-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.weather-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.weather-notes {
    font-size: 0.9rem;
    color: #555;
    font-style: italic;
    margin-top: 0.5rem;
}

/* Companion Planting Chart */
.companion-planting-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.companion-planting-table th,
.companion-planting-table td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid #ccc;
}

.companion-planting-table thead {
    background: #388e3c;
    color: white;
}

.companion-planting-table tbody tr:nth-child(even) {
    background: #f1f8f4;
}

.companion-planting-table tbody tr:hover {
    background: #e8f5e9;
}

.companion-planting-table .crop-name {
    font-weight: 600;
}

.companion-tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    margin: 0.2rem;
    font-size: 0.85rem;
    border-radius: 3px;
}

.companion-tag.good {
    background: #c8e6c9;
    color: #2e7d32;
}

.companion-tag.bad {
    background: #ffcdd2;
    color: #c62828;
}

/* Pest Control Schedule */
.pest-control-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.pest-control-table th,
.pest-control-table td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid #ccc;
}

.pest-control-table thead {
    background: #d84315;
    color: white;
}

.pest-control-table tbody tr:nth-child(even) {
    background: #fff3e0;
}

.pest-control-table tbody tr:hover {
    background: #ffe0b2;
}

.pest-control-table .pest-name {
    font-weight: 600;
}

/* Reference Tables */
.reference-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.reference-table th,
.reference-table td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid #ccc;
}

.reference-table thead {
    background: #455a64;
    color: white;
}

.reference-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.reference-table tbody tr:hover {
    background: #eeeeee;
}

/* ========================================
   PRINT STYLES FOR CALENDARS
   ======================================== */

@media print {
    .article-calendars {
        page-break-before: always;
    }

    .calendar-block {
        page-break-inside: avoid;
        background: white !important;
        border: 2px solid #000 !important;
        margin-bottom: 2rem;
    }

    .calendar-header {
        border-bottom: 2px solid #000 !important;
    }

    /* Tables for print */
    .moon-phases-table,
    .planting-calendar,
    .frost-dates-table,
    .companion-planting-table,
    .pest-control-table,
    .reference-table {
        page-break-inside: avoid;
    }

    .moon-phases-table thead,
    .planting-calendar thead,
    .frost-dates-table thead,
    .companion-planting-table thead,
    .pest-control-table thead,
    .reference-table thead {
        background: #000 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .moon-phases-table th,
    .moon-phases-table td,
    .planting-calendar th,
    .planting-calendar td,
    .frost-dates-table th,
    .frost-dates-table td,
    .companion-planting-table th,
    .companion-planting-table td,
    .pest-control-table th,
    .pest-control-table td,
    .reference-table th,
    .reference-table td {
        border: 1px solid #000 !important;
    }

    /* Task checklist for print - show actual checkboxes */
    .task-checkbox {
        border: 2px solid #000 !important;
        background: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Remove hover effects and backgrounds in print */
    .moon-phases-table tbody tr,
    .planting-calendar tbody tr,
    .frost-dates-table tbody tr,
    .companion-planting-table tbody tr,
    .pest-control-table tbody tr,
    .reference-table tbody tr {
        background: white !important;
    }

    .moon-phases-table tbody tr:nth-child(even),
    .planting-calendar tbody tr:nth-child(even),
    .frost-dates-table tbody tr:nth-child(even),
    .companion-planting-table tbody tr:nth-child(even),
    .pest-control-table tbody tr:nth-child(even),
    .reference-table tbody tr:nth-child(even) {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */

@media (max-width: 768px) {
    .calendar-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .weather-stats {
        grid-template-columns: 1fr;
    }

    /* Stack table columns on mobile for better readability */
    .planting-calendar,
    .frost-dates-table,
    .companion-planting-table,
    .pest-control-table,
    .reference-table {
        font-size: 0.85rem;
    }

    .planting-calendar th,
    .planting-calendar td,
    .frost-dates-table th,
    .frost-dates-table td,
    .companion-planting-table th,
    .companion-planting-table td,
    .pest-control-table th,
    .pest-control-table td,
    .reference-table th,
    .reference-table td {
        padding: 0.5rem;
    }
}

/* ========================================
   DISPLAY FORMAT VARIATIONS
   Styles for list/timeline/chart formats
   ======================================== */

/* List Format - Generic */
.format-list ul {
    list-style: none;
    padding: 0;
}

.format-list li {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.format-list li:last-child {
    margin-bottom: 0;
}

/* Planting Calendar - List Format */
.planting-list {
    list-style: none;
    padding: 0;
}

.planting-list .crop-item {
    background: white;
    border-left: 4px solid #4a7c59;
    padding: 1rem;
    margin-bottom: 1rem;
}

.planting-list .crop-name {
    font-size: 1.1rem;
    color: #2d5a3d;
}

.planting-list .variety {
    color: #666;
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.planting-list .crop-details {
    margin-top: 0.5rem;
    color: #555;
    font-size: 0.95rem;
}

.planting-list .crop-notes {
    margin-top: 0.5rem;
    color: #666;
    font-style: italic;
}

/* Planting Calendar - Timeline Format */
.planting-timeline {
    padding: 1rem 0;
}

.planting-timeline .timeline-item {
    position: relative;
    padding-left: 2.5rem;
    margin-bottom: 1.5rem;
}

.planting-timeline .timeline-marker {
    position: absolute;
    left: 0;
    top: 0.25rem;
    width: 1rem;
    height: 1rem;
    background: #4a7c59;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 2px #4a7c59;
}

.planting-timeline .timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 1.25rem;
    width: 2px;
    height: calc(100% + 0.25rem);
    background: #ddd;
}

.planting-timeline .timeline-content strong {
    font-size: 1.05rem;
    color: #2d5a3d;
}

.planting-timeline .timeline-dates {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    color: #555;
    font-size: 0.95rem;
}

.planting-timeline .arrow {
    color: #999;
}

.planting-timeline .duration {
    color: #666;
    font-style: italic;
}

/* Moon Phases - List Format */
.moon-phases-list {
    list-style: none;
    padding: 0;
}

.moon-phases-list .phase-item {
    background: white;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.moon-phases-list .moon-icon {
    font-size: 2rem;
    line-height: 1;
}

.moon-phases-list .phase-name {
    font-size: 1.05rem;
    display: block;
    margin-bottom: 0.25rem;
}

.moon-phases-list .phase-details {
    color: #666;
    font-size: 0.9rem;
}

.moon-phases-list .best-for {
    margin-top: 0.25rem;
    color: #555;
}

/* Moon Phases - Timeline Format */
.moon-timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1rem 0;
}

.moon-timeline .timeline-phase {
    flex: 0 0 calc(50% - 0.75rem);
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
    text-align: center;
}

.moon-timeline .moon-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.moon-timeline .phase-info strong {
    display: block;
    margin-bottom: 0.25rem;
}

.moon-timeline .date {
    color: #666;
    font-size: 0.9rem;
}

/* Frost Dates - List Format */
.frost-dates-list {
    list-style: none;
    padding: 0;
}

.frost-dates-list .zone-item {
    background: white;
    border-left: 4px solid #5a8ca9;
    padding: 1rem;
    margin-bottom: 1rem;
}

.frost-dates-list .zone-name {
    font-size: 1.1rem;
    color: #2d4a5a;
    display: block;
    margin-bottom: 0.25rem;
}

.frost-dates-list .zone-desc {
    color: #666;
    font-size: 0.9rem;
}

.frost-dates-list .frost-info {
    margin-top: 0.5rem;
    color: #555;
}

.frost-dates-list .frost-info strong {
    color: #333;
}

/* Companion Planting - Table Format */
.companion-table {
    width: 100%;
}

.companion-table .plant-name {
    font-weight: 600;
    width: 20%;
}

.companion-table .good-companions,
.companion-table .bad-companions {
    width: 40%;
}

.companion-table ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.companion-table li {
    padding: 0.25rem 0;
    font-size: 0.95rem;
}

.companion-table .benefit,
.companion-table .reason {
    color: #666;
    font-size: 0.9rem;
}

/* Pest Control - Table Format */
.pest-table {
    width: 100%;
}

.pest-table .pest-name {
    font-weight: 600;
    width: 20%;
}

.pest-table .peak-season {
    width: 15%;
}

.pest-table .signs {
    width: 30%;
}

.pest-table .controls {
    width: 35%;
}

.pest-table ul {
    list-style: disc;
    padding-left: 1.25rem;
    margin: 0;
}

.pest-table li {
    padding: 0.125rem 0;
    font-size: 0.95rem;
}

/* Weather - Table Format */
.weather-table {
    width: 100%;
}

.weather-table .timeframe {
    width: 20%;
    font-weight: 600;
}

.weather-table .temperature,
.weather-table .precipitation {
    width: 20%;
}

.weather-table .advice {
    width: 40%;
}

.weather-table .detail {
    color: #666;
    font-size: 0.9rem;
}

/* Print Styles for New Formats */
@media print {
    .format-list li,
    .planting-list .crop-item,
    .frost-dates-list .zone-item {
        border: 1px solid #333;
        page-break-inside: avoid;
    }
    
    .planting-timeline .timeline-marker {
        background: #000;
        box-shadow: 0 0 0 2px #000;
    }
    
    .planting-timeline .timeline-item:not(:last-child)::before {
        background: #333;
    }
    
    .moon-timeline .timeline-phase {
        border: 1px solid #333;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .moon-timeline .timeline-phase {
        flex: 0 0 100%;
    }
    
    .planting-timeline .timeline-dates {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .moon-phases-list .phase-item {
        flex-direction: column;
        text-align: center;
    }
}

/* ========================================
   TASKS FORMATS - Table & Simple List
   ======================================== */

/* Tasks - Table Format */
.tasks-table {
    width: 100%;
}

.tasks-table .category-cell {
    background: #f0f0f0;
    font-weight: 600;
    vertical-align: top;
    width: 15%;
}

.tasks-table .task-name {
    width: 35%;
}

.tasks-table .task-desc {
    color: #666;
    font-size: 0.9rem;
    font-weight: normal;
}

.tasks-table .timing {
    width: 20%;
}

.tasks-table .duration {
    width: 15%;
}

.tasks-table .priority {
    width: 15%;
}

.tasks-table .badge {
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 600;
}

.tasks-table .priority-critical {
    background: #dc3545;
    color: white;
}

.tasks-table .priority-important {
    background: #ffc107;
    color: #333;
}

.tasks-table .priority-recommended {
    background: #28a745;
    color: white;
}

/* Tasks - Simple List Format */
.tasks-simple-list {
    list-style: none;
    padding: 0;
    column-count: 2;
    column-gap: 1.5rem;
}

.tasks-simple-list .task-list-item {
    background: white;
    border-left: 3px solid #4a7c59;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    break-inside: avoid;
    font-size: 0.95rem;
}

.tasks-simple-list .task-list-item.priority-critical {
    border-left-color: #dc3545;
}

.tasks-simple-list .task-list-item.priority-important {
    border-left-color: #ffc107;
}

.tasks-simple-list .category-icon {
    margin-right: 0.5rem;
}

.tasks-simple-list .category-label {
    color: #666;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.tasks-simple-list .timing {
    color: #555;
    font-style: italic;
}

/* ========================================
   CHART FORMAT - Planting Calendar
   ======================================== */

.planting-chart {
    padding: 1rem 0;
}

.planting-chart .chart-header h5 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #333;
}

.planting-chart .chart-row {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.planting-chart .chart-label {
    flex: 0 0 150px;
    font-weight: 600;
    color: #2d5a3d;
    font-size: 0.95rem;
}

.planting-chart .chart-bar-container {
    flex: 1;
    position: relative;
    height: 32px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.planting-chart .chart-bar {
    height: 100%;
    background: linear-gradient(90deg, #4a7c59 0%, #6fa87e 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    min-width: 30px;
}

.planting-chart .chart-value {
    position: absolute;
    right: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
}

/* Different colors for crop categories in chart */
.planting-chart .crop-fruit .chart-bar {
    background: linear-gradient(90deg, #c44569 0%, #e08095 100%);
}

.planting-chart .crop-herb .chart-bar {
    background: linear-gradient(90deg, #6c757d 0%, #8d959c 100%);
}

.planting-chart .crop-root .chart-bar {
    background: linear-gradient(90deg, #d97b29 0%, #e89a5e 100%);
}

/* Print styles for new formats */
@media print {
    .tasks-table .badge {
        border: 1px solid #333;
    }
    
    .tasks-simple-list {
        column-count: 1;
    }
    
    .planting-chart .chart-bar {
        background: #333 !important;
        border: 1px solid #000;
    }
    
    .planting-chart .chart-bar-container {
        border: 1px solid #333;
    }
}

/* Responsive for charts and tasks */
@media (max-width: 768px) {
    .tasks-simple-list {
        column-count: 1;
    }
    
    .planting-chart .chart-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .planting-chart .chart-label {
        flex: none;
    }
    
    .planting-chart .chart-bar-container {
        width: 100%;
    }
}
