/* admin-dfy-pipeline.css */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f3f4f6;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
}

/* Button Styles - Matching admin-dfy.html */
.dfy-btn {
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 20px;
    padding-right: 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-sizing: border-box;
}

.dfy-btn-primary {
    background: #3B82F6;
    color: white;
}

.dfy-btn-primary:hover {
    background: #2563EB;
}

.dfy-btn-secondary {
    background: white;
    color: #6B7280;
    border: 1px solid #D1D5DB;
}

.dfy-btn-secondary:hover {
    background: #F9FAFB;
}

/* Ensure buttons have symmetric padding */
.dfy-btn i {
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Ensure all buttons maintain symmetric horizontal padding */
.dfy-btn {
    text-align: center;
}

.pipeline-container {
    padding: 24px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pipeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-shrink: 0;
}

.pipeline-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
}

.pipeline-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
    min-height: 0;
    padding-bottom: 16px;
    align-items: stretch;
    height: 100%;
}

.pipeline-column {
    flex: 0 0 300px;
    background: #f9fafb;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #e5e7eb;
}

/* Stage-specific background colors */
.pipeline-column.stage-won-closed {
    background: #f0fdf4;
}

.pipeline-column.stage-won-closed .column-header,
.pipeline-column.stage-won-closed .column-body {
    background: #f0fdf4;
}

.pipeline-column.stage-unqualified {
    background: #fefef3;
}

.pipeline-column.stage-unqualified .column-header,
.pipeline-column.stage-unqualified .column-body {
    background: #fefef3;
}

.pipeline-column.stage-lost {
    background: #fef2f2;
}

.pipeline-column.stage-lost .column-header,
.pipeline-column.stage-lost .column-body {
    background: #fef2f2;
}

.column-header {
    padding: 12px;
    color: #374151;
    display: flex;
    align-items: flex-start;
    background: #f9fafb;
    border-radius: 8px 8px 0 0;
    font-size: 14px;
}

.column-count {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.column-body {
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 100px; /* Drop target area */
    background: #f9fafb;
}

.deal-card {
    background: white;
    padding: 8px;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    cursor: grab;
    transition: box-shadow 0.2s, transform 0.2s;
}

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

.deal-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.deal-title {
    font-weight: 600;
    font-size: 13px;
    color: #111827;
    margin-bottom: 3px;
    line-height: 1.3;
}

.deal-value {
    font-size: 12px;
    color: #059669;
    font-weight: 500;
    margin-bottom: 6px;
}

.deal-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.deal-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
}

.deal-meta-item i {
    font-size: 9px;
}

.deal-meta-item svg {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    color: inherit;
}

.deal-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.tag {
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 3px;
    background: #e5e7eb;
    color: #374151;
}

.tag.high { background: #fee2e2; color: #991b1b; }
.tag.medium { background: #fef3c7; color: #92400e; }
.tag.low { background: #d1fae5; color: #065f46; }

.deal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #6b7280;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #f3f4f6;
}

.lead-name {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lead-name i {
    font-size: 10px;
}

.deal-footer .tag {
    flex-shrink: 0;
}

.deal-footer-icon {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    color: #6b7280;
    flex-shrink: 0;
}

.deal-footer-icon svg {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    color: inherit;
}

/* Modal Styles - Matching admin-dfy.html */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active,
.modal-overlay.open {
    display: flex;
}

.modal-container,
.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: visible;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Make dealModal wider */
#dealModal .modal-content {
    max-width: 1200px;
    width: 95%;
}

/* Ensure modal-content works the same */
.modal-content {
    display: flex;
    flex-direction: column;
}

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

.modal-header h2,
.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6B7280;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #F3F4F6;
    color: #111827;
}

.modal-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    overflow-x: visible;
    display: flex;
    gap: 24px;
    position: relative;
}

/* Ensure modal body in add deal modal displays form properly */
#addDealModal .modal-body {
    display: block;
    overflow: visible;
}

#addDealModal form {
    width: 100%;
    position: relative;
    overflow: visible;
}

/* Ensure modal content allows dropdown overflow */
#addDealModal .modal-content {
    overflow: visible;
}

#addDealModal .modal-content .modal-body {
    overflow: visible;
}

.modal-main {
    flex: 2;
}

.modal-sidebar {
    flex: 1;
    background: #f9fafb;
    padding: 16px;
    border-radius: 8px;
}

.detail-group {
    margin-bottom: 20px;
    overflow: visible;
}

.detail-label,
.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.detail-value {
    font-size: 14px;
    color: #111827;
}

/* Form inputs matching admin-dfy */
.form-input,
.form-textarea,
.form-select,
.search-input,
.filter-select,
.custom-dropdown-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    display: block;
}

/* Ensure form inputs in modals are full width */
#addDealModal .form-input,
#addDealModal .form-select,
#addDealModal .form-textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus,
.search-input:focus,
.filter-select:focus,
.custom-dropdown-input:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

