/**
 * Analytics Page Styles
 * Ask Junkie - AI Chatbot
 */

.gemini-analytics-wrap {
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Header */
.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.analytics-header h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 24px;
    color: #0f172a;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.refresh-btn {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.refresh-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

.date-filter {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
}

/* Stat Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    position: relative;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    border-color: #cbd5e1;
}

.stat-card .icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.stat-card:nth-child(1) .icon-wrap { color: #6366f1; background: #eef2ff; border-color: #e0e7ff; }
.stat-card:nth-child(2) .icon-wrap { color: #0ea5e9; background: #f0f9ff; border-color: #e0f2fe; }
.stat-card:nth-child(3) .icon-wrap { color: #10b981; background: #ecfdf5; border-color: #d1fae5; }
.stat-card:nth-child(4) .icon-wrap { color: #f59e0b; background: #fffbeb; border-color: #fef3c7; }

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.stat-card .label {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 12px;
}

.stat-card .trend {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

.stat-card .trend.up {
    color: #10b981;
}

.stat-card .trend.neutral {
    color: #94a3b8;
}

/* Sessions Panel */
.sessions-panel {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.sessions-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    background: #f8fafc;
}

.sessions-header h2 {
    margin: 0;
    font-size: 16px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sessions-header h2 .count {
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}

.search-box {
    position: relative;
}

.search-box input {
    padding: 8px 12px 8px 36px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    width: 240px;
    transition: all 0.2s;
    color: #334155;
}

.search-box input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-box::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

/* Session List */
.session-list {
    max-height: 600px;
    overflow-y: auto;
}

.session-item {
    padding: 16px 24px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.session-item:last-child {
    border-bottom: none;
}

.session-item:hover {
    background: #f8fafc;
}

.session-item.active {
    background: #f8fafc;
    border-left: 3px solid #6366f1;
}

.session-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.session-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #eef2ff;
    border: 1px solid #e0e7ff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4f46e5;
    font-size: 14px;
    font-weight: 600;
}

.session-details h4 {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.session-details p {
    margin: 0;
    font-size: 12px;
    color: #64748b;
}

.session-right {
    text-align: right;
    display: flex;
    align-items: center;
    gap: 16px;
}

.message-count {
    background: #f1f5f9;
    color: #475569;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #e2e8f0;
}

.session-arrow {
    color: #94a3b8;
    display: flex;
    transition: transform 0.2s;
}

.session-item.active .session-arrow {
    transform: rotate(90deg);
    color: #6366f1;
}

/* Messages Panel */
.messages-panel {
    display: none;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    padding: 24px;
    box-shadow: inset 0 2px 4px 0 rgba(0,0,0,0.02);
}

.messages-panel.show {
    display: block;
}

.message-bubble {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.message-bubble:last-child {
    margin-bottom: 0;
}

.message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 12px;
    color: #64748b;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.message-meta a {
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
}

.user-msg {
    color: #334155;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
}

.user-msg::before {
    content: 'User';
    display: block;
    width: 36px;
    height: 36px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-msg {
    color: #0f172a;
    font-size: 14px;
    line-height: 1.6;
    display: flex;
    gap: 12px;
}

.ai-msg::before {
    content: 'AI';
    display: block;
    width: 36px;
    height: 36px;
    background: #eef2ff;
    border: 1px solid #e0e7ff;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #6366f1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 64px 20px;
}

.empty-state .icon {
    margin-bottom: 16px;
}

.empty-state h3 {
    color: #0f172a;
    margin-bottom: 8px;
    font-weight: 600;
}

.empty-state p {
    color: #64748b;
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto;
}