* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 240px;
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
}

.sidebar-header h1 {
    font-size: 24px;
    margin: 0;
}

.sidebar-section {
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.sidebar-section h3 {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-button {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: none;
    background: #f3f4f6;
    color: #374151;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    transition: all 0.2s;
}

.sidebar-button:hover {
    background: #e5e7eb;
    transform: translateX(2px);
}

.sidebar-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sidebar-button.primary {
    background: #667eea;
    color: white;
}

.sidebar-button.primary:hover {
    background: #5568d3;
}

.sidebar-button.success {
    background: #10b981;
    color: white;
}

.sidebar-button.success:hover {
    background: #059669;
}

.sidebar-button.warning {
    background: #f59e0b;
    color: white;
}

.sidebar-button.warning:hover {
    background: #d97706;
}

.sidebar-button.danger {
    background: #ef4444;
    color: white;
}

.sidebar-button.danger:hover {
    background: #dc2626;
}

/* New style for special view option buttons */
.sidebar-button.view-option {
    background-color: #e0e7ff; /* Light indigo background */
    color: #3730a3; /* Dark indigo text and icon color */
    border: 1px solid #c7d2fe; /* Slightly darker border */
}

.sidebar-button.view-option:hover {
    background-color: #c7d2fe; /* Darker background on hover */
    border-color: #a5b4fc;
    color: #312e81; /* Slightly darker text on hover */
}

/* ============================================
   ISOLATED SIDEBAR SECTION
   ============================================ */

.sidebar-section-isolated {
    padding: 15px;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

.sidebar-section-isolated .sidebar-button {
    margin-bottom: 0; /* Remove the default bottom margin since it's the only button */
}


.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.content-container {
    max-width: 900px;
    margin: 0 auto;
}

.login-section, .session-selector {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.login-section h3 {
    margin-bottom: 20px;
    color: #374151;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #6b7280;
    font-weight: 500;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* ============================================
CHECKBOX GROUP STYLES
============================================ */

.input-group.checkbox-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.checkbox-group input[type="checkbox"] {
    width: auto; /* Override default full-width */
    flex-shrink: 0;
}

.checkbox-group label {
    margin-bottom: 0; /* Override default block-level margin */
}

button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* --- NEW: Button group for main input --- */
.input-button-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.input-button-group button {
    flex: 1; /* Make buttons share space */
}

/* Style for the secondary action button */
.input-button-group .secondary-action {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.hidden {
    display: none !important;
}

.info-box {
    background: #f0f9ff;
    border-left: 4px solid #3b82f6;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.timezone-badge {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 10px;
}

.scratch-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fee2e2;
    color: #991b1b;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.scratch-badge:hover {
    background: #fecaca;
    transform: scale(1.05);
}

.scratch-badge.empty {
    background: #f3f4f6;
    color: #6b7280;
}

.scratch-badge.empty:hover {
    background: #e5e7eb;
}

.chat-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.chat-section label {
    display: block;
    margin-bottom: 10px;
    color: #374151;
    font-weight: 500;
}

textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.2s;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

.send-btn {
    width: 100%;
    margin-top: 10px;
}

.response-area {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    min-height: 100px;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #6b7280;
    font-style: italic;
}

.error {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
    padding: 15px;
    border-radius: 6px;
    color: #991b1b;
}

.success {
    background: #d1fae5;
    border-left: 4px solid #10b981;
    padding: 15px;
    border-radius: 6px;
    color: #065f46;
}

.info {
    background: #e0e7ff;
    border-left: 4px solid #6366f1;
    padding: 15px;
    border-radius: 6px;
    color: #3730a3;
}

.task-list {
    margin-top: 20px;
}

.task-section-header {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* TASK ITEM - SINGLE DEFINITION */
.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    transition: all 0.2s;
    position: relative;
    flex-wrap: wrap; /* Allow items to wrap to the next line */
    z-index: 1;
}

.task-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.task-item.sub-task {
    background-color: #fffbeb; /* Light pastel yellow */
    border-color: #fef3c7;
    border-left-width: 4px;
}

.task-item.primary-project-task {
    background-color: #ffdde1; /* Light pastel pink */
    border-color: #ffc4c9;
    border-left-width: 4px;
}

.task-checkbox {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.task-text {
    flex: 1;
    color: #374151;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
    min-width: 0;
}

.task-text:hover {
    background: #f3f4f6;
}

.task-text[contenteditable="true"] {
    background: #fef3c7;
    outline: 2px solid #f59e0b;
    cursor: text;
}

.task-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.urgency-flag-display {
    font-size: 16px;
}

.note-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: #6b7280;
    transition: all 0.2s ease-in-out;
}

.note-badge.clickable {
    /* Ensure the pointer cursor is always shown, overriding other styles */
    cursor: pointer !important;
}

.note-badge.clickable:hover {
    background: #e5e7eb;
    cursor: pointer;
    z-index: 2; /* Ensure it's above other elements for cursor interaction */
    transform: scale(1.05);
}

.add-note-badge {
    background: #f9fafb; /* Lighter background for empty state */
    opacity: 0.7;
}

.add-note-badge:hover {
    opacity: 1;
    background: #e5e7eb;
    transform: scale(1.1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.due-date-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: #6b7280;
    transition: all 0.2s ease-in-out;
}

.due-date-badge.clickable {
    cursor: pointer !important;
}

.due-date-badge.clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ============================================
   VIEW/EDIT TASK MODAL - VISUAL REFINEMENTS
   ============================================ */

/* Main modal content styling */
#editTaskModal .modal-content {
    background-color: #f8f9fa; /* Light grey background for depth */
    border: 1px solid #e5e7eb;
}

/* Modal Header */
#editTaskModal .modal-header {
    background: linear-gradient(135deg, #7c86e4 0%, #8c78d2 100%);
    color: white;
    padding: 20px 25px;
    border-bottom: none;
    margin-bottom: 10px; /* NEW: Add space below the header */
    border-radius: 11px 11px 0 0; /* Match parent border-radius */
}

#editTaskModal .modal-close-btn {
    color: white;
    opacity: 0.8;
}
#editTaskModal .modal-close-btn:hover {
    opacity: 1;
}

/* Form Grid and Groups */
#editTaskModal .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Responsive columns */
    gap: 20px;
    align-items: start;
}

#editTaskModal .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- UNIFIED FIELD STYLING (The Core Fix) --- */
#editTaskModal .form-group > input,
#editTaskModal .form-group > select,
#editTaskModal .form-group > .due-date-badge-container {
    width: 100%;
    height: 44px; /* Consistent height for all fields */
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: white;
    font-size: 14px;
    color: #1f2937;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Specific alignment for the date badge container */
#editTaskModal .form-group > .due-date-badge-container {
    display: flex;
    align-items: center;
}

#editTaskModal .form-group > input:focus,
#editTaskModal .form-group > select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* Modern Divider */
#editTaskModal .form-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 25px 0;
}

