/* dashboard.css - Dashboard-specific styles */

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

.stat-card {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.stat-card-sent {
    border-top: 3px solid var(--primary-green);
}

.stat-card-delivered {
    border-top: 3px solid var(--primary-gold);
}

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

.stat-info h3 {
    font-size: 1.8rem;
    color: var(--primary-green);
    margin-bottom: 5px;
}

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

.stat-icon {
    font-size: 2rem;
    color: var(--primary-gold);
    opacity: 0.7;
}

/* =============================================
   Charts
   ============================================= */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-container {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.chart-header {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-green);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-gold);
}

.chart-body {
    display: flex;
    gap: 15px;
    align-items: center;
}

.custom-legend {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* =============================================
   Conversations List / Table
   ============================================= */
.conversations-list {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.section-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-green);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-gold);
}

.search-container {
    margin-bottom: 15px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    gap: 8px;
}

.search-box input {
    border: none;
    outline: none;
    background: transparent;
    flex: 1;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-main);
}

.search-icon {
    color: var(--text-muted);
}

.btn-clear-search {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px;
}

.table-container {
    overflow-x: auto;
}

#convTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

#convTable thead {
    background-color: var(--primary-green);
    color: white;
}

#convTable th {
    padding: 12px 10px;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

#convTable td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

#convTable tbody tr:hover {
    background-color: var(--hover-color);
    cursor: pointer;
}

.sortable .sort-icon {
    font-size: 0.7rem;
    margin-left: 5px;
    opacity: 0.5;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Filter Note */
.filter-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 10px 0;
    opacity: 0.7;
}

/* =============================================
   Detail Panel
   ============================================= */
.details-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2000;
}

.details-panel {
    position: fixed;
    top: 0;
    right: -500px;
    width: 480px;
    height: 100%;
    background: var(--bg-card);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 2001;
    overflow-y: auto;
    transition: right 0.3s ease;
    padding: 20px;
}

.details-panel.open {
    right: 0;
}

.details-overlay.open {
    display: block;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-gold);
}

.btn-close-details {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-muted);
    padding: 5px;
}

.btn-close-details:hover {
    color: var(--primary-green);
}

/* Detail Tabs */
.detail-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.detail-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.detail-tab.active {
    color: var(--primary-green);
    border-bottom-color: var(--primary-gold);
    font-weight: 600;
}

.detail-tab:hover {
    color: var(--primary-green);
}

/* Chat Messages */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-bubble.agent {
    background: linear-gradient(135deg, var(--primary-green), #006b54);
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-bubble.user {
    background: var(--hover-color);
    color: var(--text-main);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Summary Section */
.summary-section {
    padding: 10px 0;
}

.summary-box {
    background: var(--hover-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
}

.summary-box h4 {
    color: var(--primary-green);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.summary-box p {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-main);
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-row {
        grid-template-columns: 1fr;
    }
    
    .details-panel {
        width: 100%;
        right: -100%;
    }
}
