/* style.css - Contains all styles for the Sales Task Assignment application */
:root {
    --font-family: 'Figtree', sans-serif;
    --text-color: #323338;
    --setting-btn-bg: #ABABAB;
    --blue-btn-bg: #0073EA;
    --blue-btn-border: #0060B9;
    --task-bg: #F4F6F8;
    --save-btn-bg: #258750;
    --save-btn-border: #007038;
    --delete-btn-bg: #FCEBA1;
    --edit-duplicate-icon-color: #676879;
    --pill-bg: #FFFFFF;
    --pill-border-color: #D0D0D0;
    --pill-border-weight: 0.5px;
    --green-line: var(--save-btn-bg); 
    --white-color: #FFFFFF;
    --light-grey-border: #E0E0E0;
    --medium-grey-text: #555555;
    --body-bg: #E9EFF3;
    --header-bg: var(--white-color);
    --section-border: #D1D9E0;
    --user-select-hover-bg: #f0f0f0;
}

body {
    font-family: var(--font-family); color: var(--text-color);
    margin: 0; background-color: var(--body-bg); line-height: 1.6;
}

.app-container {
    max-width: 1000px; margin: 0 auto; background-color: var(--white-color);
    min-height: 100vh; box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

header {
    padding: 15px 30px; display: flex; justify-content: space-between;
    align-items: center; border-bottom: 1px solid var(--light-grey-border);
}
header h1 { margin: 0; font-size: 1.8em; }

.settings-container { position: relative; }
.settings-btn {
    background-color: var(--setting-btn-bg); color: var(--text-color); border: none;
    padding: 8px 12px; border-radius: 6px; cursor: pointer; font-family: var(--font-family);
    font-size: 0.9em; display: flex; align-items: center; gap: 6px;
}
.settings-btn .btn-icon { width: 18px; height: 18px; fill: var(--text-color); }
.settings-btn svg.dropdown-arrow { transition: transform 0.2s ease-in-out; }
.settings-btn.open svg.dropdown-arrow { transform: rotate(180deg); }

.settings-dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 5px);
    background-color: var(--white-color); border: 1px solid var(--light-grey-border);
    border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100; min-width: 160px; overflow: hidden;
}
.settings-dropdown a { display: block; padding: 10px 15px; text-decoration: none; color: var(--text-color); font-size: 0.9em; }
.settings-dropdown a:hover { background-color: var(--task-bg); }

main { padding: 20px 30px; }

.btn {
    font-family: var(--font-family); padding: 10px 18px; border-radius: 6px;
    cursor: pointer; font-size: 0.95em; border: 1px solid transparent;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; transition: background-color 0.2s ease, border-color 0.2s ease;
}
.btn .btn-icon { width: 16px; height: 16px; fill: currentColor; }

