/**
 * Authyo ChatLead - Analytics & Usage Dashboard Styles
 *
 * Covers both the Analytics page and the Usage & Costs page.
 *
 * @since   1.2.0
 * @package Authyo_ChatLead
 */

/* ==========================================================================
   Shared layout helpers
   ========================================================================== */

.authyo-analytics-wrap,
.authyo-usage-wrap {
    max-width: 1280px;
}

.authyo-analytics-section,
.authyo-usage-section {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px 24px;
    margin-top: 20px;
}

.authyo-analytics-section h2,
.authyo-usage-section h2 {
    margin-top: 0;
    font-size: 1rem;
    color: #1d2327;
}

/* ==========================================================================
   Date range pill buttons  (Analytics page)
   ========================================================================== */

.authyo-analytics-date-range {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0 0;
    flex-wrap: wrap;
}

.authyo-analytics-date-label {
    font-size: 13px;
    font-weight: 500;
    color: #50575e;
    margin-right: 4px;
}

.authyo-range-btn {
    display: inline-flex;
    align-items: center;
    padding: 5px 16px;
    border-radius: 20px;
    border: 1px solid #c3c4c7;
    background: #f6f7f7;
    color: #2c3338;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1.4;
}

.authyo-range-btn:hover {
    background: #f0f0f1;
    border-color: #8c8f94;
}

.authyo-range-btn.active {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
    font-weight: 600;
}

/* ==========================================================================
   Analytics overview cards  (4-column grid)
   ========================================================================== */

.authyo-analytics-cards {
    display: grid;
    grid-template-columns: repeat( 5, 1fr );
    gap: 16px;
    margin-top: 20px;
}

.authyo-analytics-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 18px 16px;
    text-align: center;
    transition: box-shadow 0.15s;
}

.authyo-analytics-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.authyo-analytics-card-loading .authyo-analytics-card-value {
    color: #a0a5aa;
}

.authyo-analytics-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2271b1;
    line-height: 1.2;
    margin-bottom: 6px;
}

.authyo-analytics-card-label {
    font-size: 12px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 500;
}

/* ==========================================================================
   Two-column layout inside section (sources + tokens side-by-side)
   ========================================================================== */

.authyo-analytics-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.authyo-analytics-col h2 {
    margin-top: 0;
    font-size: 1rem;
    color: #1d2327;
}

/* ==========================================================================
   Chart containers
   ========================================================================== */

.authyo-analytics-chart-container {
    position: relative;
    width: 100%;
    min-height: 200px;
}

.authyo-analytics-chart-donut {
    max-width: 320px;
    margin: 0 auto;
}

/* ==========================================================================
   Top Gaps table
   ========================================================================== */

.authyo-analytics-gaps-table {
    margin-top: 12px;
}

/* ==========================================================================
   Loading state
   ========================================================================== */

.authyo-analytics-loading {
    color: #646970;
    font-style: italic;
}

/* ==========================================================================
   Usage & Costs stat cards  (6-column grid)
   ========================================================================== */

.authyo-usage-cards {
    display: grid;
    grid-template-columns: repeat( 6, 1fr );
    gap: 16px;
    margin-top: 20px;
}

.authyo-usage-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 16px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: box-shadow 0.15s;
}

.authyo-usage-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.authyo-usage-card-icon {
    font-size: 1.6rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.authyo-card-blue   { background: rgba(34, 113, 177, 0.12); }
.authyo-card-green  { background: rgba(0, 163, 42, 0.12);   color: #00a32a; font-size: 1.2rem; font-weight: 700; }
.authyo-card-purple { background: rgba(140, 0, 219, 0.10);  }
.authyo-card-orange { background: rgba(219, 100, 23, 0.12); color: #d63638; font-size: 1.1rem; font-weight: 700; }
.authyo-card-teal   { background: rgba(0, 160, 176, 0.12);  }
.authyo-card-yellow { background: rgba(219, 166, 23, 0.15); }

.authyo-usage-card-body {
    min-width: 0;
}

.authyo-usage-card-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1d2327;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.authyo-usage-card-label {
    font-size: 11px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 500;
    margin-top: 4px;
}

.authyo-usage-chart-container {
    position: relative;
    width: 100%;
}

.authyo-usage-table {
    margin-top: 12px;
}

.authyo-usage-note {
    background: #f6f7f7;
    border-color: #dcdcde;
}

.authyo-usage-note .description {
    margin: 0;
    font-size: 13px;
    color: #646970;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media ( max-width: 1100px ) {
    .authyo-usage-cards {
        grid-template-columns: repeat( 3, 1fr );
    }
    .authyo-analytics-cards {
        grid-template-columns: repeat( 3, 1fr );
    }
    .authyo-analytics-two-col {
        grid-template-columns: 1fr;
    }
}

@media ( max-width: 782px ) {
    .authyo-analytics-cards,
    .authyo-usage-cards {
        grid-template-columns: repeat( 2, 1fr );
    }
    .authyo-analytics-date-range {
        flex-wrap: wrap;
    }
}

@media ( max-width: 480px ) {
    .authyo-analytics-cards,
    .authyo-usage-cards {
        grid-template-columns: 1fr;
    }
    .authyo-analytics-card-value {
        font-size: 1.4rem;
    }
}
