/* Executive Dashboard Styles */

.btn-toggle-queries {
    background: #E8F5E3;
    color: #1B7A12;
    border: 1px solid #C5E8BD;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 6px rgba(15, 23, 42, 0.08);
}

.btn-toggle-queries:hover {
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
    background: #C5E8BD;
}

.btn-toggle-queries:active {
    transform: scale(0.98);
}

/* Query Display */
.query-info {
    margin-top: 1rem;
    padding: 1rem;
    background: #f7fafc;
    border-left: 3px solid #0077C5;
    border-radius: 4px;
    display: none;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.query-info.visible {
    display: block;
}

.query-info h4 {
    font-size: 0.75rem;
    color: #4a5568;
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.query-info .query-description {
    font-size: 0.8rem;
    color: #2d3748;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: #edf2f7;
    border-radius: 4px;
}

.query-info pre {
    margin: 0;
    padding: 1rem;
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.75rem;
    line-height: 1.5;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    max-height: 400px;
    overflow-y: auto;
}

.query-info code {
    font-family: inherit;
    white-space: pre;
    display: block;
}

.copy-query-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: #4a5568;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1;
}

.copy-query-btn:hover {
    background: #2d3748;
}

.copy-query-btn:active {
    transform: scale(0.95);
}

.query-section {
    margin-bottom: 1rem;
}

.query-section:last-child {
    margin-bottom: 0;
}

.kpi-methodology {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.9rem 1rem;
    margin: 1rem 0 0.5rem;
}

.kpi-methodology h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #1a202c;
    margin: 0 0 0.25rem;
}

.kpi-methodology-intro {
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
    color: #64748b;
}

.kpi-methodology-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 0.6rem;
}

.kpi-methodology details {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
}

.kpi-methodology summary {
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
}

.kpi-methodology summary:target {
    background: #e0f2fe;
    outline: 1px solid #7dd3fc;
    border-radius: 4px;
}

.kpi-methodology details p {
    margin: 0.45rem 0 0;
    font-size: 0.8rem;
    color: #475569;
    line-height: 1.45;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(320px, 1fr));
    gap: 1rem;
    padding: 1.25rem 0;
}

.dashboard-column {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    min-height: 400px;
}

.column-header {
    margin-bottom: 0.9rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid #e2e8f0;
}

.column-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.2rem;
    color: #1a202c;
}

.column-header p {
    margin: 0;
    font-size: 0.82rem;
    color: #64748b;
}

/* Query ID Badge Styles */
.query-badge {
    display: inline-block;
    background: linear-gradient(135deg, #0077C5 0%, #005A9E 100%);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    margin-left: 0.5rem;
    font-family: 'Consolas', 'Monaco', monospace;
    letter-spacing: 0.02em;
    vertical-align: middle;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.query-badge:hover {
    opacity: 1;
}

.kpi-label .query-badge,
.chart-container h3 .query-badge {
    font-size: 0.6rem;
    padding: 0.12rem 0.35rem;
    margin-left: 0.4rem;
}

.section-description .query-badge {
    margin-left: 0.3rem;
    font-size: 0.65rem;
}

.column-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.kpi-previous-period {
    margin-top: 0.25rem;
    font-size: 0.78rem;
    color: #64748b;
}

.kpi-previous-period-delta {
    font-weight: 600;
}

.kpi-previous-period-delta.delta-positive {
    color: #15803d;
}

.kpi-previous-period-delta.delta-negative {
    color: #b91c1c;
}

.kpi-previous-period-delta.delta-neutral {
    color: #64748b;
}

/* Metric Cards */
.metric-card {
    margin-bottom: 0;
    padding: 0.85rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.metric-card:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.metric-card h3 {
    font-size: 0.78rem;
    color: #4a5568;
    margin-bottom: 0.4rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
}

.kpi-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted #94a3b8;
}

.kpi-link:hover {
    color: #1e293b;
    border-bottom-color: #64748b;
}

.metric-card .value {
    font-size: 1.7rem;
    font-weight: 700;
    color: #393A3D;
    margin-bottom: 0.25rem;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.metric-card .subtitle {
    font-size: 0.8rem;
    color: #718096;
}

.metric-card .change {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

.metric-card .change.positive {
    color: #10b981;
}

.metric-card .change.negative {
    color: #ef4444;
}

/* Chart Containers */
.chart-container {
    margin-bottom: 1.5rem;
    position: relative;
}

.chart-container canvas {
    max-height: 180px;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead {
    background: #f7fafc;
}

.data-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
}

.data-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.data-table td:nth-child(n+2) {
    font-variant-numeric: tabular-nums;
}

.data-table tbody tr:hover {
    background: #f7fafc;
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 2rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: #0077C5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state p {
    margin-top: 1rem;
    color: #718096;
    font-size: 0.875rem;
}

#error-state,
#dashboard-grid {
    display: none;
}

/* No Data State */
.no-data {
    color: #718096;
    font-size: 0.875rem;
    font-style: italic;
    padding: 1rem;
    text-align: center;
}

/* Error State */
.error-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 2rem;
}

.error-message {
    text-align: center;
    max-width: 500px;
}

.error-message h3 {
    color: #ef4444;
    margin-bottom: 1rem;
}

.error-message p {
    color: #718096;
    margin-bottom: 1.5rem;
}

.btn {
    background: #2CA01C;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease;
}

.btn:hover {
    background: #1B7A12;
}

/* Responsive Design */
@media (max-width: 1800px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, minmax(280px, 1fr));
    }
}

