/* css/followup.css
   Follow-up Action System — Styles
   ============================================================ */

/* ── TAB LAYOUT ──────────────────────────────────────────── */
.followup-container {
    padding: 20px;
    max-width: 100%;
}

/* ── SUMMARY HEADER BAR ──────────────────────────────────── */
.followup-summary-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.followup-summary-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    flex: 1;
}

.followup-summary-chips {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.followup-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1.5px solid transparent;
}
.followup-chip.chip-overdue {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.25);
}
.followup-chip.chip-today {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.25);
}
.followup-chip.chip-upcoming {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.25);
}
.followup-chip.chip-done {
    background: rgba(100, 116, 139, 0.12);
    color: var(--text-muted);
    border-color: rgba(100, 116, 139, 0.2);
}
.followup-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ── 3-SECTION GRID ──────────────────────────────────────── */
.followup-sections {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

@media (max-width: 1100px) {
    .followup-sections {
        grid-template-columns: 1fr 1fr;
    }
}
@media (max-width: 720px) {
    .followup-sections {
        grid-template-columns: 1fr;
    }
}

.followup-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    padding: 16px;
    min-height: 140px;
}

.followup-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-default);
}

.followup-section-icon {
    font-size: 1rem;
}

.followup-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex: 1;
}

.followup-section-count {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 22px;
    text-align: center;
}

.section-overdue .followup-section-count {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}
.section-today .followup-section-count {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}
.section-upcoming .followup-section-count {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.followup-section-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 20px 0;
    font-style: italic;
}

/* ── ACTION CARD ─────────────────────────────────────────── */
.followup-action-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-left: 3px solid transparent;
    margin-bottom: 8px;
    transition: all 0.2s;
    cursor: default;
}

