/* Cold Snipe Webapp Styles */

/* ============================================
   CSS Variables - Dark Theme (Matches Extension)
   ============================================ */
:root {
    /* Dark Theme Color Palette */
    --mint-green: #C5D8D1;
    --sage-green: #7FA096;
    --forest-green: #5C6E68;
    --charcoal: #3F4743;
    --dark-charcoal: #2B2F2D;
    --true-black: #0A0E0D;

    /* Semantic Colors */
    --primary: var(--sage-green);
    --primary-dark: var(--forest-green);
    --primary-light: var(--mint-green);
    --secondary: var(--forest-green);
    --success: var(--sage-green);
    --warning: #D4A574;
    --danger: #E88B82;
    --info: var(--forest-green);

    /* Background Layers (Dark to Light) */
    --bg-primary: var(--dark-charcoal);
    --bg-secondary: var(--true-black);
    --bg-tertiary: var(--charcoal);
    --bg-hover: rgba(92, 110, 104, 0.3);

    /* Text Hierarchy (Light to Dark) */
    --text-primary: var(--mint-green);
    --text-secondary: var(--sage-green);
    --text-muted: var(--forest-green);

    /* Borders */
    --border-color: rgba(92, 110, 104, 0.3);
    --border-dark: rgba(92, 110, 104, 0.4);

    /* Shadows & Glows */
    --border-radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow: 0 2px 4px rgba(0,0,0,0.5);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.6);

    /* Accent Glows */
    --mint-glow: rgba(197, 216, 209, 0.2);
    --sage-glow: rgba(127, 160, 150, 0.4);

    --sidebar-width: 240px;
    --header-height: 60px;
}

/* ============================================
   Reset & Base
   ============================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-secondary);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============================================
   Layout
   ============================================ */
#app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    width: 32px;
    height: 32px;
}

.app-name {
    font-weight: 600;
    font-size: 18px;
}

.nav-menu {
    list-style: none;
    padding: 12px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    max-width: 1200px;
}

/* ============================================
   Typography
   ============================================ */
h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

h2 {
    font-size: 20px;
    font-weight: 600;
}

h3 {
    font-size: 16px;
    font-weight: 600;
}

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

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--sage-green) 0%, var(--forest-green) 100%);
    color: var(--mint-green);
    box-shadow: 0 4px 12px var(--mint-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--sage-glow);
    filter: brightness(1.1);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-tertiary);
}

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

.btn-block {
    width: 100%;
}

.btn:disabled,
.btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-icon {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.7;
}

.btn-icon:hover {
    opacity: 1;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

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

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-dark);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--true-black);
    color: var(--sage-green);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--mint-green);
    box-shadow: 0 0 0 3px var(--mint-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.flex-1 {
    flex: 1;
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* ============================================
   Page Header
   ============================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    margin-bottom: 0;
}

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

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

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================
   Quick Actions
   ============================================ */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    text-decoration: none;
}

.action-icon {
    width: 24px;
    height: 24px;
}

/* ============================================
   Activity List
   ============================================ */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
}

.activity-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
}

.activity-time {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   Status Badges
   ============================================ */
.status-badge,
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-active,
.status-sent {
    background: rgba(127, 160, 150, 0.3);
    color: var(--mint-green);
}

.status-inactive,
.status-failed {
    background: rgba(232, 139, 130, 0.3);
    color: #E88B82;
}

.status-pending {
    background: rgba(212, 165, 116, 0.3);
    color: #D4A574;
}

.badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* ============================================
   Tables
   ============================================ */
.contacts-table-wrapper {
    overflow-x: auto;
}

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

.contacts-table th,
.contacts-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.contacts-table th {
    font-weight: 600;
    background: var(--bg-secondary);
}

.contacts-table tr:hover {
    background: var(--bg-secondary);
}

/* ============================================
   Modals
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-lg {
    max-width: 640px;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

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

.modal-body {
    padding: 20px;
}

/* ============================================
   Auth Page
   ============================================ */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg-secondary);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo img {
    max-width: 200px;
    height: auto;
    margin-bottom: 8px;
}