@media (max-width: 1400px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(280px, 1fr));
    }
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .kpi-methodology-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-column {
        padding: 1rem;
    }
    
    .metric-card .value {
        font-size: 1.5rem;
    }
}

/* Header Adjustments */
body.dashboard-page header {
    background: #ffffff;
    color: #0f172a;
    padding: 1.5rem 0;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

body.dashboard-page header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #0f172a;
}

.dashboard-subtitle {
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
    color: #64748b;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.breadcrumb {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    color: #64748b;
}

.breadcrumb a {
    color: #334155;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.breadcrumb a:hover {
    opacity: 1;
    color: #0f172a;
}

.user-info {
    color: #475569;
    font-size: 0.875rem;
}

/* Footer */
footer {
    background: #f7fafc;
    padding: 1.5rem 0;
    margin-top: 3rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    font-size: 0.875rem;
    color: #718096;
}

footer a {
    color: #0077C5;
    text-decoration: none;
}

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

/* Utility Classes */
.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* App MCP Dashboard Specific Styles */

/* KPI Section */
.kpi-section {
    margin-bottom: 3rem;
}

.section-description {
    color: #64748b;
    font-size: 1rem;
    line-height: 1.6;
    margin: 0.5rem 0 1.5rem 0;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.kpi-grid.kpi-grid-paired {
    grid-template-columns: repeat(4, minmax(250px, 1fr));
}

.kpi-card {
    background: white;
    border: 1px solid #D4D7DC;
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.kpi-card:hover {
    transform: translateY(-1px);
    border-color: #0077C5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.kpi-card.kpi-primary {
    /* clean card look - no colored top border */
}

.kpi-card.kpi-info {
    /* clean card look - no colored top border */
}

.kpi-card.kpi-success {
    /* clean card look - no colored top border */
}

.kpi-card.kpi-warning {
    /* clean card look - no colored top border */
}

.kpi-icon {
    font-size: 2rem;
    line-height: 1;
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.kpi-value.kpi-good {
    color: #10b981;
}

.kpi-value.kpi-warning {
    color: #f59e0b;
}

.kpi-value.kpi-bad {
    color: #ef4444;
}

.kpi-description {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.5;
}

/* Metrics Section */
.metrics-section {
    margin-bottom: 3rem;
}

.metrics-section h2 {
    margin-bottom: 0.5rem;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-top: 1.5rem;
    max-width: 100%;
}

.chart-container {
    background: white;
    border: 1px solid #D4D7DC;
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.chart-container h3 {
    font-size: 1.125rem;
    color: #1e293b;
    margin-bottom: 1rem;
    font-weight: 600;
}

.chart-container canvas {
    max-height: 300px;
}

.chart-note {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-left: 3px solid #0077C5;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.5;
}

.chart-note strong {
    color: #1e293b;
}

/* Success Criteria Section */
.success-criteria-section {
    margin-bottom: 3rem;
}

.criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.criteria-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #D4D7DC;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.criteria-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
}

.criteria-icon {
    font-size: 1.5rem;
}

.criteria-header h3 {
    font-size: 1.125rem;
    color: #1e293b;
    margin: 0;
    font-weight: 600;
}

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

.criteria-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.criteria-list li:last-child {
    border-bottom: none;
}

.criteria-list strong {
    color: #1e293b;
}

.criteria-status {
    flex-shrink: 0;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

.criteria-status.criteria-pass {
    background: #d1fae5;
    color: #065f46;
}

.criteria-status.criteria-fail {
    background: #fee2e2;
    color: #991b1b;
}

.criteria-status.criteria-na {
    background: #f1f5f9;
    color: #64748b;
}

/* Recommended Actions Section */
.actions-section {
    margin-bottom: 3rem;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.action-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #D4D7DC;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.action-card.action-critical {
    border-left: 4px solid #ef4444;
}

.action-card.action-warning {
    border-left: 4px solid #f59e0b;
}

.action-card.action-info {
    border-left: 4px solid #0077C5;
}

.action-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
}

.action-icon {
    font-size: 1.5rem;
}

.action-header h3 {
    font-size: 1.125rem;
    margin: 0;
    font-weight: 600;
}

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

.action-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #475569;
}

.action-list li:last-child {
    border-bottom: none;
}

/* Timeframe Selector */
.timeframe-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timeframe-selector label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.timeframe-selector select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.875rem;
    background: #ffffff;
    color: #1e293b;
    cursor: pointer;
}

.timeframe-selector select:focus {
    outline: none;
    border-color: #0077C5;
    box-shadow: 0 0 0 3px rgba(0, 119, 197, 0.1);
}

/* Responsive Adjustments */
@media (max-width: 1200px) {
    .kpi-grid.kpi-grid-paired {
        grid-template-columns: repeat(2, minmax(250px, 1fr));
    }

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

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

    .kpi-grid.kpi-grid-paired {
        grid-template-columns: 1fr;
    }
    
    .chart-grid {
        grid-template-columns: 1fr;
    }
    
    .criteria-grid,
    .actions-grid {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}
