/* Pipeline page styles */

.pipeline-container {
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pipeline-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.pipeline-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.pipeline-header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pipeline-view-toggle {
    display: flex;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
}

.view-toggle-btn {
    padding: 0.4rem 0.75rem;
    border: none;
    background: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    color: #6b7280;
}

.view-toggle-btn.active {
    background: #1f2937;
    color: #fff;
}

.deal-search {
    padding: 0.4rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
    width: 180px;
}

/* Stats bar */
.pipeline-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.stat-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    min-width: 120px;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
}

.stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.2rem;
}

/* Kanban board */
.pipeline-kanban {
    display: flex;
    gap: 0.75rem;
    flex: 1;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.kanban-column {
    min-width: 240px;
    max-width: 280px;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.kanban-column-header {
    padding: 0.75rem;
    border-top: 3px solid #6b7280;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-column-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1f2937;
}

.kanban-column-meta {
    font-size: 0.75rem;
    color: #6b7280;
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 100px;
}

.kanban-cards.drag-over {
    background: #e0e7ff;
    border-radius: 0 0 8px 8px;
}

.kanban-empty {
    text-align: center;
    padding: 1rem;
    color: #9ca3af;
    font-size: 0.8rem;
}

/* Deal cards */
.kanban-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.75rem;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
}

.kanban-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.kanban-card-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.kanban-card-client {
    font-size: 0.75rem;
    color: #6b7280;
}

.kanban-card-contact {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

.kanban-card-dc-btn {
    margin-bottom: 0.5rem;
    font-size: 0.7rem;
    padding: 3px 8px;
}

.kanban-card-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.kanban-card-value {
    font-weight: 600;
    color: #059669;
}

.kanban-card-owner {
    background: #e5e7eb;
    color: #374151;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
}

.kanban-card-date {
    color: #9ca3af;
    margin-left: auto;
}

/* List view */
.pipeline-list {
    flex: 1;
    overflow: auto;
}

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

.deals-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    border-bottom: 1px solid #e5e7eb;
}

.deals-table td {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
    border-bottom: 1px solid #f3f4f6;
}

.deal-row {
    cursor: pointer;
}

.deal-row:hover {
    background: #f9fafb;
}

.stage-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.3rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

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

.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}

textarea.form-input {
    resize: vertical;
}

/* Deal detail panel (slide-out) */
.deal-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    justify-content: flex-end;
    z-index: 999;
}

.deal-detail-panel {
    width: 480px;
    max-width: 100%;
    background: #fff;
    height: 100%;
    overflow-y: auto;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
}

.deal-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    background: #fff;
}

.deal-detail-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.deal-detail-content {
    padding: 1.5rem;
}

/* Stage progress */
.stage-progress {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
}

.stage-step {
    flex: 1;
    padding: 0.4rem 0.25rem;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 500;
    background: #f3f4f6;
    color: #9ca3af;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.stage-step:hover {
    background: #e5e7eb;
}

.stage-step.completed {
    background: #d1fae5;
    color: #065f46;
}

.stage-step.active {
    background: #3b82f6;
    color: #fff;
}

/* Deal info grid */
.deal-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.deal-info-row {
    display: flex;
    flex-direction: column;
}

.deal-info-label {
    font-size: 0.7rem;
    color: #6b7280;
    text-transform: uppercase;
    font-weight: 500;
}

.deal-info-value {
    font-size: 0.9rem;
    color: #1f2937;
    font-weight: 500;
}

.deal-notes-section {
    margin-bottom: 1.5rem;
}

.deal-notes-section h4 {
    font-size: 0.85rem;
    margin: 0 0 0.5rem 0;
    color: #374151;
}

.deal-notes-section p {
    font-size: 0.85rem;
    color: #4b5563;
    white-space: pre-wrap;
    margin: 0;
}

/* Deal actions */
.deal-detail-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.btn-won {
    background: #10b981;
    color: #fff;
    border: none;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-won:hover { background: #059669; }

.btn-lost {
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-lost:hover { background: #dc2626; }

/* History */
.deal-history-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
}

.deal-history-section h4 {
    font-size: 0.85rem;
    margin: 0 0 0.75rem 0;
    color: #374151;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.history-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.history-text {
    color: #374151;
}

.history-note {
    color: #6b7280;
    font-style: italic;
}

.history-time {
    margin-left: auto;
    color: #9ca3af;
    font-size: 0.75rem;
    white-space: nowrap;
}

.history-empty {
    color: #9ca3af;
    font-size: 0.8rem;
}

/* Log activity form */
.deal-log-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
    margin-bottom: 1rem;
}

.deal-log-section h4 {
    font-size: 0.85rem;
    margin: 0 0 0.75rem 0;
    color: #374151;
}

.log-activity-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.log-type-select {
    width: auto;
    max-width: 120px;
}

/* Tasks section */
.deal-tasks-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.section-header h4 {
    font-size: 0.85rem;
    margin: 0;
    color: #374151;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    color: #374151;
}

.btn-small:hover {
    background: #f3f4f6;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.task-item input[type="checkbox"] {
    margin-top: 0.2rem;
}

.task-completed .task-title {
    text-decoration: line-through;
    color: #9ca3af;
}

.task-info {
    display: flex;
    flex-direction: column;
}

.task-title {
    font-size: 0.85rem;
    color: #1f2937;
}

.task-meta {
    font-size: 0.7rem;
    color: #6b7280;
}

.task-overdue {
    color: #ef4444;
    font-weight: 500;
}

/* Timeline */
.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.8rem;
}

.timeline-icon {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.timeline-icon-stage {
    color: #3b82f6;
    font-weight: 600;
}

.timeline-text {
    flex: 1;
    color: #374151;
}

.timeline-body {
    color: #6b7280;
    font-size: 0.75rem;
}

.timeline-time {
    margin-left: auto;
    color: #9ca3af;
    font-size: 0.7rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.timeline-clickable {
    cursor: pointer;
    border-radius: 4px;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.timeline-clickable:hover {
    background: #eff6ff;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #374151;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* Email modal */
.email-modal-card {
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.email-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

.email-modal-meta {
    font-size: 0.8rem;
    color: #374151;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    line-height: 1.6;
}

.email-modal-date {
    color: #6b7280;
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

.email-modal-frame {
    width: 100%;
    min-height: 200px;
    border: none;
    border-radius: 4px;
    background: #fff;
}

/* Link to deal modal row */
.link-deal-row {
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.85rem;
}

.link-deal-row:hover {
    background: #f0f9ff;
}

/* Link to deal button in inbox */
.btn-link-deal {
    background: #8b5cf6;
    color: #fff;
    border: none;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-link-deal:hover {
    background: #7c3aed;
}

/* Notification bell */
.sidebar-brand {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notif-bell {
    position: relative;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: #ef4444;
    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;
}

.notif-panel {
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 1001;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    font-size: 0.85rem;
}

.notif-mark-all {
    background: none;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    font-size: 0.75rem;
}

.notif-item {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
}

.notif-item:hover {
    background: #f9fafb;
}

.notif-unread {
    background: #eff6ff;
}

.notif-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: #1f2937;
}

.notif-body {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.2rem;
}

.notif-time {
    font-size: 0.65rem;
    color: #9ca3af;
    margin-top: 0.2rem;
}

.notif-empty {
    padding: 2rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.8rem;
}

.notif-loading {
    padding: 1rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.8rem;
}