/* Form group matching admin-dfy */
.form-group {
    margin-bottom: 20px;
    overflow: visible;
    width: 100%;
    position: relative;
}

/* Ensure form groups in modals take full width */
#addDealModal .form-group {
    width: 100%;
}

/* Custom dropdown styling */
.custom-dropdown {
    position: relative;
    width: 100%;
    display: block;
    z-index: 1;
}

/* Ensure dropdowns in modals have proper z-index stacking */
.modal-overlay .custom-dropdown {
    z-index: auto;
}

/* Ensure custom dropdown in add deal modal is full width */
#addDealModal .custom-dropdown {
    width: 100%;
}

.custom-dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 10001;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.custom-dropdown-list.show {
    display: block;
}

.custom-dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
    display: block;
}

.custom-dropdown-item:hover {
    background: #F9FAFB;
}

.custom-dropdown-item.selected {
    background: #EFF6FF;
    color: #2563EB;
}

.recordings-list, .bookings-list, .tasks-list, .comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recording-item, .booking-item, .task-item, .comment-item {
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    transition: all 0.2s;
}

.task-item:hover, .comment-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.task-item.task-completed {
    opacity: 0.7;
    background: #f9fafb;
}

.task-overdue {
    color: #DC2626 !important;
    font-weight: 600;
}

.task-edit-btn, .task-delete-btn, .comment-edit-btn, .comment-delete-btn {
    padding: 6px 10px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 32px;
    height: 32px;
    position: relative;
}

.task-edit-btn svg, .task-delete-btn svg, .comment-edit-btn svg, .comment-delete-btn svg {
    width: 12px;
    height: 12px;
    display: block;
    flex-shrink: 0;
}

.task-edit-btn, .task-delete-btn, .comment-edit-btn, .comment-delete-btn {
    padding: 6px 10px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 32px;
    height: 32px;
    position: relative;
    line-height: 1;
}

.task-edit-btn i, .task-delete-btn i, .comment-edit-btn i, .comment-delete-btn i {
    font-size: 12px;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: inherit !important;
}

.task-edit-btn {
    background: #EFF6FF;
    color: #2563EB;
}

.task-edit-btn:hover {
    background: #DBEAFE;
    color: #1D4ED8;
}

.task-edit-btn i {
    color: inherit;
}

.task-delete-btn {
    background: #FEE2E2;
    color: #DC2626;
}

.task-delete-btn:hover {
    background: #FECACA;
    color: #B91C1C;
}

.task-delete-btn i {
    color: inherit;
}

.comment-edit-btn {
    background: #EFF6FF;
    color: #2563EB;
}

.comment-edit-btn:hover {
    background: #DBEAFE;
    color: #1D4ED8;
}

.comment-edit-btn i {
    color: inherit;
}

.comment-delete-btn {
    background: #FEE2E2;
    color: #DC2626;
}

.comment-delete-btn:hover {
    background: #FECACA;
    color: #B91C1C;
}

.comment-delete-btn i {
    color: inherit;
}

.recording-title {
    font-weight: 500;
    margin-bottom: 4px;
    color: #2563EB;
    cursor: pointer;
}

.recording-meta {
    font-size: 12px;
    color: #6b7280;
}

/* Tabs in Modal */
.modal-tabs {
    display: flex;
    gap: 16px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 16px;
}

.modal-tab {
    padding: 8px 0;
    cursor: pointer;
    color: #6b7280;
    border-bottom: 2px solid transparent;
}

.modal-tab.active {
    color: #2563EB;
    border-bottom-color: #2563EB;
}

.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}

/* Stage Management Styles */
.stage-item {
    padding: 12px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    margin-bottom: 0;
    transition: all 0.2s;
    cursor: grab;
    position: relative;
}

.stage-item:hover {
    background: #FFFFFF;
    border-color: #D1D5DB;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stage-item:active {
    cursor: grabbing;
}

.stage-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: rotate(2deg);
}

.stage-item.drag-over {
    border-top: 3px solid #3B82F6;
    padding-top: 9px; /* Adjust to maintain spacing */
}

.stage-item.editing {
    background: #FFFFFF;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    cursor: default;
}

.stage-drag-handle {
    cursor: grab;
    color: #9CA3AF;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    user-select: none;
}

.stage-item.dragging .stage-drag-handle {
    cursor: grabbing;
}

.stage-drop-zone {
    height: 4px;
    margin: 2px 0;
    border-radius: 2px;
    transition: all 0.2s;
    background: transparent;
}

.stage-drop-zone.drag-over {
    height: 8px;
    background: #3B82F6;
    margin: 4px 0;
    border-radius: 4px;
}

.stage-name-text {
    font-weight: 500;
    color: #111827;
    font-size: 14px;
}

.stage-name-input {
    width: 100%;
}

.stage-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Deal Email List Styles */
.deal-email-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #F9FAFB;
    border-radius: 4px;
    margin-bottom: 4px;
    border: 1px solid #E5E7EB;
    transition: all 0.2s;
}