.auth-tagline {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin: 0;
}

.auth-header p {
    color: var(--text-muted);
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.auth-tabs .tab-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tabs .tab-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.auth-tabs .tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-divider {
    text-align: center;
    margin: 16px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.auth-message {
    text-align: center;
    padding: 20px;
}

.message-icon {
    font-size: 48px;
    margin-bottom: 16px;
}


.pricing-header {
    text-align: center;
    margin-bottom: 16px;
}

.pricing-header h3 {
    margin-bottom: 4px;
    color: var(--mint-green);
}

.feature-list {
    list-style: none;
    margin-bottom: 20px;
    padding: 0;
}

.feature-list li {
    padding: 6px 0;
    padding-left: 24px;
    position: relative;
    font-size: 13px;
    color: var(--text-secondary);
}

.feature-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

.pricing-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.price-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    text-align: center;
    position: relative;
}

.price-card.featured {
    border-color: var(--primary);
    background: rgba(127, 160, 150, 0.1);
}

.price-card h4 {
    margin-bottom: 8px;
    font-size: 14px;
}

.price-card .price {
    font-size: 28px;
    font-weight: 700;
    color: var(--mint-green);
    margin-bottom: 12px;
}

.price-card .price span {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
}

.badge-save {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--success);
    color: var(--true-black);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.pricing-note {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 16px;
}

/* Plan Selection */
.plan-selector {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.plan-option {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background: var(--bg-tertiary);
}

.plan-option:hover {
    border-color: var(--sage-green);
    transform: translateY(-1px);
}

.plan-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.plan-option:has(input[type="radio"]:checked) {
    border-color: var(--sage-green);
    background: #e8f5e9;
}

.plan-option:has(input[type="radio"]:checked)::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: var(--sage-green);
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 12px;
    background-repeat: no-repeat;
    background-position: center;
}

.plan-option:has(input[type="radio"]:checked) .plan-details h4,
.plan-option:has(input[type="radio"]:checked) .plan-details p {
    color: #1a1a1a;
}

.plan-option .plan-details h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.plan-option .plan-details p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.plan-option .badge {
    position: absolute;
    top: -8px;
    right: 8px;
    background: var(--sage-green);
    color: var(--true-black);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 600;
}

/* Trial Info */
.trial-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.trial-info span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.trial-info svg {
    width: 14px;
    height: 14px;
    color: var(--sage-green);
}

/* Auth Switch & Terms */
.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--text-primary);
    font-weight: 600;
}

.auth-terms {
    text-align: center;
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.auth-terms a {
    color: var(--text-secondary);
    text-decoration: underline;
}

/* Form small text */
.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.signup-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--mint-green);
    text-align: center;
    margin: 0 0 20px 0;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   Subscription Card
   ============================================ */
.subscription-card {
    margin-bottom: 24px;
}

.subscription-info {
    text-align: center;
}

.subscription-status {
    margin-bottom: 8px;
}

.plan-name {
    font-size: 20px;
    font-weight: 600;
    margin-left: 8px;
}

.subscription-period {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 16px;
}

.subscription-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* ============================================
   Response Log
   ============================================ */
.response-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.response-item {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
}

.response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.sender-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.response-time {
    font-size: 12px;
    color: var(--text-muted);
}

.response-preview {
    margin-bottom: 8px;
}

.preview-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.preview-text {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================
   Email Detail
   ============================================ */
.email-detail {
    max-height: 60vh;
    overflow-y: auto;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
}

.detail-row {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.detail-label {
    font-weight: 500;
    min-width: 60px;
}

.email-body {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--border-radius);
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ============================================
   Leads Page
   ============================================ */
.leads-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
}

.lists-sidebar .list-items {
    list-style: none;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
}

.list-item:hover {
    background: var(--bg-secondary);
}

.list-item.active {
    background: var(--primary);
    color: white;
}

.list-item.active .list-count {
    color: rgba(255, 255, 255, 0.8);
}

.list-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.list-count {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   Settings Page
   ============================================ */
.settings-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.settings-tabs .tab-btn {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
}

.settings-tabs .tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.account-details {
    max-width: 400px;
}

.mailbox-list,
.template-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mailbox-item,
.template-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
}

.mailbox-info,
.template-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mailbox-actions,
.template-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}