/* Modal Footer */
#editTaskModal .modal-footer {
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
    margin-top: 10px;
}

/* ============================================
   DIRECT ADD TASK MODAL - VISUAL REFINEMENTS
   ============================================ */

/* Main modal content styling */
#directAddTaskModal .modal-content {
    background-color: #f8f9fa;
    border: 1px solid #e5e7eb;
}

/* Modal Header */
#directAddTaskModal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    border-bottom: none;
    border-radius: 11px 11px 0 0;
}

#directAddTaskModal .modal-close-btn {
    color: white;
    opacity: 0.8;
}
#directAddTaskModal .modal-close-btn:hover {
    opacity: 1;
}

/* Form Grid and Groups */
#directAddTaskModal .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    align-items: start;
}

#directAddTaskModal .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Unified Field Styling */
#directAddTaskModal .form-group > input,
#directAddTaskModal .form-group > select {
    height: 44px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: white;
    font-size: 14px;
    color: #1f2937;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#directAddTaskModal .form-group > input:focus,
#directAddTaskModal .form-group > select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* Modal Footer */
#directAddTaskModal .modal-footer {
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
    margin-top: 10px;
}

.add-date-badge {
    background: #f9fafb;
    opacity: 0.7;
    border: 1px dashed #d1d5db;
}

.due-date-badge.overdue {
    background: #fee2e2;
    color: #dc2626;
}

.due-date-badge.today {
    background: #fed7aa;
    color: #ea580c;
}

.task-menu-trigger {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    color: #9ca3af;
    transition: all 0.2s;
    position: relative;
    font-size: 20px;
}

.task-menu-trigger:hover {
    background: #f3f4f6;
    color: #667eea;
}

/* ============================================
SUB-TASK TOGGLE STYLES
============================================ */

.toggle-subtasks, .toggle-subtasks-placeholder {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #9ca3af;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
}

.toggle-subtasks {
    cursor: pointer;
}

.toggle-subtasks:hover {
    background-color: #e5e7eb;
    color: #374151;
}

.toggle-all-subtasks, .toggle-all-subtasks-placeholder {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #9ca3af;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
    margin-left: -5px; /* Pull it closer to the first toggle */
}

.toggle-all-subtasks {
    cursor: pointer;
}

.toggle-all-subtasks:hover {
    background-color: #e0e7ff;
    color: #374151;
}

/* Add Sub-task Button */
.add-subtask-btn {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    color: #9ca3af;
    transition: all 0.2s;
    font-size: 20px;
}

/* Hide old edit icons */
.task-edit-icons {
    display: none !important;
}

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

.natural-task-text {
    cursor: pointer;
    transition: background-color 0.2s;
    padding: 2px 4px;
    border-radius: 4px;
}

.natural-task-text:hover {
    background-color: #f3f4f6;
}

.natural-task-meta {
    font-size: 12px;
    color: #4b5563; /* Slightly darker for better readability */
    margin-left: 4px; /* Reduced margin */
    font-style: italic;
}

/* Task Control Panel */
.task-control-panel {
    position: absolute;
    right: 0;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    min-width: 200px;
    display: none;
}

.task-control-panel.visible {
    display: block;
}

.task-control-panel.position-above {
    bottom: 100%;
    margin-bottom: 5px;
}

.task-control-panel.position-below {
    top: 100%;
    margin-top: 5px;
}

.control-panel-section {
    padding: 8px;
}

.control-panel-section:not(:last-child) {
    border-bottom: 1px solid #e5e7eb;
}

.control-panel-button {
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.control-panel-button:hover {
    background: #f3f4f6;
    color: #667eea;
}

.control-panel-button.danger {
    color: #ef4444;
}

.control-panel-button.danger:hover {
    background: #fee2e2;
}

.control-panel-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
    padding: 4px 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.urgency-options {
    padding: 4px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.urgency-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.urgency-option:hover {
    background: #f3f4f6;
}

.urgency-option input[type="radio"] {
    cursor: pointer;
}

.urgency-option label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    font-size: 14px;
}

.mobile-panel-close {
    display: none;
    padding: 8px;
    text-align: center;
}

.mobile-panel-close button {
    width: 100%;
    padding: 8px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.complete-task-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0; /* Prevent the icon from shrinking */
    border: 2px solid #a7f3d0;
    color: #065f46;
    background-color: #d1fae5;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}

.complete-task-icon:hover {
    background-color: #10b981;
    color: white;
    transform: scale(1.1);
}

.project-view-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 5px;
    border-radius: 50%;
    background-color: #667eea;
    color: white;
    cursor: pointer;
}

/* NEW: Container for the sub-task's project link and parent name */
.subtask-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    order: -1; /* Ensure it appears before the task text */
    margin-bottom: 4px;
    background-color: #f3f4f6;
    padding: 4px 8px;
    border-radius: 4px;
}

/* NEW: Style for parent task name in standard view */
.parent-task-name {
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
    /* Remove properties that are now on the parent .subtask-header */
    padding: 0;
    background-color: transparent;
}

