/* ============================================
   InvestWell Email Review Dashboard - Styles
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --secondary: #6b7280;
    --amazon: #1e40af;
    --other: #059669;
    --bg: #f9fafb;
    --surface: #ffffff;
    --text: #111827;
    --text-light: #6b7280;
    --border: #e5e7eb;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 28px;
    color: var(--text);
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

/* Auto-generation toggle controls */
.auto-gen-controls {
    display: flex;
    gap: 10px;
    margin-left: 20px;
    padding-left: 20px;
    border-left: 2px solid var(--border);
}

.btn-toggle {
    background: var(--secondary);
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.btn-toggle:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-toggle.active {
    background: var(--success);
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.btn-toggle:disabled {
    background: var(--border);
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

.btn-toggle:disabled:hover {
    transform: none;
    box-shadow: none;
}

.toggle-icon {
    font-size: 18px;
    line-height: 1;
}

.toggle-text {
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.3px;
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat {
    background: var(--surface);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
}

.stat-value.amazon {
    color: var(--amazon);
}

.stat-value.other {
    color: var(--other);
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    padding: 4px;
    background: var(--surface);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--text-light);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.filter-tab:hover {
    background: var(--bg);
    color: var(--text);
}

.filter-tab.active {
    background: var(--primary);
    color: white;
}

.filter-tab[data-filter="pending"].active {
    background: #f59e0b;
}

.filter-tab[data-filter="approved"].active {
    background: var(--success);
}

.filter-tab[data-filter="rejected"].active {
    background: var(--danger);
}

.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.2);
}

.filter-tab:not(.active) .filter-count {
    background: var(--border);
    color: var(--text-light);
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--surface);
    border-radius: 12px;
}

.spinner {
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Email Grid */
.email-grid {
    display: grid;
    gap: 20px;
}

.email-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.email-card:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.email-card.amazon {
    border-left: 4px solid var(--amazon);
}

.email-card.other {
    border-left: 4px solid var(--other);
}

.email-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.email-badges {
    display: flex;
    gap: 8px;
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge.amazon {
    background: #dbeafe;
    color: var(--amazon);
}

.badge.other {
    background: #d1fae5;
    color: var(--other);
}

.badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.badge.approved {
    background: #d1fae5;
    color: #065f46;
}

.badge.rejected {
    background: #fee2e2;
    color: #991b1b;
}

.badge.edited {
    background: #e0e7ff;
    color: #3730a3;
}

.badge.mode {
    background: #f3f4f6;
    color: #374151;
    font-size: 10px;
    padding: 3px 8px;
}

.email-date {
    font-size: 12px;
    color: var(--text-light);
}

.email-subject {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
}

.email-preview {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 15px;
    line-height: 1.5;
}

.email-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.email-actions .btn {
    font-size: 12px;
    padding: 6px 12px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: var(--surface);
    border-radius: 12px;
}

.empty-state p {
    color: var(--text-light);
    font-size: 16px;
    margin-bottom: 10px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.modal.show {
    display: block;
}

.modal-content {
    background: var(--surface);
    margin: 30px auto;
    max-width: 1200px;
    width: 95%;
    border-radius: 12px;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 20px;
    max-height: 75vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Form Controls */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea.form-control {
    resize: vertical;
    font-family: 'Courier New', monospace;
    min-height: 300px;
    line-height: 1.6;
}

/* Validations */
.validations {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.validation-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.validation-item.valid {
    color: var(--success);
}

.validation-item.invalid {
    color: var(--danger);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }

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

    .modal-content {
        margin: 20px;
        max-width: 100%;
    }
}