.page-info {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   Empty States
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state p {
    margin-bottom: 8px;
}

.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

.error {
    color: var(--danger);
}

/* ============================================
   Toast Notifications
   ============================================ */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    background: var(--text-primary);
    color: white;
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

.toast-info {
    background: var(--info);
}

/* ============================================
   Utilities
   ============================================ */
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

    .leads-layout {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Mailboxes Page
   ============================================ */
.mailboxes-grid {
    display: grid;
    gap: 16px;
}

.mailbox-card {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

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

.mailbox-info h3 {
    margin: 0 0 4px 0;
    color: var(--text-primary);
    font-size: 16px;
}

.mailbox-provider {
    background: var(--bg-hover);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

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

/* Knowledge Base Tabs */
.kb-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.kb-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s;
}

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

.kb-tab.active {
    color: var(--primary);
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--primary);
}

.kb-tab-content {
    display: none;
}

.kb-tab-content.active {
    display: block;
}

.kb-header {
    margin-bottom: 16px;
}

.kb-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kb-item {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.kb-item-content {
    flex: 1;
}

.kb-item .kb-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.kb-item .kb-value {
    color: var(--text-secondary);
    font-size: 14px;
}

.kb-item-actions {
    display: flex;
    gap: 8px;
}

.system-prompt-section textarea {
    width: 100%;
    min-height: 200px;
    font-family: monospace;
    font-size: 13px;
    margin-bottom: 16px;
}

/* AI Provider Settings */
.ai-provider-settings {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.provider-settings {
    margin-top: 16px;
}

/* Modal Fullwidth */
.modal-fullwidth {
    max-width: 800px;
    width: 95%;
}

.modal-lg .modal-content {
    max-width: 900px;
}

/* ============================================
   Inbox Styles (Matches Chrome Extension)
   ============================================ */
.inbox-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.inbox-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.inbox-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.inbox-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

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

.inbox-btn {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--forest-green);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 11px;
    font-weight: 600;
    color: var(--sage-green);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.inbox-btn:hover {
    background: var(--bg-hover);
    border-color: var(--sage-green);
    color: var(--mint-green);
    transform: translateY(-1px);
}

.inbox-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.inbox-btn.refreshing svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.mailbox-selector {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    width: 100%;
}

.mailbox-selector:hover {
    border-color: var(--primary);
}

.email-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.email-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.email-item:hover {
    border-color: var(--sage-green);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transform: translateY(-1px);
}

.email-item.unread {
    background: var(--bg-primary);
    border-left: 3px solid var(--mint-green);
}

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

.email-from {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.email-item.unread .email-from {
    font-weight: 700;
}

.email-time {
    font-size: 11px;
    color: var(--text-muted);
}

.email-subject {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.email-item.unread .email-subject {
    font-weight: 600;
}

.email-preview {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Auto-Response Badge */
.auto-response-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--forest-green), var(--sage-green));
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--mint-green);
    cursor: pointer;
}

.auto-response-badge:hover {
    opacity: 0.9;
}

.badge-icon {
    font-size: 12px;
}

.expand-icon {
    font-size: 10px;
    margin-left: 4px;
}

.ai-response-section {
    margin-top: 8px;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: 6px;
    border-left: 2px solid var(--sage-green);
}

.ai-response-section.hidden {
    display: none;
}

.ai-response-preview {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Email Detail Modal */
.email-detail-modal-content {
    max-width: 700px;
    width: 95%;
}

.email-detail-header h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    color: var(--text-primary);
}

.email-detail-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.email-detail-body {
    max-height: 400px;
    overflow-y: auto;
}

#emailDetailContent {
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 16px;
}

#aiResponseSection {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border-left: 3px solid var(--sage-green);
}

.ai-response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ai-badge {
    background: var(--sage-green);
    color: var(--true-black);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.ai-response-content {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 14px;
}

#replyArea {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

#replyArea textarea {
    width: 100%;
    min-height: 120px;
    margin-bottom: 12px;
}

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

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* KB Subtabs in Settings */
.kb-subtabs {
    display: flex;
    gap: 4px;
    margin: 16px 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.kb-subtab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    font-size: 13px;
}

.kb-subtab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.kb-subtab.active {
    color: var(--primary);
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--primary);
}