.completed-task {
    opacity: 0.6;
}

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

/* Old styles kept for compatibility */
.urgency-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    user-select: none;
}

.urgency-flag:hover {
    transform: scale(1.2);
}

.urgency-standard {
    color: #9ca3af;
    opacity: 0.3;
}

.urgency-standard:hover {
    opacity: 0.6;
}

.urgency-urgent {
    color: #dc2626;
    filter: drop-shadow(0 1px 2px rgba(220, 38, 38, 0.3));
}

.urgency-not-urgent {
    color: #f97316;
    filter: drop-shadow(0 1px 2px rgba(249, 115, 22, 0.3));
}

.date-picker-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: white;
    border: 2px solid #667eea; /* Changed to match control panel */
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    padding: 15px;
    z-index: 3000; /* Even higher */
    min-width: 250px;
}

.date-picker-dropdown h4 {
    margin: 0 0 12px 0;
    color: #374151;
    font-size: 14px;
    font-weight: 600;
}

.date-quick-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 15px;
}

.date-quick-btn {
    padding: 8px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    color: #374151;
}

.date-quick-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
}

/* Style for the "No Date" button in the date picker */
.date-quick-btn.no-date-btn {
    background: #fee2e2; /* Light red */
    color: #b91c1c; /* Dark red */
    border-color: #fecaca;
}

.date-quick-btn.no-date-btn:hover {
    background: #ef4444; /* Brighter red on hover */
    color: white;
}
.date-picker-input-group {
    margin-bottom: 10px;
}

.date-picker-input-group label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 5px;
}

.date-picker-input-group input[type="date"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
}

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

.date-picker-actions button {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
}

.session-selector {
    margin-top: 20px;
}

.session-toggle-btn {
    width: 100%;
    margin-bottom: 15px;
    background: #f3f4f6;
    color: #374151;
}

.session-details {
    transition: max-height 0.3s ease;
    overflow: hidden;
}

.session-details.collapsed {
    max-height: 0;
}

.session-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.session-controls button {
    flex: 1;
}

.natural-text-view {
    background: white;
    padding: 20px;
    border-radius: 12px;
}

.natural-text-content {
    line-height: 1.8;
}

.natural-text-content.completed {
    opacity: 0.6;
}

.group-select-btn {
    padding: 6px 10px;
    min-width: 36px;
    height: 36px;
    font-size: 16px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.group-select-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: scale(1.05);
}

/* Notes Modal Styles */
.notes-modal {
    display: block;
    position: fixed;
    z-index: 10001; /* Increased to appear above the main edit modal (z-index: 10000) */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
}

.notes-modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.notes-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #e5e7eb;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.notes-modal-header h3 {
    margin: 0;
    font-size: 1.5em;
}

.notes-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.notes-close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

.notes-task-info {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
}

.notes-list {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 200px;
    max-height: 400px;
}

.note-item {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.2s;
}

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

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

.note-header strong {
    color: #374151;
    font-size: 1.1em;
}

.note-actions {
    display: flex;
    gap: 6px;
}

.note-action-btn {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    padding: 6px 10px;
    font-size: 16px;
    transition: all 0.2s;
}

.note-action-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: scale(1.1);
}

.note-content {
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 10px;
    white-space: pre-wrap;
}

.note-meta {
    display: flex;
    gap: 10px;
    color: #9ca3af;
    font-size: 12px;
    border-top: 1px solid #e5e7eb;
    padding-top: 8px;
    margin-top: 8px;
}

.note-empty {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
    font-style: italic;
}

.notes-add-section {
    padding: 20px;
    border-top: 2px solid #e5e7eb;
    background: #fafafa;
    border-radius: 0 0 12px 12px;
}

.notes-add-section h4 {
    margin: 0 0 15px 0;
    color: #374151;
    font-size: 1.1em;
}

.notes-edit-section {
    padding: 20px;
    background: #fef3c7;
    border-top: 2px solid #fbbf24;
}

.notes-edit-section h4 {
    margin: 0 0 15px 0;
    color: #92400e;
}

.note-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.note-form input:focus {
    outline: none;
    border-color: #667eea;
}

.note-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.2s;
}

.note-form textarea:focus {
    outline: none;
    border-color: #667eea;
}

.save-note-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.save-note-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.cancel-note-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.cancel-note-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.mobile-header {
    display: none;
}

.sidebar-overlay {
    display: none;
}

.hamburger {
    display: none;
}

/* Add these styles to the <style> section in index.html */

/* Search Container */
.search-container {
    margin-top: 10px;
}

.search-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    background: white;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-hint {
    font-size: 11px;
    color: #6b7280;
    margin-top: 5px;
    font-style: italic;
}

/* Search Results Banner */
.search-results-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
    animation: slideDown 0.3s ease-out;
}

.search-results-banner.hidden {
    display: none;
}

.search-results-info {
    font-size: 15px;
}

.search-results-info strong {
    font-weight: 600;
}

.clear-search-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.clear-search-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Search Match Highlighting */
.search-highlight {
    background-color: #fef08a;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
}

/* Animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Empty State for No Results */
.search-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.search-empty-state .empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.search-empty-state h3 {
    font-size: 20px;
    color: #374151;
    margin-bottom: 10px;
}

