/* analytics-style.css — Styl panelu statystyk */

.mc-analytics-view { padding: 0 0 40px; }
.mc-analytics-view h3 { margin: 30px 0 12px; font-size: 1.3em; color: #333; border-bottom: 2px solid #4e79a7; padding-bottom: 6px; }
.mc-analytics-view h4 { margin: 0 0 10px; font-size: 1em; color: #555; }

/* Filters */
.analytics-filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 16px; background: #f8f9fa; border-radius: 8px; margin-bottom: 20px; }
.analytics-filters label { font-size: 0.85em; color: #555; font-weight: 600; }
.analytics-filters input[type="date"], .analytics-filters select { padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 0.9em; }
.analytics-filters button { padding: 8px 20px; background: #4e79a7; color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: 600; transition: background 0.2s; }
.analytics-filters button:hover { background: #3a5e8a; }
.analytics-quick-ranges { display: flex; gap: 6px; margin-left: auto; }
.analytics-quick-ranges button { padding: 4px 10px; font-size: 0.8em; background: #e9ecef; color: #555; border: 1px solid #ccc; border-radius: 3px; cursor: pointer; }
.analytics-quick-ranges button:hover { background: #dee2e6; }

/* KPI Cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.kpi-card { background: white; border-radius: 8px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); text-align: center; transition: transform 0.15s, box-shadow 0.15s; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.kpi-icon { font-size: 1.6em; margin-bottom: 4px; }
.kpi-value { font-size: 1.5em; font-weight: 700; color: #2c3e50; margin-bottom: 2px; }
.kpi-label { font-size: 0.8em; color: #7f8c8d; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-change { display: block; font-size: 0.75em; margin-top: 4px; font-weight: 600; }
.kpi-change.positive { color: #27ae60; }
.kpi-change.negative { color: #e74c3c; }

/* Summary row */
.stats-summary-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.summary-pill { background: #e8f4f8; padding: 8px 16px; border-radius: 20px; font-size: 0.9em; color: #333; }
.summary-pill strong { color: #4e79a7; }

/* Charts */
.chart-row { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.chart-container { background: white; border-radius: 8px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.chart-container.half { flex: 1; min-width: 340px; }
.chart-container.full { width: 100%; }
.chart-container canvas { max-height: 350px; }

/* Tables */
.stats-table-wrap { max-height: 400px; overflow-y: auto; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 0.85em; }
.stats-table thead { position: sticky; top: 0; background: #f8f9fa; z-index: 1; }
.stats-table th { padding: 8px 10px; text-align: left; font-weight: 600; color: #555; border-bottom: 2px solid #dee2e6; white-space: nowrap; }
.stats-table td { padding: 7px 10px; border-bottom: 1px solid #eee; vertical-align: middle; }
.stats-table tbody tr:hover { background: #f5f8ff; }

/* Badges */
.stat-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.85em; font-weight: 600; }
.stat-badge.good { background: #d4edda; color: #155724; }
.stat-badge.warn { background: #fff3cd; color: #856404; }
.stat-badge.bad { background: #f8d7da; color: #721c24; }

/* Sections */
.analytics-section { margin-bottom: 8px; }
.analytics-section-content { display: none; }
.analytics-section-content.is-open { display: block; }
.analytics-section-header { cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 10px 0; user-select: none; }
.analytics-section-header:hover h3 { color: #4e79a7; }
.section-toggle { font-size: 0.8em; transition: transform 0.2s; }
.section-toggle.open { transform: rotate(90deg); }

/* Loading */
.analytics-loading { text-align: center; padding: 60px 20px; font-size: 1.1em; color: #888; }
.analytics-loading .spinner { display: inline-block; width: 30px; height: 30px; border: 3px solid #e9ecef; border-top-color: #4e79a7; border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 10px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* AI chat */
#mc-vue-calendar-app .analytics-ai-chat {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin: 0 0 24px;
    padding: 16px;
}
#mc-vue-calendar-app .analytics-ai-chat-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 12px;
}
#mc-vue-calendar-app .analytics-ai-kicker {
    display: inline-block;
    color: #4e79a7;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 4px;
}
#mc-vue-calendar-app .analytics-ai-chat h3 {
    border: 0;
    margin: 0 0 4px;
    padding: 0;
    color: #1f2937;
}
#mc-vue-calendar-app .analytics-ai-chat p {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.45;
}
#mc-vue-calendar-app .analytics-ai-clear {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
#mc-vue-calendar-app .analytics-ai-clear:disabled {
    opacity: .55;
    cursor: not-allowed;
}
#mc-vue-calendar-app .analytics-ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
#mc-vue-calendar-app .analytics-ai-suggestions button {
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
}
#mc-vue-calendar-app .analytics-ai-messages {
    display: grid;
    gap: 10px;
    max-height: 360px;
    overflow-y: auto;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 12px;
}
#mc-vue-calendar-app .analytics-ai-message {
    display: grid;
    gap: 4px;
    max-width: min(760px, 92%);
}
#mc-vue-calendar-app .analytics-ai-message.is-user {
    justify-self: end;
}
#mc-vue-calendar-app .analytics-ai-role {
    color: #6b7280;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}
#mc-vue-calendar-app .analytics-ai-message.is-user .analytics-ai-role {
    text-align: right;
}
#mc-vue-calendar-app .analytics-ai-bubble {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.55;
    padding: 10px 12px;
    white-space: pre-wrap;
}
#mc-vue-calendar-app .analytics-ai-message.is-user .analytics-ai-bubble {
    background: #4e79a7;
    border-color: #4e79a7;
    color: #fff;
}
#mc-vue-calendar-app .analytics-ai-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}
#mc-vue-calendar-app .analytics-ai-form textarea {
    width: 100%;
    min-height: 78px;
    resize: vertical;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
}
#mc-vue-calendar-app .analytics-ai-form textarea:focus {
    outline: none;
    border-color: #4e79a7;
    box-shadow: 0 0 0 3px rgba(78,121,167,.16);
}
#mc-vue-calendar-app .analytics-ai-form button {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
}
#mc-vue-calendar-app .analytics-ai-form button:disabled {
    opacity: .65;
    cursor: not-allowed;
}
#mc-vue-calendar-app .analytics-ai-error {
    margin-top: 10px;
    padding: 9px 11px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-container.half { min-width: 100%; }
    .analytics-quick-ranges { margin-left: 0; width: 100%; }
    #mc-vue-calendar-app .analytics-ai-chat-head,
    #mc-vue-calendar-app .analytics-ai-form {
        grid-template-columns: 1fr;
        display: grid;
    }
    #mc-vue-calendar-app .analytics-ai-clear,
    #mc-vue-calendar-app .analytics-ai-form button {
        width: 100%;
    }
    #mc-vue-calendar-app .analytics-ai-message {
        max-width: 100%;
    }
}