.followup-action-card:hover {
    border-color: var(--border-default);
    background: var(--bg-card-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.card-overdue  { border-left-color: #ef4444; }
.card-today    { border-left-color: #f59e0b; }
.card-upcoming { border-left-color: #10b981; }
.card-done     { border-left-color: #64748b; opacity: 0.6; }

.followup-action-card.card-done .action-text,
.followup-action-card.card-done .action-lead-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

.action-card-body {
    flex: 1;
    min-width: 0;
}

.action-lead-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-accent, #3b82f6);
    cursor: pointer;
    display: inline-block;
    margin-bottom: 2px;
    text-decoration: none;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-lead-name:hover {
    text-decoration: underline;
}

.action-text {
    font-size: 0.85rem;
    color: var(--text-main);
    line-height: 1.3;
    word-break: break-word;
    margin-bottom: 4px;
}

.action-due-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-due-label.due-overdue { color: #ef4444; font-weight: 600; }
.action-due-label.due-today   { color: #f59e0b; font-weight: 600; }

.action-card-btns {
    display: flex;
    gap: 4px;
    align-items: flex-start;
    flex-shrink: 0;
}

.btn-action-done,
.btn-action-done-next,
.btn-action-delete,
.btn-action-edit,
.btn-action-pancake {
    background: none;
    border: 1px solid var(--border-default);
    border-radius: 6px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.btn-action-done:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
    color: #10b981;
}
.btn-action-done.action-done-active {
    background: rgba(16, 185, 129, 0.22) !important;
    border-color: #10b981 !important;
    color: #10b981 !important;
    opacity: 1 !important;
}
.btn-action-done-next:hover {
    background: rgba(99, 102, 241, 0.25) !important;
    border-color: #6366f1 !important;
    color: #818cf8 !important;
}
.btn-action-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #ef4444;
}
.btn-action-edit:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    color: #3b82f6;
}
.btn-action-pancake:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    color: #3b82f6;
}

/* ── ALL ACTIONS TABLE (below sections) ──────────────────── */
.followup-all-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.followup-all-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.followup-all-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
}

.followup-filter-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.followup-filter-select {
    font-size: 0.8rem;
    padding: 5px 10px;
    border-radius: 7px;
    border: 1px solid var(--border-default);
    background: var(--bg-input);
    color: var(--text-main);
    cursor: pointer;
}

.followup-search-input {
    font-size: 0.8rem;
    padding: 5px 10px;
    border-radius: 7px;
    border: 1px solid var(--border-default);
    background: var(--bg-input);
    color: var(--text-main);
    width: 180px;
}

.followup-search-input:focus,
.followup-filter-select:focus {
    outline: none;
    border-color: var(--accent-color, #3b82f6);
}

/* ── SIDEBAR NAV BADGE ───────────────────────────────────── */
.nav-followup-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background: #ef4444;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    animation: badge-pulse 2s ease-in-out infinite;
    border: 1.5px solid var(--bg-sidebar, #1a1a2e);
    pointer-events: none;
    transition: all 0.2s;
}

.nav-followup-badge.badge-hidden {
    display: none;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* ── LEAD ROW: FOLLOW-UP BUTTON ──────────────────────────── */
.btn-crm-followup {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    outline: none;
    transition: all 0.2s ease-in-out;
    position: relative;
}

.btn-crm-followup:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.5);
    color: #60a5fa;
    transform: translateY(-1px);
}

.btn-crm-followup.has-pending-action {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.5);
    color: #f59e0b;
}

.btn-crm-followup.has-overdue-action {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
    animation: overdueGlow 2s ease-in-out infinite;
}

@keyframes overdueGlow {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }
}

.btn-crm-followup .followup-count-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    box-shadow: 0 0 0 2px var(--bg-surface);
    z-index: 2;
}

.btn-crm-followup .followup-count-badge.badge-overdue {
    background: #ef4444;
}

.btn-crm-followup .followup-count-badge.badge-today {
    background: #f59e0b;
}

.btn-crm-followup .followup-count-badge.badge-upcoming {
    background: #10b981;
}

/* ── ADD ACTION MODAL ────────────────────────────────────── */
.followup-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.followup-modal-overlay.active {
    display: flex;
}

.followup-modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.followup-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.followup-modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.followup-modal-lead-name {
    font-size: 0.8rem;
    color: var(--text-accent, #3b82f6);
    font-weight: 600;
    margin-top: 2px;
}

.btn-modal-close-followup {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.15s;
}
.btn-modal-close-followup:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.followup-modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.followup-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.followup-form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.followup-form-input,
.followup-form-textarea {
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-default);
    background: var(--bg-input);
    color: var(--text-main);
    font-size: 0.88rem;
    font-family: inherit;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.followup-form-input:focus,
.followup-form-textarea:focus {
    outline: none;
    border-color: var(--accent-color, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.followup-form-textarea {
    min-height: 70px;
    resize: vertical;
}

.followup-date-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Expand toggle */
.followup-expand-toggle {
    background: none;
    border: none;
    color: var(--text-accent, #3b82f6);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
    transition: opacity 0.2s;
}
.followup-expand-toggle:hover { opacity: 0.7; }

.followup-expanded-fields {
    display: none;
    flex-direction: column;
    gap: 14px;
}
.followup-expanded-fields.open {
    display: flex;
}

/* Quick date presets */
.followup-quick-dates {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-quick-date {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-default);
    background: var(--bg-tag);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.btn-quick-date:hover,
.btn-quick-date.active {
    background: rgba(59, 130, 246, 0.12);
    border-color: #3b82f6;
    color: #3b82f6;
}

/* Modal footer */
.followup-modal-footer {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    justify-content: flex-end;
}

.btn-followup-cancel {
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid var(--border-default);
    background: var(--bg-tag);
    color: var(--text-secondary);
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.btn-followup-cancel:hover {
    background: var(--bg-tag-hover);
}

.btn-followup-save {
    padding: 8px 20px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: white;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-followup-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}
.btn-followup-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Loading state inside sections */
.followup-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 30px 0;
    font-size: 0.85rem;
}

/* ── BTN ADD FOLLOWUP (in dashboard) ─────────────────────── */
.btn-add-followup-global {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-add-followup-global:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    transform: translateY(-1px);
}