.kb-subtab-content {
    display: none;
}

.kb-subtab-content.active {
    display: block;
}

#system-prompt {
    width: 100%;
    min-height: 200px;
    font-family: monospace;
    font-size: 13px;
}

/* ============================================
   Settings Page - Chrome Extension Style
   ============================================ */
.settings-section {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.section-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.section-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.section-header.collapsible:hover {
    background: var(--bg-hover);
}

.collapse-icon {
    font-size: 12px;
    color: var(--text-muted);
}

.section-content {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

/* Mailbox List Header */
.mailbox-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.mailbox-counter {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mailbox-counter h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.count-badge {
    font-size: 12px;
    color: var(--sage-green);
    padding: 4px 8px;
    background: rgba(92, 110, 104, 0.2);
    border-radius: 4px;
}

/* Mailbox Items - Each with KB and AI buttons */
.mailbox-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mailbox-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.mailbox-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mailbox-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

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

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

.mailbox-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 12px;
}

.mailbox-actions .btn svg {
    flex-shrink: 0;
}

/* KB Modal - Larger */
.kb-modal .modal-content {
    max-width: 700px;
    max-height: 85vh;
}

/* KB Tabs in Modal */
.kb-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
}

.kb-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.kb-tab:hover {
    color: var(--text-primary);
}

.kb-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.kb-tab-content {
    display: none;
}

.kb-tab-content.active {
    display: block;
}

.kb-section {
    padding: 8px 0;
}

.kb-section p.text-muted {
    margin-bottom: 12px;
}

.kb-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.kb-header {
    margin-bottom: 12px;
}

.kb-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kb-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

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

.kb-label {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.kb-value {
    font-size: 12px;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-word;
}

.kb-item-actions {
    display: flex;
    gap: 4px;
    margin-left: 12px;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    border-radius: 4px;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Account Details */
.account-details {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: 6px;
}

.detail-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 80px;
}

.account-actions {
    margin-top: 16px;
}

/* Template List */
.template-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.template-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

/* ============================================
   Document Upload Styles
   ============================================ */
.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
}

.file-upload-area:hover,
.file-upload-area.drag-over {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.upload-placeholder {
    color: var(--text-muted);
}

.upload-placeholder svg {
    margin-bottom: 12px;
    opacity: 0.6;
}

.upload-placeholder p {
    margin: 8px 0 4px;
    color: var(--text-secondary);
}

.upload-placeholder small {
    color: var(--text-muted);
}

.upload-link {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
}

.upload-progress {
    padding: 16px 0;
}

.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

#upload-status {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Document item in KB list */
.doc-item .kb-item-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.doc-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-info .kb-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   Campaign Card Styles
   ============================================ */
.campaign-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 12px;
}

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

.campaign-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.campaign-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.campaign-status {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
}

.campaign-status.status-active {
    background: rgba(127, 160, 150, 0.2);
    color: var(--success);
}

.campaign-status.status-paused {
    background: rgba(212, 165, 116, 0.2);
    color: var(--warning);
}

.campaign-status.status-completed {
    background: rgba(127, 160, 150, 0.3);
    color: var(--primary-light);
}

.campaign-status.status-deleted {
    background: rgba(232, 139, 130, 0.2);
    color: var(--danger);
}

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

.campaign-progress {
    margin-bottom: 12px;
}

.campaign-progress .progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.campaign-progress .progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.progress-stats .sent {
    color: var(--success);
}

.progress-stats .pending {
    color: var(--warning);
}

.progress-stats .failed {
    color: var(--danger);
}

.progress-stats .total {
    color: var(--text-muted);
}

.campaign-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: rgba(232, 139, 130, 0.1);
}
