/* ============================================================
   Sales Lead Stage Cards — CardView Styles
   Phase 2: Full-width split layout (info left, tasks right)
   UX Priority: Large, readable, obvious. Big touch targets.
   Designed for non-tech-savvy sales users on iPads/tablets.
   ============================================================ */

/* ── Card Container (full width) ── */
.sales-lead-card-container {
    padding: 4px !important;
}

.sales-lead-card-container .card {
    height: auto !important;
    overflow: visible !important;
    margin-bottom: 0 !important;
}

.sales-lead-card-container .card-header {
    display: none !important;
}

/* ── Base Card ── */
.sales-lead-card {
    border-radius: 12px;
    border: 3px solid #dee2e6;
    background: #fff;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sales-lead-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #adb5bd;
}

/* ── Color-Coded Status Borders ── */
.sales-lead-card.status-on-track {
    border-left: 8px solid #28a745;
}

.sales-lead-card.status-task-overdue {
    border-left: 8px solid #ffc107;
    background: #fffdf5;
}

.sales-lead-card.status-stalled {
    border-left: 8px solid #dc3545;
    background: #fff5f5;
}

/* ════════════════════════════════════════════════════════════════
   SPLIT LAYOUT — .slc-body is the flex container
   Left (info-panel, 60%) + Right (tasks-panel, 40%)
   ════════════════════════════════════════════════════════════════ */

.slc-body {
    display: flex;
    gap: 0;
    min-height: 120px;
}

/* ── Left: Info Panel (60%) ── */
.slc-info-panel {
    flex: 3;
    display: flex;
    flex-direction: column;
    padding: 0;
    min-width: 0; /* prevent flex overflow */
}

/* ── Right: Tasks Panel (40%) ── */
.slc-tasks-panel {
    flex: 2;
    border-left: 2px solid #e9ecef;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.slc-tasks-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px 8px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.slc-tasks-panel-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 6px;
}

.slc-tasks-panel-title i {
    color: #6c757d;
}

.slc-tasks-panel-count {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0d6efd;
    background: #e7f1ff;
    padding: 2px 10px;
    border-radius: 12px;
}

.slc-tasks-panel-list {
    max-height: 180px;
    overflow-y: auto;
    padding: 6px 12px 8px 12px;
}

/* Scrollbar styling for tasks panel */
.slc-tasks-panel-list::-webkit-scrollbar {
    width: 6px;
}

.slc-tasks-panel-list::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 3px;
}

.slc-tasks-panel-list::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 3px;
}

.slc-tasks-panel-list::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

/* ── Inline Task Items ── */
.slc-task-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 4px;
    font-size: 0.9rem;
    color: #495057;
    border-bottom: 1px solid #f5f5f5;
}

.slc-task-item:last-child {
    border-bottom: none;
}

.slc-task-check {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    color: #6c757d;
}

.slc-task-done .slc-task-check {
    color: #28a745;
}

.slc-task-item .slc-task-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.slc-task-done .slc-task-title {
    text-decoration: line-through;
    color: #adb5bd;
}

.slc-task-due {
    font-size: 0.8rem;
    color: #6c757d;
    white-space: nowrap;
    flex-shrink: 0;
}

.slc-task-overdue .slc-task-due {
    color: #dc3545;
    font-weight: 600;
}

.slc-task-priority {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.slc-task-priority-high {
    background: #f8d7da;
    color: #721c24;
}

.slc-task-priority-low {
    background: #e9ecef;
    color: #6c757d;
}

/* ── Card Header Row ── */
.slc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 20px 8px 20px;
    gap: 12px;
}

.slc-company-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: #212529;
    margin: 0;
    line-height: 1.3;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Header hover — entire header is clickable, not just name */
.slc-header {
    cursor: pointer;
    transition: background-color 0.1s ease;
    border-radius: 8px 8px 0 0;
}

.slc-header:hover {
    background-color: #f0f6ff;
}

.slc-header:hover .slc-company-name {
    color: #0d6efd;
}

