/* Claude the Gardener - Static Site CSS */

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

:root {
    --color-primary: #2d6a4f;
    --color-secondary: #52b788;
    --color-accent: #74c69d;
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-text: #212529;
    --color-text-muted: #6c757d;
    --color-border: #dee2e6;
    --color-water: #4c9bf5;
    --color-light: #ffd60a;
    --color-photo: #9b5de5;
    --color-message: #f15bb5;
    --spacing: 1rem;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
}

/* Navigation */
.main-nav {
    background: var(--color-primary);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.plant-icon {
    font-size: 2rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.nav-link:hover {
    opacity: 0.8;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 200px);
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--color-text-muted);
    font-size: 1.1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--color-surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.panel {
    background: var(--color-surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.panel h2 {
    margin-bottom: 1rem;
    color: var(--color-primary);
}

.panel-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--color-secondary);
    text-decoration: none;
    font-weight: 500;
}

.panel-link:hover {
    text-decoration: underline;
}

/* Status Info */
.status-row {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
}

.status-row:last-child {
    border-bottom: none;
}

.status-label {
    font-weight: 500;
}

.trend {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.trend-increasing { background: #ffebee; color: #c62828; }
.trend-decreasing { background: #e3f2fd; color: #1565c0; }
.trend-stable { background: #e8f5e9; color: #2e7d32; }

/* Highlights */
.highlights-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.highlight-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-bg);
    border-radius: var(--radius);
}

.highlight-icon {
    font-size: 2rem;
}

.highlight-content {
    flex: 1;
}

.highlight-summary {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.highlight-reason {
    color: var(--color-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.highlight-time {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* Conversations */
.conversation-grid {
    display: grid;
    gap: 1rem;
}

.conversation-card {
    background: var(--color-surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-title a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
}

.card-title a:hover {
    text-decoration: underline;
}

.card-meta {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.card-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-text {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.card-prompt {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.highlight-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    background: var(--color-secondary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
}

/* Filter Controls */
.filter-controls {
    margin-bottom: 2rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: var(--color-bg);
}

.filter-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* Timeline */
.timeline {
    max-width: 800px;
    margin: 0 auto;
}

/* Timeline scroll position indicator */
.timeline-scroll-indicator {
    position: fixed;
    top: 80px;
    right: 2rem;
    background: var(--color-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-weight: 600;
    font-size: 0.95rem;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.timeline-scroll-indicator.visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-scroll-indicator .indicator-date {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.timeline-scroll-indicator .indicator-time {
    font-size: 0.85rem;
    opacity: 0.9;
}

.timeline-event {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.event-marker {
    font-size: 2rem;
    flex-shrink: 0;
}

.event-content {
    flex: 1;
}

.event-time {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.event-summary {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.event-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.tag {
    background: var(--color-bg);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.annotate-btn {
    background: none;
    border: 1px solid var(--color-border);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.annotate-btn:hover {
    background: var(--color-bg);
}

.event-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.5rem;
}

.conversation-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    transition: all 0.2s;
}

.conversation-link:hover {
    background: var(--color-primary);
    color: white;
}

/* Photos */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.photo-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.photo-card.missing-photo {
    border: 2px dashed #ff6b6b;
    background: #fff5f5;
}

.photo-wrapper {
    aspect-ratio: 4/3;
    overflow: hidden;
}

.photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.missing-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    padding: 1rem;
    text-align: center;
}

.missing-icon {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 0.5rem;
}

.missing-text {
    font-weight: 600;
    color: #c92a2a;
    margin-bottom: 0.25rem;
}

.missing-filename {
    font-size: 0.75rem;
    color: #666;
    font-family: monospace;
    word-break: break-all;
}

.photo-missing-badge {
    background: #ff6b6b;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.5rem;
    display: inline-block;
}

.photo-meta {
    padding: 1rem;
}

.photo-time {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* Charts */
.charts-container {
    display: grid;
    gap: 2rem;
}

.chart-panel {
    background: var(--color-surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chart-panel h3 {
    margin-bottom: 1rem;
    color: var(--color-primary);
}

/* Conversation Detail */
.conversation-meta {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--color-bg);
    border-radius: var(--radius);
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.meta-value {
    font-weight: 600;
}

.messages {
    max-width: 900px;
}

.message {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: var(--radius);
}

.message-user {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.message-assistant {
    background: #f1f8e9;
    border-left: 4px solid #8bc34a;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.message-role {
    font-weight: 600;
    text-transform: capitalize;
}

.message-time {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.message-text {
    white-space: pre-wrap;
    font-family: monospace;
    background: white;
    padding: 1rem;
    border-radius: 4px;
}

.tool-call {
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 4px;
}

.tool-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.tool-input {
    font-size: 0.9rem;
    overflow-x: auto;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    table-layout: fixed;
}

.data-table thead {
    background: var(--color-primary);
    color: white;
}

.data-table thead th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--color-bg);
}

/* Alternating row colors for better readability */
.data-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.data-table tbody tr:nth-child(even):hover {
    background: var(--color-bg);
}

/* Timestamp columns */
.data-table td.timestamp-cell {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Action Cards */
.tool-result-actions {
    margin: 1rem 0;
}

.action-count {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-primary);
}

.action-card {
    background: white;
    border-left: 3px solid var(--color-secondary);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border-radius: 4px;
}

.action-header {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
    font-family: 'Monaco', 'Courier New', monospace;
}

.action-type {
    margin-bottom: 0.5rem;
}

.action-detail {
    color: var(--color-text);
    padding: 0.25rem 0;
}

/* Status History Cards */
.tool-result-status-history {
    margin: 1rem 0;
}

.status-card {
    background: white;
    border-left: 3px solid var(--color-primary);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.status-header {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
    font-family: 'Monaco', 'Courier New', monospace;
}

.status-metrics {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.metric {
    font-size: 0.9rem;
}

.status-reasoning {
    margin: 0.75rem 0;
    padding: 0.75rem;
    background: var(--color-bg);
    border-radius: 4px;
    font-size: 0.9rem;
}

.status-next-actions {
    margin-top: 0.75rem;
}

.action-list {
    margin: 0.5rem 0 0 1.5rem;
    padding: 0;
}

.action-list li {
    margin: 0.25rem 0;
}

/* Plant state indicators */
.plant-state-healthy {
    color: #2e7d32;
    font-weight: 600;
}

.plant-state-stressed {
    color: #f57c00;
    font-weight: 600;
}

.plant-state-concerning {
    color: #d32f2f;
    font-weight: 600;
}

.plant-state-critical {
    color: #b71c1c;
    font-weight: 700;
}

.plant-state-unassessed,
.plant-state-unknown {
    color: var(--color-text-muted);
}

/* Empty result state */
.tool-result-empty {
    padding: 1rem;
    text-align: center;
    color: var(--color-text-muted);
    font-style: italic;
}

/* Notes box for fetch_notes results */
.tool-result-notes-box {
    padding: 1.5rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin: 1rem 0;
}

/* Counted collection results */
.tool-result-collection {
    margin: 1rem 0;
}

.collection-count {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-primary);
    font-size: 0.95rem;
}

/* Status indicators */
.status-ok {
    color: #2e7d32;
    font-weight: 600;
}

.status-error {
    color: #d32f2f;
    font-weight: 600;
}

/* Links in tool results */
.link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.link:hover {
    text-decoration: underline;
}

/* Footer */
.main-footer {
    background: var(--color-primary);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.footer-links a {
    color: white;
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .conversation-meta {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Highlight targeted tool call when arriving via anchor link */
.tool-call-block:target {
    animation: highlight-fade 2s ease-out;
    scroll-margin-top: 2rem;
}

@keyframes highlight-fade {
    0% {
        background: rgba(52, 152, 219, 0.2);
        box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.3);
    }
    100% {
        background: transparent;
        box-shadow: none;
    }
}

/* Date range filter - Grafana style with typed expressions */
.date-range-filter {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin: 1.5rem 0;
}

/* Time range text inputs */
.time-range-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    align-items: start;
}

.time-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.time-input-wrapper label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.time-expr-input {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: 'Monaco', 'Courier New', monospace;
    transition: all 0.2s;
}

.time-expr-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(16, 124, 74, 0.1);
}

.time-hint {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    font-style: italic;
}

.apply-btn {
    padding: 0.55rem 1.5rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
    align-self: flex-start;
    margin-top: 1.35rem;
    height: fit-content;
}

.apply-btn:hover {
    background: #0f6e42;
}

/* Quick preset buttons */
.quick-presets {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.preset-btn {
    padding: 0.4rem 0.9rem;
    background: #f5f5f5;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: #e8e8e8;
    border-color: var(--color-primary);
}

.preset-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

@media (max-width: 768px) {
    .time-range-inputs {
        grid-template-columns: 1fr;
    }

    .apply-btn {
        margin-top: 0;
        width: 100%;
    }
}

/* Sensor summary cards */
.sensor-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.sensor-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.sensor-card h3 {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sensor-current {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0.5rem 0;
}

.sensor-label {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin: 0.25rem 0;
}

.sensor-detail {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-top: 0.5rem;
}

.sensor-trend {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0.5rem 0;
}

.trend-stable {
    background: #e8f5e9;
    color: #2e7d32;
}

.trend-increasing {
    background: #fff3e0;
    color: #f57c00;
}

.trend-decreasing {
    background: #e3f2fd;
    color: #1976d2;
}

@media (max-width: 768px) {
    .sensor-summary {
        grid-template-columns: 1fr;
    }
}

/* Charts grid - compact 2-column layout */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.chart-panel {
    background: white;
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.chart-panel h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
}

.chart-panel canvas {
    max-height: 200px;
}

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