.btn-primary { background-color: var(--blue-btn-bg); border-color: var(--blue-btn-border); color: var(--white-color); }
.btn-primary:hover { background-color: #0056a0; border-color: #00427e; }
.btn-save { background-color: var(--save-btn-bg); border-color: var(--save-btn-border); color: var(--white-color); }
.btn-save:hover { background-color: #1e6a3f; border-color: #00582c; }

#assignUserBtn { margin-bottom: 25px; }

.user-section { border: 1px solid var(--section-border); border-radius: 8px; padding: 20px; margin-bottom: 25px; }
.user-section-header { margin-bottom: 10px; }
.user-select-wrapper { position: relative; display: inline-block; }
.user-select {
    padding: 8px 30px 8px 12px; border-radius: 6px; border: none;
    font-family: var(--font-family); font-size: 1.2em; font-weight: 600;
    min-width: 150px; background-color: transparent; cursor: pointer;
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
}
.user-select-wrapper:hover .user-select { background-color: var(--user-select-hover-bg); }
.user-select-arrow { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; width: 12px; height: 8px; }
.user-select-arrow path { stroke: var(--text-color); }

.pill-menu-area { margin-bottom: 15px; }
.pill-menu-toggle-btn {
    background: none; border: none; cursor: pointer; padding: 5px 0;
    color: var(--medium-grey-text); display: inline-block; margin-bottom: 8px;
}
.pill-menu-toggle-btn:hover { color: var(--text-color); }
.draggable-pills-menu {
    display: flex; flex-wrap: wrap; gap: 10px; padding: 12px;
    border: 1px dashed var(--light-grey-border); border-radius: 6px; background-color: #f9fafb;
}
.draggable-pills-menu .pill { cursor: grab; padding: 8px 16px; }

.tasks-container { margin-bottom: 20px; }
.task-row {
    background-color: var(--task-bg); border-radius: 6px; padding: 12px 15px;
    margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between;
    position: relative; border: 1px solid var(--light-grey-border);
}
.task-row.saved .task-saved-indicator { display: block; }
.task-saved-indicator { display: none; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background-color: var(--green-line); border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.task-content-wrapper { display: flex; align-items: center; gap: 15px; flex-grow: 1; }
.task-label { font-weight: 600; min-width: 70px; white-space: nowrap; }
.task-details-area { flex-grow: 1; }

.task-row.saved .task-pills-container-wrapper { display: none !important; }
.task-row:not(.saved) .task-pills-container-wrapper { display: block !important; }
.task-row.saved .task-display-saved-value { display: block !important; }
.task-row:not(.saved) .task-display-saved-value { display: none !important; }

.task-pills-container { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.pill { /* Pill itself needs to be a positioning context for its dropdown */
    position: relative; 
    background-color: var(--pill-bg); border: var(--pill-border-weight) solid var(--pill-border-color);
    color: var(--text-color); padding: 7px 14px; border-radius: 15px;
    font-size: 0.85em; cursor: pointer; display: inline-flex; align-items: center;
    white-space: nowrap; transition: box-shadow 0.2s ease;
}
.pill:hover { box-shadow: 0 0 0 2px var(--blue-btn-border); }
.pill.sortable-ghost { opacity: 0.4; background-color: #e0eaff; }
.pill-value { font-weight: 500; }
.pill-value:empty::before { content: attr(data-placeholder); color: var(--medium-grey-text); font-style: italic; }
.pill .pill-dropdown-icon { margin-left: 5px; font-size: 0.8em; }
.task-display-saved-value { font-size: 0.9em; color: var(--medium-grey-text); text-align: left; white-space: normal; }

.task-actions { display: flex; gap: 8px; margin-left: 15px; flex-shrink: 0; }
.task-action-btn { background: none; border: none; cursor: pointer; padding: 5px; display: flex; align-items: center; justify-content: center; border-radius: 4px; width: 30px; height: 30px; }
.task-action-btn svg { width: 18px; height: 18px; fill: currentColor; }
.task-action-btn.delete-btn { background-color: var(--delete-btn-bg); color: #8c6d00;}
.task-action-btn.save-task-btn { background-color: var(--save-btn-bg); color: var(--white-color); }
.task-action-btn.edit-task-btn, .task-action-btn.duplicate-task-btn { color: var(--edit-duplicate-icon-color); }
.task-action-btn:hover { opacity: 0.8; }

.add-tasks-controls { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.add-tasks-controls span { font-size: 0.9em; }
.add-tasks-input { width: 50px; padding: 8px; border-radius: 4px; border: 1px solid var(--light-grey-border); text-align: center; font-family: var(--font-family); }
.add-tasks-controls .btn-primary { padding: 6px 10px; }

.section-footer-controls { display: flex; justify-content: space-between; align-items: center; padding-top: 15px; border-top: 1px solid var(--light-grey-border); }
.schedule-control-wrapper { display: flex; align-items: center; gap: 8px; }
.schedule-label { font-size: 0.9em; font-weight: 500; }
.schedule-button-group { display: flex; border-radius: 6px; overflow: hidden; border: 1px solid var(--blue-btn-border); }
.schedule-date-input { padding: 8px 12px; border: none; background-color: var(--blue-btn-bg); color: var(--white-color); font-family: var(--font-family); font-size: 0.95em; width: 120px; text-align: center; outline: none; }
.schedule-date-input::placeholder { color: rgba(255,255,255,0.7); }
.calendar-icon-btn {
    background-color: var(--blue-btn-bg); border-left: 1px solid var(--blue-btn-border);
    color: var(--white-color); padding: 8px 10px; border-radius: 0;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    border-top: none; border-bottom: none; border-right: none; /* Remove unwanted borders */
    outline: none; /* Remove focus outline */
}
.calendar-icon-btn .btn-icon { width: 18px; height: 18px; fill: currentColor; }
.schedule-button-group:hover .schedule-date-input,
.schedule-button-group:hover .calendar-icon-btn { background-color: #0056a0; }

/* Modals */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); }
.modal-content { background-color: var(--white-color); margin: 10% auto; padding: 25px; border: 1px solid var(--light-grey-border); border-radius: 8px; width: 80%; max-width: 500px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); position: relative; }
.modal-content h2 { margin-top: 0; margin-bottom: 20px; }
.close-btn { color: var(--medium-grey-text); position: absolute; top: 15px; right: 20px; font-size: 28px; font-weight: bold; cursor: pointer; }
.close-btn:hover, .close-btn:focus { color: var(--text-color); }
.modal-list { margin-bottom: 20px; max-height: 300px; overflow-y: auto; }
.modal-list-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--light-grey-border); }
.modal-list-item:last-child { border-bottom: none; }
.modal-list-item .item-name-display, .modal-list-item input[type="text"].edit-item-input { flex-grow: 1; padding: 6px 0px; font-size: 1em; }
.modal-list-item input[type="text"].edit-item-input { border: 1px solid var(--light-grey-border); border-radius: 4px; font-family: var(--font-family); padding: 6px 8px; }
.modal-item-actions button { background: none; border: none; cursor: pointer; margin-left: 8px; color: var(--medium-grey-text); padding: 5px; display: flex; align-items: center; justify-content: center; }
.modal-item-actions button svg { width: 16px; height: 16px; fill: currentColor; }
.modal-item-actions button:hover { color: var(--text-color); }
.modal-item-actions .delete-item-btn:hover { color: #d9534f; }
.modal-item-actions .save-item-btn:hover { color: var(--save-btn-bg); }
.modal-add-item { display: flex; gap: 10px; margin-top: 15px; }
.modal-add-item input[type="text"] { flex-grow: 1; padding: 10px; border-radius: 6px; border: 1px solid var(--light-grey-border); font-family: var(--font-family); }

/* Pill specific dropdowns positioning */
.pill-dropdown-content, 
.date-range-picker-dropdown, 
.notes-textarea-dropdown, 
.quota-input-dropdown {
    position: absolute; /* Positioned relative to the .pill */
    top: 100%; /* Start below the pill */
    left: 0; /* Align with the left edge of the pill */
    margin-top: 5px; /* Small gap below the pill */
    background-color: var(--white-color);
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 20; /* Ensure dropdown is on top */
    border-radius: 6px;
    border: 1px solid var(--light-grey-border);
    display: none; /* Hidden by default */
}
.pill-dropdown-content.active, 
.date-range-picker-dropdown.active, 
.notes-textarea-dropdown.active, 
.quota-input-dropdown.active { display: block; }

.pill-dropdown-content { min-width: 160px; padding: 5px 0; max-height: 200px; overflow-y: auto; }
.pill-dropdown-content div, .pill-dropdown-content a { color: var(--text-color); padding: 8px 12px; text-decoration: none; display: block; cursor: pointer; font-size: 0.9em; }
.pill-dropdown-content div:hover, .pill-dropdown-content a:hover { background-color: var(--task-bg); }

.date-range-picker-dropdown { padding: 15px; min-width: 250px; /* Ensure enough width for two calendars if side-by-side */ }
.date-range-picker-dropdown div { margin-bottom: 10px; }
.date-range-picker-dropdown label { display: block; margin-bottom: 5px; font-size: 0.85em; font-weight: 500; }
.date-range-picker-dropdown input[type="text"] { width: calc(100% - 16px); padding: 8px; border: 1px solid var(--light-grey-border); border-radius: 4px; font-family: var(--font-family); }
.date-range-picker-dropdown .apply-date-range-btn { margin-top: 10px; width: 100%; }

.notes-textarea-dropdown { padding: 10px; }
.notes-textarea-dropdown textarea { width: 250px; height: 100px; padding: 8px; border: 1px solid var(--light-grey-border); border-radius: 4px; font-family: var(--font-family); resize: vertical; }
.notes-textarea-dropdown .apply-notes-btn { margin-top: 10px; width: 100%; }

.quota-input-dropdown { padding: 10px; }
.quota-input-dropdown input[type="number"] { width: 100px; padding: 8px; border: 1px solid var(--light-grey-border); border-radius: 4px; font-family: var(--font-family); }
.quota-input-dropdown .apply-quota-btn { margin-top: 10px; width: 100%; }

/* Flatpickr calendar specific styling if needed (ensure it's above other elements) */
.flatpickr-calendar {
    z-index: 1050 !important; /* High z-index for flatpickr */
}

/* Task Success Pop-up Styles */
.task-success-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Ensure it's on top */
    font-family: 'Figtree', sans-serif;
}

.task-success-card {
    background-color: #ffffff;
    border-radius: 24px;
    padding: 48px;
    max-width: 420px;
    width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.05);
}

.task-success-card .card-icon { /* Specific to this card's icon */
    margin-bottom: 24px;
}

.task-success-card .card-heading {
    font-family: 'Figtree', sans-serif;
    font-weight: 700;
    font-size: 34px;
    color: #1f2937;
    margin: 0 0 16px 0;
}

.task-success-card .card-subtext {
    font-family: 'Figtree', sans-serif;
    font-weight: 400;
    font-size: 18px;
    color: #4b5563;
    line-height: 1.6;
    margin: 0 0 32px 0;
}

.task-success-card .card-button {
    font-family: 'Figtree', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: #6366F1;
    background-color: #E0E7FF;
    border: none;
    border-radius: 12px;
    padding: 14px 40px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

.task-success-card .card-button:hover {
    background-color: #C7D2FE;
}

/* Custom Loader Styles */
#customLoader .container { /* Adjusted selector to be more specific */
  width: 200px;
  height: 200px;
  position: absolute; /* Will be relative to #customLoader if #customLoader is positioned */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: auto;
  filter: url("#goo");
  animation: rotate-move 2s ease-in-out infinite;
}

#customLoader .dot { /* Adjusted selector */
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background-color: #000;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
}

#customLoader .dot-3 { /* Adjusted selector */
  background-color: #ff1717;
  animation: dot-3-move 2s ease infinite, index 6s ease infinite;
}