/* Priority badge — smaller, inline, less dominant */
.slc-priority-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slc-priority-badge.priority-high {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.slc-priority-badge.priority-medium {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.slc-priority-badge.priority-low {
    background-color: #e9ecef;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

/* ── Card Info Rows ── */
.slc-info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    padding: 4px 20px 6px 20px;
    font-size: 1.05rem;
    color: #495057;
}

.slc-info-row-secondary {
    padding-bottom: 12px;
}

.slc-info-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.slc-info-item i {
    font-size: 1.1rem;
    color: #6c757d;
    width: 20px;
    text-align: center;
}

.slc-info-item strong {
    font-weight: 600;
}

.slc-last-activity-muted {
    color: #adb5bd;
    font-style: italic;
}

.slc-info-separator {
    color: #ced4da;
    font-size: 1rem;
}

/* ── Status Indicator Badges ── */
.slc-status-badge {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.slc-status-badge.badge-on-track {
    background: #d4edda;
    color: #155724;
}

.slc-status-badge.badge-overdue {
    background: #fff3cd;
    color: #856404;
}

.slc-status-badge.badge-stalled {
    background: #f8d7da;
    color: #721c24;
}

/* ── Follow-Up Needed Badge (orange/amber) ── */
.slc-status-badge.badge-followup {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
    font-weight: 700;
}

.slc-status-badge.badge-followup i {
    color: #e67e22;
}

/* ── No Tasks / Empty State ── */
.slc-no-tasks {
    font-size: 0.9rem;
    color: #6c757d;
    font-style: italic;
    padding: 12px 4px;
    text-align: center;
}

/* ── Quick Note Preview (legacy, kept for compatibility) ── */
.slc-quick-note {
    padding: 4px 20px 8px 20px;
    font-size: 0.9rem;
    color: #6c757d;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════════
   ACTION BUTTONS — Full-width bottom row
   ════════════════════════════════════════════════════════════════ */

.slc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 20px 16px 20px;
    border-top: 2px solid #e9ecef;
    margin-top: auto;
}

.slc-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    border: 2px solid #dee2e6;
    background: #f8f9fa;
    color: #212529;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
    /* Big touch targets — minimum 44px tall (Apple HIG) */
    min-height: 44px;
}

.slc-action-btn:hover {
    background: #e2e6ea;
    border-color: #adb5bd;
    text-decoration: none;
    color: #212529;
}

.slc-action-btn:active {
    background: #d3d7db;
    transform: scale(0.98);
}

.slc-action-btn i {
    font-size: 1.2rem;
}

/* Notes button — subtle accent */
.slc-action-btn.slc-notes-btn {
    background: #fff8e1;
    border-color: #ffe082;
    color: #795548;
}

.slc-action-btn.slc-notes-btn:hover {
    background: #ffecb3;
    border-color: #ffc107;
}

.slc-action-btn.slc-notes-btn i {
    color: #f9a825;
}

/* Notes split button group — Notes + "+" side by side */
.slc-split-btn-group {
    display: inline-flex;
    align-items: stretch;
}

.slc-split-btn-group .slc-notes-btn {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.slc-split-btn-group .slc-notes-add-btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
    padding: 10px 12px;
    min-width: 40px;
    background: #fff8e1;
    border-color: #ffe082;
    color: #795548;
    font-size: 1rem;
}

.slc-split-btn-group .slc-notes-add-btn:hover {
    background: #28a745;
    border-color: #28a745;
    color: #fff;
}

.slc-split-btn-group .slc-notes-add-btn i {
    color: inherit;
    font-size: 1rem;
}

/* Calendar button — subtle accent */
.slc-action-btn.slc-calendar-btn {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #2e7d32;
}

.slc-action-btn.slc-calendar-btn:hover {
    background: #c8e6c9;
    border-color: #66bb6a;
}

.slc-action-btn.slc-calendar-btn i {
    color: #43a047;
}

/* Advance button — stands out */
.slc-action-btn.slc-advance-btn {
    background: linear-gradient(135deg, #0d6efd, #0b5ed7);
    color: #fff;
    border-color: #0b5ed7;
    padding: 10px 22px;
}

.slc-action-btn.slc-advance-btn:hover {
    background: linear-gradient(135deg, #0b5ed7, #0a58ca);
    border-color: #0a58ca;
    color: #fff;
}

.slc-action-btn.slc-advance-btn i {
    color: #fff;
}

/* Protocol button — Create Protocol (teal accent) */
/*.slc-action-btn.slc-protocol-btn.slc-protocol-create {
    background: #e0f7fa;
    border-color: #4dd0e1;
    color: #00695c;
}

.slc-action-btn.slc-protocol-btn.slc-protocol-create:hover {
    background: #b2ebf2;
    border-color: #00acc1;
}

.slc-action-btn.slc-protocol-btn.slc-protocol-create i {
    color: #00897b;
}*/

/* Protocol button — View Protocol (linked, green check accent) */
/*.slc-action-btn.slc-protocol-btn.slc-protocol-linked {
    background: #e8f5e9;
    border-color: #81c784;
    color: #2e7d32;
}

.slc-action-btn.slc-protocol-btn.slc-protocol-linked:hover {
    background: #c8e6c9;
    border-color: #66bb6a;
}

.slc-action-btn.slc-protocol-btn.slc-protocol-linked i {
    color: #43a047;
}*/

/* ── Divider (legacy, kept for compatibility) ── */
.slc-divider {
    border: none;
    border-top: 2px solid #e9ecef;
    margin: 0 20px;
}

/* ── Task Progress (legacy from old layout, kept for compatibility) ── */
.slc-tasks-section {
    padding: 10px 20px;
}

.slc-task-progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.slc-task-progress-label {
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}

.slc-task-progress-bar-container {
    flex: 1;
    background: #e9ecef;
    border-radius: 8px;
    height: 14px;
    overflow: hidden;
}

.slc-task-progress-bar {
    height: 100%;
    border-radius: 8px;
    transition: width 0.3s ease;
    min-width: 0;
}

.slc-task-progress-bar.progress-green {
    background: linear-gradient(90deg, #28a745, #34ce57);
}

.slc-task-progress-bar.progress-yellow {
    background: linear-gradient(90deg, #ffc107, #ffda47);
}

.slc-task-progress-bar.progress-red {
    background: linear-gradient(90deg, #dc3545, #e86a76);
}

.slc-task-progress-count {
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    white-space: nowrap;
    min-width: 70px;
    text-align: right;
}

/* ── Next Task Due (legacy) ── */
.slc-next-task {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #495057;
    padding: 2px 0 0 0;
}

.slc-next-task i {
    color: #6c757d;
    font-size: 1rem;
}

.slc-next-task.task-overdue {
    color: #dc3545;
    font-weight: 600;
}

.slc-next-task.task-overdue i {
    color: #dc3545;
}

.slc-next-task-title {
    font-style: italic;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════════
   LOG ACTIVITY DROPDOWN — collapses 3-4 actions into one button
   ════════════════════════════════════════════════════════════════ */

.slc-dropdown-wrap {
    position: relative;
    display: inline-flex;
}

.slc-log-activity-btn {
    background: #e7f1ff !important;
    border-color: #b6d4fe !important;
    color: #0d6efd !important;
}

.slc-log-activity-btn:hover {
    background: #d0e3ff !important;
    border-color: #86b7fe !important;
}

.slc-log-activity-btn .slc-caret {
    font-size: 0.7rem;
    margin-left: 2px;
    opacity: 0.7;
}

.slc-dropdown-menu {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 6px;
    min-width: 200px;
    background: #fff;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
    flex-direction: column;
}

.slc-dropdown-menu.slc-dropdown-open {
    display: flex;
}

.slc-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 18px;
    border: none;
    background: transparent;
    color: #212529;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s ease;
    white-space: nowrap;
}

.slc-dropdown-item:hover {
    background: #e7f1ff;
    color: #0d6efd;
}

.slc-dropdown-item + .slc-dropdown-item {
    border-top: 1px solid #f0f0f0;
}

.slc-dropdown-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    color: #6c757d;
}

.slc-dropdown-item:hover i {
    color: #0d6efd;
}

/* ════════════════════════════════════════════════════════════════
   TASK MARKERS — read-only visual indicators (not fake checkboxes)
   ════════════════════════════════════════════════════════════════ */

.slc-task-marker {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    font-size: 1.2rem;
    color: #adb5bd;
    line-height: 1;
}

.slc-task-marker-done {
    color: #28a745;
}

.slc-task-marker-done i {
    font-size: 0.8rem;
}

/* High-priority incomplete tasks — bolder text */
.slc-task-high .slc-task-title {
    font-weight: 700;
    color: #212529;
}

.slc-task-high .slc-task-marker {
    color: #dc3545;
}

/* ════════════════════════════════════════════════════════════════
   MINI PROGRESS BAR — in task panel header
   ════════════════════════════════════════════════════════════════ */

.slc-tasks-progress-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slc-tasks-mini-bar {
    width: 60px;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.slc-tasks-mini-fill {
    display: block;
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.slc-tasks-mini-fill.progress-green {
    background: linear-gradient(90deg, #28a745, #34ce57);
}

.slc-tasks-mini-fill.progress-yellow {
    background: linear-gradient(90deg, #ffc107, #ffda47);
}

.slc-tasks-mini-fill.progress-red {
    background: linear-gradient(90deg, #dc3545, #e86a76);
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */

/* ── Responsive: Tablet ── */
@media (max-width: 1200px) {
    .slc-company-name {
        font-size: 1.15rem;
    }

    .slc-info-row {
        font-size: 0.95rem;
    }

    .slc-action-btn {
        padding: 8px 14px;
        font-size: 0.9rem;
    }
}

/* ── Responsive: Small tablet / phone — stack panels vertically ── */
@media (max-width: 768px) {
    .slc-body {
        flex-direction: column;
    }

    .slc-tasks-panel {
        border-left: none;
        border-top: 2px solid #e9ecef;
    }

    .slc-tasks-panel-list {
        max-height: 150px;
    }

    .slc-header {
        flex-direction: column;
        gap: 8px;
    }

    .slc-company-name {
        white-space: normal;
    }

    .slc-info-row {
        flex-direction: column;
        gap: 4px;
    }

    .slc-info-separator {
        display: none;
    }

    .slc-actions {
        flex-direction: column;
    }

    .slc-action-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ════════════════════════════════════════════════════════════════
   SALES LEAD EMAIL DIALOG — Contact checkboxes & form styles
   ════════════════════════════════════════════════════════════════ */

.sales-email-form .field {
    margin-bottom: 16px;
}

.sales-email-form .caption {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 6px;
    display: block;
    color: #495057;
}

.sales-email-form .email-subject-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.15s ease;
}

.sales-email-form .email-subject-input:focus {
    border-color: #0d6efd;
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

/* ── Contact checkbox list ── */
.email-contact-list {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 10px 14px;
    max-height: 200px;
    overflow-y: auto;
    background: #fafafa;
}

.email-contact-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s ease;
    font-size: 0.95rem;
    border-bottom: 1px solid #f0f0f0;
}

.email-contact-checkbox:last-child {
    border-bottom: none;
}

.email-contact-checkbox:hover {
    background: #e7f1ff;
}

.email-contact-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #0d6efd;
}

.email-contact-label {
    flex: 1;
    color: #212529;
}

.email-contact-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.email-contact-disabled:hover {
    background: transparent;
}

.email-no-address {
    color: #dc3545;
    font-style: italic;
    font-size: 0.85rem;
}

.email-primary-badge {
    font-size: 0.75rem;
    font-weight: 700;
    background: #0d6efd;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.email-no-contacts {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    padding: 12px;
}

.email-contacts-loading {
    color: #6c757d;
    text-align: center;
    padding: 12px;
}

/* ── Additional To / CC — extra email rows ── */
.email-extra-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.email-extra-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.email-extra-input {
    flex: 1;
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.15s ease;
    background: #fff;
    min-width: 0;
    box-sizing: border-box;
}

.email-extra-input:focus {
    border-color: #0d6efd;
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.email-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
    color: #6c757d;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
    font-size: 0.9rem;
    padding: 0;
}

.email-remove-btn:hover {
    background: #f8d7da;
    border-color: #dc3545;
    color: #dc3545;
}

.email-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 2px dashed #ced4da;
    border-radius: 6px;
    background: transparent;
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.email-add-btn:hover {
    border-color: #0d6efd;
    color: #0d6efd;
    background: #e7f1ff;
}

.email-add-btn i {
    font-size: 0.85rem;
}