.search-empty-state p {
    font-size: 14px;
    color: #6b7280;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .search-results-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .clear-search-btn {
        width: 100%;
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .task-menu-trigger {
        opacity: 1 !important;
    }

    .mobile-panel-close {
        display: block;
    }

    .task-control-panel {
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        right: auto;
        bottom: auto;
        max-width: 90vw;
        min-width: 280px;
    }

    .task-control-panel.position-above,
    .task-control-panel.position-below {
        margin: 0;
    }

    .notes-modal-content {
        width: 95%;
        margin: 10% auto;
        max-height: 85vh;
    }

    .notes-list {
        max-height: 300px;
    }

    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 15px 20px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1001;
    }

    .mobile-header h1 {
        font-size: 20px;
        margin: 0;
    }

    .hamburger {
        display: block;
        background: none;
        border: none;
        color: #667eea;
        font-size: 28px;
        font-weight: bold;
        padding: 5px;
        cursor: pointer;
    }

    .hamburger:hover {
        color: #764ba2;
    }

    .sidebar {
        position: fixed;
        left: -240px;
        top: 0;
        height: 100vh;
        z-index: 1002;
    }

    .sidebar.open {
        transform: translateX(240px);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1000;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        padding-top: 70px;
        width: 100%;
    }

    .group-select-btn {
        min-width: 32px;
        height: 32px;
        padding: 4px 8px;
    }

    .timezone-badge {
        display: block;
        margin-left: 0;
        margin-top: 5px;
    }

    .date-picker-dropdown {
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        right: auto;
        margin: 0;
        max-width: 90vw;
    }

    .info-box {
        flex-direction: column;
        align-items: flex-start;
    }
}
/* ============================================
TAG SYSTEM STYLES
============================================ */

/* Tag Badges */
.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin: 2px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.tag-badge .remove-tag-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    margin-left: 4px;
    font-size: 14px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.tag-badge .remove-tag-btn:hover {
    opacity: 1;
}

/* Task Tags Hover Container */
.task-tags-hover {
    display: none;
    flex-wrap: wrap;
    flex-basis: 100%;       /* ← ADDED - forces full width, wraps to new line */
    order: 1;               /* ← ADDED - appears after other items (which have order: 0) */
    gap: 6px;
    align-items: center;
    margin-top: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    animation: fadeIn 0.2s;
}

.task-tags-hover.visible {
    visibility: visible;        /* Show with class */
    opacity: 1;
    max-height: 500px;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.add-tag-hover-btn {
    display: inline-flex;      /* ← ADDED */
    align-items: center;       /* ← ADDED */
    padding: 2px 10px;         /* ← CHANGED from 4px 10px */
    font-size: 12px;
    font-weight: 500;          /* ← ADDED */
    background: #e9ecef;
    border: 1px dashed #adb5bd;
    border-radius: 12px;
    margin: 2px;               /* ← ADDED */
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;            /* ← ADDED - prevents shrinking */
    white-space: nowrap;       /* ← ADDED - keeps text on one line */
}

.add-tag-hover-btn:hover {
    background: #dee2e6;
    border-style: solid;
}

/* Tag Input Modal */
.tag-input-modal input[type="text"] {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
}

.tag-input-modal input[type="text"]:focus {
    outline: none;
    border-color: #3b82f6;
}

/* Tag Suggestions */
.tag-suggestions {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin: 10px 0;
}

.tag-suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.tag-suggestion-item:hover {
    background: #f8f9fa;
}

.tag-suggestion-item.new-tag {
    color: #3b82f6;
    font-style: italic;
}

.tag-usage {
    font-size: 12px;
    color: #6c757d;
}

/* Search Box */
.search-container {
    position: relative;
    margin: 10px 0;
}

#taskSearchBox {
    width: 100%;
    padding: 10px 35px 10px 10px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
}

#taskSearchBox:focus {
    outline: none;
    border-color: #3b82f6;
}

#clearSearchBtn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}

#clearSearchBtn:hover {
    color: #000;
}

/* Bulk Tag Actions */
#bulkTagActions {
    background: #fff3cd;
    padding: 15px;
    border-radius: 6px;
    margin: 10px 0;
}

#bulkTagActions h4 {
    margin: 0 0 10px 0;
    color: #856404;
}

#bulkTagActions button {
    display: block;
    width: 100%;
    margin: 5px 0;
    padding: 8px;
    background: #fff;
    border: 1px solid #ffc107;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

#bulkTagActions button:hover {
    background: #ffc107;
    color: #000;
}

/* Settings Page - Tags Table */
.tags-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.tags-table th,
.tags-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.tags-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.tags-table tr:hover {
    background: #f8f9fa;
}

.tags-table input[type="color"] {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.tag-name-display {
    font-weight: 500;
    margin-right: 10px;
}

.usage-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e9ecef;
    border-radius: 12px;
    font-size: 12px;
    color: #495057;
}

.small-btn {
    padding: 6px 10px;
    margin: 0 2px;
    border: 1px solid #e9ecef;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.small-btn:hover:not(:disabled) {
    background: #f8f9fa;
    transform: translateY(-1px);
}

.small-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.delete-btn:hover:not(:disabled) {
    background: #f8d7da;
    border-color: #f5c2c7;
}

.no-data {
    text-align: center;
    padding: 40px !important;
    color: #6c757d;
    font-style: italic;
}

/* Tag Stats Summary */
.tag-stats-summary {
    background: #e7f3ff;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.tag-stats-summary strong {
    color: #0d6efd;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s, slideOut 0.3s 2.7s;
    z-index: 10000;
}

@keyframes slideIn {
    from { transform: translateX(400px); }
    to { transform: translateX(0); }
}

@keyframes slideOut {
    from { transform: translateX(0); }
    to { transform: translateX(400px); }
}

/* Mind Map Tag Panel */
.panel-section .tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tag-badge {
        font-size: 11px;
        padding: 2px 6px;
    }
    
    .task-tags-hover {
        padding: 6px;
    }
    
    .tags-table {
        font-size: 14px;
    }
    
    .tags-table th,
    .tags-table td {
        padding: 8px;
    }
}

/* ============================================
NATURAL TEXT VIEW STYLES
============================================ */

.natural-text-view {
    background: white;
    padding: 20px;
    border-radius: 12px;
}

.natural-view-header {
    font-size: 1.2em;
    color: #667eea;
    margin-top: 1em;
    margin-bottom: 0.5em;
}

.natural-view-divider {
    border: 0;
    height: 1px;
    background: #e5e7eb;
    margin: 1.5em 0;
}

.natural-task-item {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 30px; /* Space for the ellipsis */
}