#customLoader .dot-2 { /* Adjusted selector */
  background-color: #0051ff;
  animation: dot-2-move 2s ease infinite, index 6s -4s ease infinite;
}

#customLoader .dot-1 { /* Adjusted selector */
  background-color: #ffc400;
  animation: dot-1-move 2s ease infinite, index 6s -2s ease infinite;
}

/* Position #customLoader itself if it's meant to be a full-screen overlay */
/* This is important if the .container inside it is position: absolute */
#customLoader {
    position: fixed; /* Cover the whole viewport */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7); /* Optional: semi-transparent background */
    z-index: 2000; /* Ensure it's above other content, including the success popup if needed */
    display: none; /* Initially hidden - will be controlled by JS */
}


@keyframes dot-3-move {
  20% {
    transform: scale(1);
  }
  45% {
    transform: translateY(-18px) scale(0.45);
  }
  60% {
    transform: translateY(-90px) scale(0.45);
  }
  80% {
    transform: translateY(-90px) scale(0.45);
  }
  100% {
    transform: translateY(0px) scale(1);
  }
}

@keyframes dot-2-move {
  20% {
    transform: scale(1);
  }
  45% {
    transform: translate(-16px, 12px) scale(0.45);
  }
  60% {
    transform: translate(-80px, 60px) scale(0.45);
  }
  80% {
    transform: translate(-80px, 60px) scale(0.45);
  }
  100% {
    transform: translateY(0px) scale(1);
  }
}

@keyframes dot-1-move {
  20% {
    transform: scale(1);
  }
  45% {
    transform: translate(16px, 12px) scale(0.45);
  }
  60% {
    transform: translate(80px, 60px) scale(0.45);
  }
  80% {
    transform: translate(80px, 60px) scale(0.45);
  }
  100% {
    transform: translateY(0px) scale(1);
  }
}

@keyframes rotate-move {
  55% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  80% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes index {
  0%,
  100% {
    z-index: 3;
  }
  33.3% {
    z-index: 2;
  }
  66.6% {
    z-index: 1;
  }
}