/* =================================================================
   Brevo Analytics - Admin Interface Styles
   ================================================================= */

/* ============ Dashboard Styles ============ */
.dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    margin: -20px -20px 20px -20px;
    border-radius: 0;
}

.dashboard-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
    font-weight: 600;
}

.dashboard-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 1rem;
}

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

.stat-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

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

.stat-card h3 {
    margin: 0 0 0.5rem 0;
    color: #666;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #333;
    margin: 0.5rem 0;
    line-height: 1;
}

.stat-card .change {
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

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

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

.stat-card .sparkline {
    margin-top: 1rem;
    height: 40px;
}

/* Sparkline styling */
.sparkline svg {
    width: 100%;
    height: 100%;
}

.sparkline path {
    fill: none;
    stroke: #667eea;
    stroke-width: 2;
}

.dashboard-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.dashboard-actions .button {
    padding: 0.75rem 1.5rem;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.dashboard-actions .button:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.dashboard-actions .button.secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.dashboard-actions .button.secondary:hover {
    background: #f0f4ff;
}

/* ============ Email List Styles ============ */
.email-list-filters {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid #e0e0e0;
}

.email-list-filters form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

.email-list-filters .form-group {
    display: flex;
    flex-direction: column;
}

.email-list-filters label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #333;
    font-size: 0.875rem;
}

.email-list-filters input[type="text"],
.email-list-filters input[type="date"],
.email-list-filters select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.875rem;
}

.email-list-filters .filter-actions {
    display: flex;
    gap: 0.5rem;
}

.email-list-filters button {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.email-list-filters button[type="submit"] {
    background: #667eea;
    color: white;
}

.email-list-filters button[type="submit"]:hover {
    background: #5568d3;
}

.email-list-filters .clear-filters {
    background: #f3f4f6;
    color: #333;
}

.email-list-filters .clear-filters:hover {
    background: #e5e7eb;
}

.search-box {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

.search-box::before {
    content: "🔍";
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.delivered {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.opened {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.clicked {
    background: #e0e7ff;
    color: #4338ca;
}

.status-badge.bounced {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.complained {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.unsubscribed {
    background: #f3f4f6;
    color: #374151;
}

/* ============ Email Detail Styles ============ */
.email-detail-header {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid #e0e0e0;
}

.email-detail-header h2 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.5rem;
}

.email-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.email-meta-item {
    display: flex;
    flex-direction: column;
}

.email-meta-item label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.email-meta-item .value {
    font-size: 1rem;
    color: #333;
    font-weight: 500;
}

.event-timeline {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.event-timeline h3 {
    margin: 0 0 1.5rem 0;
    color: #333;
    font-size: 1.25rem;
}

.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e0e0e0;
}

.timeline-event {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-event:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -1.5rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 2px;
}

.timeline-marker.delivered {
    background: #10b981;
    box-shadow: 0 0 0 2px #10b981;
}

.timeline-marker.opened {
    background: #3b82f6;
    box-shadow: 0 0 0 2px #3b82f6;
}

.timeline-marker.clicked {
    background: #8b5cf6;
    box-shadow: 0 0 0 2px #8b5cf6;
}

.timeline-marker.bounced {
    background: #ef4444;
    box-shadow: 0 0 0 2px #ef4444;
}

.timeline-marker.complained {
    background: #f59e0b;
    box-shadow: 0 0 0 2px #f59e0b;
}

.timeline-marker.unsubscribed {
    background: #6b7280;
    box-shadow: 0 0 0 2px #6b7280;
}

.timeline-content {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 6px;
    border-left: 3px solid #e0e0e0;
}

.timeline-event.delivered .timeline-content {
    border-left-color: #10b981;
}

.timeline-event.opened .timeline-content {
    border-left-color: #3b82f6;
}

.timeline-event.clicked .timeline-content {
    border-left-color: #8b5cf6;
}

.timeline-event.bounced .timeline-content {
    border-left-color: #ef4444;
}

.timeline-event.complained .timeline-content {
    border-left-color: #f59e0b;
}

.timeline-event.unsubscribed .timeline-content {
    border-left-color: #6b7280;
}

.timeline-content strong {
    color: #333;
    font-weight: 600;
}

.timeline-content .timestamp {
    display: block;
    color: #666;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Bounce Details */
.bounce-details {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 0.5rem;
}

.bounce-details strong {
    color: #991b1b;
}

.bounce-details p {
    margin: 0.5rem 0 0 0;
    color: #7f1d1d;
}

/* ============ Error States ============ */
.no-data-message {
    text-align: center;
    padding: 3rem 2rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.no-data-message .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.no-data-message h3 {
    color: #333;
    margin-bottom: 0.5rem;
}

.no-data-message p {
    color: #666;
    margin-bottom: 1.5rem;
}

.no-events-message {
    text-align: center;
    padding: 2rem;
    color: #666;
    background: #f9fafb;
    border-radius: 6px;
    margin-top: 1rem;
}

.error-page {
    max-width: 600px;
    margin: 2rem auto;
    text-align: center;
    padding: 2rem;
}

.error-page h1 {
    font-size: 4rem;
    color: #ef4444;
    margin-bottom: 1rem;
}

.error-page h2 {
    color: #333;
    margin-bottom: 1rem;
}

.error-page p {
    color: #666;
    margin-bottom: 2rem;
}

/* ============ DataTables Overrides ============ */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.25rem 0.75rem;
    margin: 0 0.125rem;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: white;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #667eea;
    color: white !important;
    border-color: #667eea;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f3f4f6;
    border-color: #ddd;
}

.dataTables_wrapper .dataTables_info {
    color: #666;
    font-size: 0.875rem;
}

/* ============ Responsive Adjustments ============ */
@media (max-width: 768px) {
    .dashboard-header {
        padding: 1.5rem;
        margin: -10px -10px 20px -10px;
    }

    .dashboard-header h1 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card .value {
        font-size: 2rem;
    }

    .email-list-filters form {
        grid-template-columns: 1fr;
    }

    .email-meta {
        grid-template-columns: 1fr;
    }

    .dashboard-actions {
        flex-direction: column;
    }

    .dashboard-actions .button {
        width: 100%;
        text-align: center;
    }
}