.natural-task-item p {
    margin: 0.5em 0;
    flex-grow: 1;
    line-height: 1.6;
}

.natural-task-item .task-menu-trigger {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

/* ============================================
MODAL STYLES
============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.2s;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 1000px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s;
}

.modal-content h3 {
    margin: 0 0 20px 0;
    color: #1f2937;
    font-size: 20px;
}

.modal-content input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 10px;
}

.modal-content input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-actions button.primary {
    background: #667eea;
    color: white;
}

.modal-actions button.primary:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.modal-actions button.danger {
    background: #ef4444;
    color: white;
}

.modal-actions button.danger:hover {
    background: #dc2626;
}

.modal-actions button:not(.primary):not(.danger) {
    background: #f3f4f6;
    color: #374151;
}

.control-panel-button.disconnect-button {
    color: #d97706; /* Amber color for a "structural change" warning */
}

.control-panel-button.disconnect-button:hover {
    background: #fef3c7; /* Light amber background on hover */
}

.modal-actions button:not(.primary):not(.danger):hover {
    background: #e5e7eb;
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px); 
    }
    to { 
        opacity: 1;
        transform: translateY(0); 
    }
}

.toggle-subtasks.open {
    transform: rotate(90deg);
}

/* ============================================
SUB-TASK MODAL STYLES
============================================ */

.subtask-modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s;
}

.subtask-modal-content h3 {
    margin: 0 0 10px 0;
    color: #1f2937;
    font-size: 20px;
}

.subtask-modal-content .modal-subtitle {
    margin-bottom: 20px;
    font-size: 14px;
    color: #6b7280;
}

.subtask-modal-content .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.subtask-modal-content .form-group {
    margin-bottom: 0;
}

.subtask-modal-content .form-group.full-width {
    grid-column: 1 / -1;
}

.subtask-modal-content label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #6b7280;
}

.subtask-modal-content input,
.subtask-modal-content select,
.subtask-modal-content textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
}

.subtask-modal-section-divider {
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 25px 0 15px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #e5e7eb;
    text-align: center;
}


/* ============================================
SEARCH BOX TAG AUTOCOMPLETE
============================================ */

.search-tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #667eea;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: -2px;
}

.search-tag-suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f3f4f6;
}

.search-tag-suggestion-item:last-child {
    border-bottom: none;
}

.search-tag-suggestion-item:hover {
    background: #f8f9fa;
}

.search-tag-suggestion-item.highlighted {
    background: #e7f3ff;
}

.search-tag-suggestion-item .tag-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-tag-suggestion-item .tag-count {
    font-size: 12px;
    color: #6b7280;
}

.search-container {
    position: relative;
}

/* Highlight the search input when tag suggestions are showing */
.search-container.suggesting #taskSearchInput {
    border-color: #667eea;
    border-radius: 8px 8px 0 0;
}

/* ============================================
TEMPLATE QUICK SELECT
============================================ */

.template-quick-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.template-quick-select:hover {
    border-color: #667eea;
}

.template-quick-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
/* ============================================
RECURRING TASK STYLES
============================================ */

/* Recurring task items - blue left border and light background */
.task-item.recurring-task {
    border-left: 4px solid #3b82f6;
    background-color: #eff6ff;
}

/* Recurring badge that appears next to task name */
.recurring-badge {
    display: inline-block;
    margin-right: 8px;
    font-size: 14px;
    color: #3b82f6;
    font-weight: 600;
}

/* Add 🔁 icon before the badge */
.recurring-badge::before {
    content: "🔁 ";
}

/* Optional: Hover effect for recurring tasks */
.task-item.recurring-task:hover {
    background-color: #dbeafe;
    border-left-color: #2563eb;
}

.time-estimate-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 8px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.time-estimate-badge.clickable {
    cursor: pointer !important;
}

.time-estimate-badge.clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.add-time-badge {
    background: #f9fafb;
    opacity: 0.7;
    border: 1px dashed #d1d5db;
    color: #6b7280;
}

