/**
 * AI Bot Admin Dashboard Styles
 * Bailey Engineering CMS
 */

/* Page Layout */
.page-header {
    margin-bottom: 2rem;
}

.page-header h2 {
    margin: 0 0 0.5rem 0;
    color: #333;
}

.page-header p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Filter Card */
.filter-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-group label {
    font-size: 14px;
    color: #666;
    white-space: nowrap;
    margin: 0;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-row #refreshBtn {
    margin-left: 0;
    flex-shrink: 0;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-select,
.filter-input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    height: 38px;
    box-sizing: border-box;
}

.filter-select {
    min-width: 150px;
    height: 38px;
}

.filter-row .btn {
    height: 38px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Loading & Error States */
.loading-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2E256D;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-state p {
    color: #f44336;
    margin-bottom: 1rem;
}

/* Stats Section */
.stats-section {
    margin-bottom: 2rem;
}

.stats-section h3 {
    margin: 0 0 1rem 0;
    color: #333;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 1rem;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon-blue {
    background: #dbeafe;
}

.stat-icon-blue svg {
    color: #2563eb;
}

.stat-icon-purple {
    background: #e9d5ff;
}

.stat-icon-purple svg {
    color: #7c3aed;
}

.stat-icon-green {
    background: #d1fae5;
}

.stat-icon-green svg {
    color: #059669;
}

.stat-icon-orange {
    background: #fed7aa;
}

.stat-icon-orange svg {
    color: #ea580c;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: #2E256D;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.stat-change {
    font-size: 0.75rem;
    color: #059669;
    font-weight: 500;
}

.stat-change.negative {
    color: #dc2626;
}

.stat-change.positive {
    color: #059669;
}

/* Chart Section */
.chart-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h3 {
    margin: 0;
    color: #333;
}

.chart-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.chart-container {
    position: relative;
    height: 300px;
}

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

/* Data Section */
.data-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.section-actions {
    display: flex;
    gap: 0.5rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #e0e0e0;
    color: #666;
}

.badge.success {
    background: #e8f5e9;
    color: #4caf50;
}

.badge.danger {
    background: #ffebee;
    color: #f44336;
}

.badge.warning {
    background: #fff3e0;
    color: #ff9800;
}

/* Data List */
.data-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 500px;
    overflow-y: auto;
}

.data-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: background 0.2s;
}

.data-item:hover {
    background: #f9f9f9;
}

.data-item.alert {
    border-left: 3px solid #ff9800;
    background: #fff3e0;
}

.data-item.alert:hover {
    background: #ffe0b2;
}

.item-rank {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2E256D;
    min-width: 30px;
    text-align: center;
}

.item-content {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.item-subtitle {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.item-feedback {
    font-size: 0.875rem;
    color: #ff9800;
    font-style: italic;
    margin-bottom: 0.25rem;
}

.item-meta {
    font-size: 0.75rem;
    color: #999;
    display: flex;
    gap: 0.75rem;
}

.meta-badge {
    padding: 0.125rem 0.5rem;
    border-radius: 8px;
    background: #e0e0e0;
    color: #666;
}

.meta-badge.success {
    background: #e8f5e9;
    color: #4caf50;
}

.meta-badge.warning {
    background: #fff3e0;
    color: #ff9800;
}

/* Table Section */
.table-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-container {
    overflow-x: auto;
    margin: 1rem 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

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

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.data-table th {
    font-weight: 600;
    color: #666;
    font-size: 0.875rem;
    white-space: nowrap;
}

.data-table td {
    color: #333;
    font-size: 0.875rem;
}

.data-table td.truncate {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

/* Metrics Section */
.metrics-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.metrics-section h3 {
    margin: 0 0 1rem 0;
    color: #333;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.metric-card {
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.metric-label {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2E256D;
    margin-bottom: 0.75rem;
}

.metric-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.metric-bar-fill {
    height: 100%;
    background: #2E256D;
    transition: width 0.3s ease;
}

.metric-bar-fill.success {
    background: #4caf50;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-content.modal-large {
    max-width: 800px;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Conversation Detail */
.conversation-detail {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detail-section h4 {
    margin: 0 0 0.75rem 0;
    color: #666;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-content {
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    white-space: pre-wrap;
    word-break: break-word;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-item label {
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item span {
    font-size: 1rem;
    color: #333;
    font-weight: 500;
}

.feedback-summary {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.feedback-comment {
    font-style: italic;
    color: #666;
    margin: 0;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: #999;
}

.loading-placeholder {
    text-align: center;
    padding: 1rem;
    color: #999;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #2E256D;
    color: white;
}

.btn-primary:hover {
    background: #1f1849;
}

.btn-secondary {
    background: white;
    color: #666;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .two-column-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .data-table {
        font-size: 0.75rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
}