.deal-email-item:hover {
    background: #FFFFFF;
    border-color: #D1D5DB;
}

.deal-email-text {
    font-size: 13px;
    color: #111827;
    flex: 1;
}

.deal-email-remove-btn {
    background: none;
    border: none;
    color: #DC2626;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    opacity: 0;
    visibility: hidden;
}

.deal-email-item:hover .deal-email-remove-btn {
    opacity: 1;
    visibility: visible;
    background: #FEE2E2;
    color: #991B1B;
}

.deal-email-remove-btn:hover {
    background: #FECACA !important;
    color: #B91C1C !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.deal-email-remove-text {
    font-size: 11px;
    font-weight: 500;
}

.deal-email-remove-btn i {
    font-size: 11px;
    display: inline-block;
}

/* Import Bookings Table Styles */
.import-bookings-table {
    width: auto;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    font-size: 13px;
    table-layout: auto;
}

.import-bookings-table thead {
    background: #F9FAFB;
    border-bottom: 2px solid #E5E7EB;
    position: sticky;
    top: 0;
    z-index: 10;
}

.import-bookings-table th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #E5E7EB;
    background: #F9FAFB;
    position: relative;
}

/* First column (checkbox) - no longer sticky */
.import-bookings-table th:first-child,
.import-bookings-table td:first-child {
    background: white;
}

.import-bookings-table thead th:first-child {
    background: #F9FAFB;
}

/* Second column (#) - no longer sticky */
.import-bookings-table th:nth-child(2),
.import-bookings-table td:nth-child(2) {
    background: white;
}

.import-bookings-table thead th:nth-child(2) {
    background: #F9FAFB;
}

.import-bookings-table tbody tr {
    border-bottom: 1px solid #E5E7EB;
    transition: all 0.2s;
    background: white;
}

.import-bookings-table tbody tr:hover {
    background: #F9FAFB;
}

/* Hover states handled by row-level styles */

.import-bookings-table tbody tr.selected {
    background: #EFF6FF;
    border-left: 3px solid #3B82F6;
}

.import-bookings-table tbody tr.selected:hover {
    background: #DBEAFE;
}

/* Ensure all cells in selected row get the selected background */
.import-bookings-table tbody tr.selected td {
    background: #EFF6FF;
}

.import-bookings-table tbody tr.selected:hover td {
    background: #DBEAFE;
}

.import-bookings-table td {
    padding: 12px 8px;
    vertical-align: middle;
    background: white;
}

/* Ensure table wrapper allows horizontal scrolling */
#importBookingsList > div {
    overflow-x: auto;
    overflow-y: auto;
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    -webkit-overflow-scrolling: touch;
}

.booking-status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background: #E5E7EB;
    color: #374151;
}

#importBookingsList {
    background: white;
    border-radius: 6px;
    overflow-x: auto;
    overflow-y: auto;
    width: 100%;
    max-width: 100%;
}

/* Ensure table container allows horizontal scroll */
#importBookingsList > div {
    width: 100%;
    max-width: 100%;
}

/* Import Bookings Search */
#importBookingsSearch {
    width: 100%;
}

#importBookingsSearch:focus {
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* JSON Viewer Styles */
.json-viewer-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.json-viewer-container:hover {
    background: rgba(59, 130, 246, 0.1);
}

.json-viewer-icon {
    color: #6B7280;
    transition: color 0.2s;
    cursor: pointer;
    flex-shrink: 0;
}

.json-viewer-container:hover .json-viewer-icon {
    color: #3B82F6;
}

/* Ensure icon is visible in selected rows */
.import-bookings-table tbody tr.selected .json-viewer-icon {
    color: #2563EB;
}

.import-bookings-table tbody tr.selected .json-viewer-container:hover .json-viewer-icon {
    color: #1D4ED8;
}

.json-tooltip {
    position: fixed;
    background: #1F2937;
    color: #F9FAFB;
    padding: 0 16px 16px 16px;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    min-width: 400px;
    max-width: 600px;
    max-height: 500px;
    overflow: auto;
    z-index: 999999 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    text-align: left !important;
    display: none;
    cursor: default;
}

/* Show tooltip when visible */
.json-tooltip.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    display: block;
    cursor: text;
}

.json-tooltip-content {
    margin: 0 !important;
    padding: 16px 0 0 0 !important;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    font-size: 11px;
    line-height: 1.5;
    color: #F9FAFB;
    white-space: pre;
    word-wrap: normal;
    overflow-wrap: normal;
    text-align: left !important;
    direction: ltr;
    tab-size: 2;
    display: block;
    width: 100%;
    text-indent: 0;
    border: none;
    background: transparent;
}

/* Ensure tooltip doesn't interfere with row selection */
.json-viewer-container {
    position: relative;
}

.json-viewer-container:hover {
    z-index: 999999;
}