/* Color coding by duration */
.time-quick {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.time-medium {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.time-long {
    background-color: #fed7aa;
    color: #9a3412;
    border: 1px solid #fdba74;
}

.time-verylong {
    background-color: #fecaca;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Greyed out when task completed */
.completed-task .time-estimate-badge {
    background-color: #f3f4f6;
    color: #9ca3af;
    border-color: #e5e7eb;
    opacity: 0.6;
}


/* ============================================
TIME ESTIMATE MODAL
============================================ */

.time-estimate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 20px;
    padding: 10px 0;
}

.time-estimate-option {
    padding: 16px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    background: white;
}

.time-estimate-option:hover {
    border-color: #667eea;
    background-color: #f5f7ff;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.time-estimate-option.selected {
    border-color: #667eea;
    background-color: #e0e7ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    font-weight: 600;
}

.time-option-label {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    font-size: 14px;
}

.time-option-desc {
    font-size: 11px;
    color: #6b7280;
    display: block;
    margin-top: 4px;
}

.modal-subtitle {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 10px;
    font-style: italic;
}


/* ============================================
SEARCH AUTOCOMPLETE FOR TIME ESTIMATES
============================================ */

.search-container {
    position: relative;
}

.search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 5px;
}

.time-autocomplete {
    border-color: #667eea;
}

.autocomplete-header {
    padding: 12px 16px;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    font-size: 12px;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f3f4f6;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover:not(.disabled) {
    background-color: #f9fafb;
}

.autocomplete-item.disabled {
    color: #9ca3af;
    cursor: default;
    font-style: italic;
}

.autocomplete-item.disabled:hover {
    background-color: transparent;
}

.autocomplete-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.autocomplete-label {
    flex: 1;
    font-weight: 500;
    color: #1f2937;
}

.autocomplete-count {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    flex-shrink: 0;
}


/* ============================================
MOBILE RESPONSIVE
============================================ */

@media (max-width: 768px) {
    .time-estimate-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .time-estimate-option {
        padding: 12px 8px;
    }
    
    .time-option-label {
        font-size: 13px;
    }
    
    .time-option-desc {
        font-size: 10px;
    }
    
    .time-estimate-badge {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .search-autocomplete {
        max-height: 250px;
    }
    /* Mobile task layout - badges below text */
    .task-item {
        flex-wrap: wrap;
    }

    .task-checkbox {
        order: 1;
    }

    .task-text {
        order: 2;
        flex: 1;
        min-width: 0;
    }

    .task-badges {
        order: 3;
        flex-basis: 100%;
        margin-top: 8px; /* Add some space above the badges */
        padding-left: 32px; /* Align with task text (checkbox width + gap) */
    }

    .task-tags-hover {
        order: 4;
        flex-basis: 100%;
        padding-left: 32px; /* Align with task text (checkbox width + gap) */
        margin-top: 8px;
    }

    .task-menu-trigger {
        order: 5;
        position: absolute;
        right: 12px;
        top: 12px;
    }
}

@media (max-width: 480px) {
    .time-estimate-badge {
        font-size: 10px;
        padding: 2px 6px;
        gap: 2px;
    }
}


/* ============================================
EMPTY STATE ENHANCEMENT
============================================ */

.empty-state-subtitle {
    color: #9ca3af;
    font-size: 13px;
    margin-top: 8px;
}


/* ============================================
HOVER EFFECTS
============================================ */

/* Subtle pulse animation for selected time option */
.time-estimate-option.selected {
    animation: selectedPulse 2s ease-in-out infinite;
}

@keyframes selectedPulse {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }
    50% {
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    }
}


/* ============================================
ACCESSIBILITY
============================================ */

/* Focus states for keyboard navigation */
.time-estimate-option:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.autocomplete-item:focus {
    outline: 2px solid #667eea;
    outline-offset: -2px;
    background-color: #f9fafb;
}


/* ============================================
PRINT STYLES
============================================ */

@media print {
    .time-estimate-badge {
        border: 1px solid #000;
        background: white;
        color: #000;
    }
    
    .search-autocomplete {
        display: none;
    }
}

.form-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 20px 0;
}

.info-text {
    font-size: 14px;
    color: #6b7280;
    background-color: #f3f4f6;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #9ca3af;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: #374151;
}

.modal-body .form-group {
    margin-bottom: 18px;
}

.modal-body .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.due-date-badge-container {
    display: inline-block;
    position: relative; /* Needed for the date picker to position correctly */
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.due-date-badge-container:hover {
    border-color: #667eea;
}


/* ============================================
   CARD LAYOUT EDITOR MODAL
   ============================================ */

.card-editor-panel {
    padding: 20px;
    display: flex;
    flex-direction: column;
}

#availableFieldsPanel {
    flex: 1;
    border-right: 1px solid #e5e7eb;
    background-color: #f9fafb;
}

.preview-panel {
    flex: 1.5;
    background-color: #f0f2f5; /* A slightly darker background to make the card stand out */
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-editor-panel h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.card-editor-panel .help-text {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 20px;
}

.card-editor-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-layout-field-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: white;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    cursor: grab;
    user-select: none;
    transition: all 0.2s ease;
}

.card-layout-field-item.dragging {
    opacity: 0.5;
    background-color: #e0e7ff;
    border-color: #667eea;
}

.drag-handle {
    font-size: 18px;
    color: #9ca3af;
    cursor: grab;
}

.card-layout-field-item:active {
    cursor: grabbing;
}

.card-layout-field-item .field-name {
    flex: 1;
    font-weight: 500;
}

/* Re-using the toggle switch style from settings.css */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #667eea;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

#cardLayoutPreview .task-item {
    pointer-events: none; /* Make the preview card non-interactive */
    width: 100%;
    max-width: 450px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* View Mode Header */
.view-mode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.view-mode-header h2 {
    font-size: 18px;
    color: #4b5563;
    margin: 0;
}

.project-only-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #4b5563;
}

.project-only-toggle input {
    cursor: pointer;
}

.project-only-toggle label {
    cursor: pointer;
    user-select: none;
}

/* ============================================
SCHEDULED BADGE STYLES
============================================ */

.scheduled-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background-color: #eef2ff; /* Light Indigo */
    color: #4338ca; /* Dark Indigo */
    border: 1px solid #c7d2fe;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scheduled-badge:hover {
    background-color: #c7d2fe;
    transform: scale(1.05);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
/* ============================================
   TASK CARD EXTENDED SECTION
   ============================================ */

.task-extended-section {
    flex-basis: 100%;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6; /* Use a subtle border instead of a harsh <hr> */
}

.extended-divider {
    display: none; /* Hide the old <hr> as we now use a border-top */
}

.extended-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-field-display {
    font-size: 13px;
    color: #4b5563;
}

.custom-field-display strong {
    font-weight: 600;
    color: #1f2937;
}
/* ============================================
   TASK CARD EXTENDED SECTION VISIBILITY
   ============================================ */

.task-extended-section.collapsed-on-hover {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
}

.task-extended-section.expanded {
    max-height: 500px; /* A value large enough to contain content */
    opacity: 1;
    transition: max-height 0.3s ease-in, opacity 0.3s ease-in;
}
/* ============================================
   LINKED TASKS MODAL
   ============================================ */

.linked-tasks-modal {
    z-index: 10001; /* Higher than the main edit modal */
}

.linked-task-item {
    padding: 12px 15px;
    margin: 8px 0;
    border-radius: 6px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.linked-task-item:hover {
    background-color: #e0e7ff;
    border-color: #a5b4fc;
    transform: translateX(5px);
}

.linked-task-item.parent {
    border-left: 4px solid #8b5cf6; /* Purple for parent */
}

.linked-task-item.child {
    border-left: 4px solid #22c55e; /* Green for children */
}

.linked-task-info {
    font-style: italic;
    color: #6b7280;
    padding: 10px 0;
}
/* ============================================
   MODAL TOP ACTIONS
   ============================================ */

.modal-top-actions {
    padding: 10px 25px;
    background-color: #f0f2f5; /* A very light grey to separate it */
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
    margin-bottom: 20px; /* This creates the space BELOW the buttons */
}

.modal-top-actions .secondary {
    padding: 8px 16px;
    font-size: 14px;
    background-color: white;
    border: 1px solid #d1d5db;
    color: #374151;
}

.modal-top-actions .secondary:hover {
    background-color: #f9fafb;
    border-color: #667eea;
    color: #667eea;
}
/* ============================================
   CURRENCY INPUT STYLES
   ============================================ */

.currency-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-input-wrapper .currency-symbol {
    position: absolute;
    left: 12px;
    font-size: 14px;
    color: #6b7280;
    pointer-events: none; /* Make it so you can click through the symbol */
}

.currency-input-wrapper input[type="number"] {
    padding-left: 28px; /* Add space for the currency symbol */
    width: 100%;
}
/* ============================================
   RECORD LINKING AUTOCOMPLETE
   ============================================ */

.link-autocomplete {
    position: absolute;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10002; /* Must be higher than the notes modal */
    max-height: 200px;
    overflow-y: auto;
    width: 250px;
}

.link-autocomplete .autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: background-color 0.2s;
}

.link-autocomplete .autocomplete-item:hover {
    background-color: #f3f4f6;
}

.link-autocomplete .autocomplete-item.disabled {
    color: #9ca3af;
    cursor: default;
    font-style: italic;
}
/* ============================================
   RECORD LINK STYLES
   ============================================ */

.record-link {
    background-color: #eef2ff; /* Light indigo background */
    color: #4338ca; /* Dark indigo text */
    padding: 2px 6px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid #c7d2fe;
    transition: all 0.2s ease;
}

.record-link:hover {
    background-color: #c7d2fe; /* Darker on hover */
    color: #312e81;
    border-bottom-color: #4338ca;
}

/* --- NEW: Prominent link style within task text --- */
.task-text .record-link {
    background-color: transparent;
    color: #4f46e5; /* A strong indigo */
    padding: 0;
    border-bottom: 2px solid #a5b4fc; /* A lighter indigo underline */
    font-weight: 500;
}

.task-text .record-link:hover {
    background-color: #eef2ff; /* Lightest indigo on hover */
    border-bottom-color: #4f46e5;
}

/* --- NEW: Floating 'Create Link' button --- */
.create-link-btn {
    position: absolute;
    display: none;
    background: #2c3e50; /* Dark blue/grey */
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform 0.1s ease-out;
}

.create-link-btn:hover {
    background: #34495e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}


/* Add this to your index.css file */

/* Styles for the split-view container */
.modal-split-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Add this to your index.css file */

.modal-content.is-split-view .modal-split-container {
    gap: 12px; /* This creates the space between the two panels */
    padding: 0 12px 12px 12px; /* Add some padding around the container itself */
}

.modal-content.is-split-view #modal-panel-left,
.modal-content.is-split-view #modal-panel-right {
    border: 1px solid #e5e7eb; /* Give each panel its own border */
    border-radius: 8px; /* Round the corners of each panel */
    background-color: #ffffff; /* Ensure panels have a white background */
}

/* Remove the old border that was only on the right panel */
#modal-panel-right {
    border-left: none;
}

.modal-panel {
    flex-basis: 100%; /* Keep this for the parent flex container */
    transition: all 0.3s ease-in-out;
    overflow: hidden;
    /* --- THIS IS THE CORRECT FIX --- */
    display: grid;
    grid-template-rows: auto auto 1fr auto; /* Header, Top Actions, Body (fills space), Footer */
}

/* Ensure the body and footer within panels behave correctly */
.modal-panel .modal-body {
    flex-grow: 1;
    overflow-y: auto;
    /* --- THIS IS THE FIX --- */
    padding: 0 25px; /* Add horizontal padding */
}

.modal-panel .modal-footer {
    flex-shrink: 0;
    /* --- THIS IS THE FIX --- */
    padding: 20px 25px; /* Add consistent padding */
}

/* Close button for the right panel */
.close-right-panel-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e5e7eb;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 20px;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    z-index: 10;
}
.close-right-panel-btn:hover {
    background: #d1d5db;
}

.modal-content.is-split-view {
    max-width: 1600px;
}

/* ============================================
   CLOSE BOTH PANELS BUTTON
   ============================================ */

.close-both-panels-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20; /* Above the panels but below the modal content if needed */
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #ef4444; /* Red to signify a closing action */
    color: white;
    border: 2px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-size: 28px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
    pointer-events: none;
}

.modal-content.is-split-view .close-both-panels-btn {
    opacity: 1;
    pointer-events: auto;
}

.close-both-panels-btn:hover {
    background-color: #dc2626; /* Darker red on hover */
    transform: translate(-50%, -50%) scale(1.1);
}

/* ============================================
   MIX SESSIONS MODAL
   ============================================ */

.session-checklist {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 40vh;
    overflow-y: auto;
    padding: 5px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background-color: #f9fafb;
}

.session-checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background-color 0.2s;
}

.session-checklist-item:hover {
    background-color: #f0f9ff;
}

.session-checklist-item.disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.7;
}

.session-checklist-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* ============================================
   MIXED SESSION VIEW UI
   ============================================ */

.mixed-session-banner {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%); /* Purple/Indigo gradient */
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(139, 92, 246, 0.3);
    animation: slideDown 0.3s ease-out;
}

.mixed-session-banner .clear-search-btn {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.task-session-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    background-color: #f3f4f6;
    color: #4b5563;
    margin-right: 8px;
}

/* ============================================ */
/* REPORT BUILDER MODAL STYLES
/* ============================================ */

.report-builder-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    flex-grow: 1;
}

.report-builder-panel {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.report-builder-panel h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 10px;
}

.report-builder-panel .help-text {
    font-size: 12px;
    color: #6b7280;
    margin-top: -10px;
}

.report-builder-toggle {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}
.sort-control {
    display: flex;
    gap: 10px;
}

.sort-control select {
    width: 100%;
}

/* Re-using styles from card layout editor */
.card-editor-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
}

.card-layout-field-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: grab;
}

.card-layout-field-item.dragging {
    opacity: 0.5;
    background: #f0f9ff;
}

.card-layout-field-item .field-name {
    flex-grow: 1;
}

.remove-field-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 18px;
    padding: 0 5px;
}

.remove-field-btn:hover {
    color: #ef4444;
}

.add-field-container {
    margin-top: 10px;
    border-top: 1px dashed #d1d5db;
    padding-top: 15px;
}

/* ============================================ */
/* SESSION MANAGEMENT MODAL STYLES
/* ============================================ */

#sessionManagementModal .modal-content {
    max-width: 500px;
    border-radius: 16px;
    padding: 30px;
}

#sessionManagementModal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 16px 16px 0 0;
    margin-bottom: 20px;
    border-bottom: none;
}

#sessionManagementModal .modal-close {
    color: white;
    opacity: 0.8;
}

/* Style for the email button on scratch_process.html */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header .email-btn {
    background: #0ea5e9; /* A nice sky blue */
}
.page-header .email-btn:hover {
    background: #0284c7;
}

/* ============================================ */
/* ADD TO EXISTING TASK STYLES
/* ============================================ */

.scratch-actions .add-to-task-btn {
    background-color: #10b981; /* Green */
    border-color: #059669;
}

.scratch-actions .add-to-task-btn:hover {
    background-color: #059669;
}

#addToTaskModal .modal-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin-top: -15px;
    margin-bottom: 20px;
}

/* Make the parent container relative for positioning the dropdown */
#addToTaskModal .input-group {
    position: relative;
}

/* Make the parent container relative for positioning the dropdown in the new linking modal */
#recordLinkingModal .form-group {
    position: relative;
}

.searchable-dropdown {
    position: absolute;
    top: 100%; /* Position it right below the input group */
    left: 0;
    right: 0;
    z-index: 1000; /* Ensure it appears above other content */
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    margin-top: 2px; /* A small gap from the input box */
    background-color: #ffffff; /* A clean white background */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* Add depth */
}

.searchable-dropdown-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    transition: background-color 0.2s;
}

.searchable-dropdown-item:last-child {
    border-bottom: none;
}

.searchable-dropdown-item:hover {
    background-color: #eef2ff;
    color: #4338ca;
}

#sessionManagementModal .modal-body {
    padding: 0;
}

#sessionManagementModal .input-group {
    margin-bottom: 20px;
}

#sessionManagementModal .input-group label {
    display: block;
    margin-bottom: 8px;
    color: #6b7280;
    font-weight: 500;
    font-size: 14px;
}

#sessionManagementModal .input-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

#sessionManagementModal .input-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

#sessionManagementModal .session-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#sessionManagementModal .session-controls button {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
}


/* ============================================ */
/* REPORT VIEW STYLES
/* ============================================ */

.report-container {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    font-family: 'Segoe UI', sans-serif;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.report-title {
    font-size: 28px;
    font-weight: 600;
    color: #1f2937;
    margin: 0; /* Removed margin and border, now handled by .report-header */
}

.close-report-btn {
    padding: 8px 16px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.report-group-header {
    font-size: 20px;
    font-weight: 600;
    color: #4338ca; /* Indigo */
    margin-top: 30px;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #eef2ff;
    border-left: 4px solid #6366f1;
    border-radius: 0 8px 8px 0;
}

.report-record {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: box-shadow 0.2s;
}

.report-record:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.report-field {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    font-size: 14px;
}

.report-field:not(:last-child) {
    border-bottom: 1px solid #f3f4f6;
}

.report-field-label {
    flex: 0 0 150px; /* Fixed width for labels */
    font-weight: 600;
    color: #4b5563;
}

.report-field-value {
    flex: 1;
    color: #1f2937;
    white-space: pre-wrap; /* Respect newlines in values */
}

/* ============================================ */
/* EMAIL TO MIND DUMP SETTINGS STYLES
/* ============================================ */

#emailToMindDumpSection .setting-item {
    padding: 15px;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 15px;
}

#emailToMindDumpSection .setting-item h3 {
    margin-top: 0;
    color: #374151;
    font-size: 16px;
}

#emailToMindDumpSection .setting-item p {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 10px;
}

#emailToMindDumpSection .share-link-container {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

#emailToMindDumpSection .share-link-container input {
    flex-grow: 1;
    background-color: #f3f4f6;
    color: #4b5563;
    border: 1px solid #d1d5db;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
}

#emailToMindDumpSection .share-link-container button {
    flex-shrink: 0;
    padding: 8px 15px;
    background-color: #4f46e5;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

/* Admin Email Settings */
#adminSettingsView .rule-form {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
}

#adminSettingsView .rule-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

#adminSettingsView .rule-form-group {
    flex: 1;
}

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

#adminSettingsView .rule-form-group input[type="text"],
#adminSettingsView .rule-form-group input[type="email"],
#adminSettingsView .rule-form-group input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

#adminSettingsView .rule-form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

#adminSettingsView .rule-form-actions {
    margin-top: 20px;
    text-align: right;
}

#adminSettingsView .rule-form-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

/* Manage User Inboxes Modal */
#manageUserInboxesModal .modal-content {
    max-width: 900px;
}

#manageUserInboxesModal .tags-management-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

#manageUserInboxesModal .tags-management-table th,
#manageUserInboxesModal .tags-management-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

#manageUserInboxesModal .tags-management-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

#manageUserInboxesModal .tags-management-table tr:hover {
    background: #f8f9fa;
}

#manageUserInboxesModal .tags-management-table code {
    background-color: #eef2ff;
    color: #4338ca;
    padding: 3px 6px;
    border-radius: 4px;
    font-family: monospace;
}
