/* ========================================================================
   modal.css - Modals & Dropdowns
   Activity modal, forms, searchable dropdown, multi-select dropdown,
   assignees popover, print modal, comments modal.
   ======================================================================== */

/* ========================================================================
   NEW ACTIVITY MODAL
   ======================================================================== */
.new-activity-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.new-activity-modal.active {
    display: flex;
}

.new-activity-content {
    background: white;
    padding: 20px 24px;
    max-width: 520px;
    width: 90%;
    border: 1px solid var(--gray-200);
}

.new-activity-content h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--gray-900);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.form-row {
    display: flex;
    gap: 12px;
}

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

.new-activity-content .form-group {
    margin-bottom: 10px;
}

.new-activity-content .form-group label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.new-activity-content .form-group label .required {
    color: var(--danger);
}

.new-activity-content .form-group input,
.new-activity-content .form-group select,
.new-activity-content .form-group textarea {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--gray-300);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    color: var(--gray-800);
    transition: var(--transition);
}

.new-activity-content .form-group textarea {
    resize: vertical;
    min-height: 60px;
    line-height: 1.4;
}

.new-activity-content .form-group input:focus,
.new-activity-content .form-group select:focus,
.new-activity-content .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-200);
}

/* ========================================================================
   SEARCHABLE DROPDOWN
   ======================================================================== */
.searchable-dropdown {
    position: relative;
}

.searchable-dropdown .sd-search {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    color: var(--gray-800);
    transition: var(--transition);
}

.searchable-dropdown .sd-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.searchable-dropdown .sd-search:disabled {
    background: var(--gray-100);
    color: var(--gray-400);
    cursor: not-allowed;
}

.searchable-dropdown .sd-search.has-value {
    font-weight: 500;
    color: var(--gray-900);
}

.sd-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--gray-300);
    border-top: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.sd-list.show {
    display: block;
}

.sd-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
}

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

.sd-item:hover {
    background: var(--gray-50);
}

.sd-item .sd-primary {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-800);
    line-height: 1.3;
}

.sd-item .sd-secondary {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    margin-top: 2px;
    line-height: 1.3;
}

.sd-item:hover .sd-secondary {
    color: var(--gray-600);
}

.sd-no-results {
    padding: 12px;
    font-size: var(--font-size-sm);
    color: var(--gray-400);
    font-style: italic;
    text-align: center;
}

/* ========================================================================
   MULTI-SELECT DROPDOWN
   ======================================================================== */
.multi-select-dropdown {
    position: relative;
}

.multi-select-dropdown .ms-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 3px;
    min-height: 0;
}

.multi-select-dropdown .ms-chips:empty {
    display: none;
}

.ms-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: var(--font-size-xs);
    font-weight: 500;
    white-space: nowrap;
}

.ms-chip-remove {
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    color: var(--gray-500);
    margin-left: 2px;
}

.ms-chip-remove:hover {
    color: var(--danger);
}

.multi-select-dropdown .ms-search {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--gray-300);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    color: var(--gray-800);
    transition: var(--transition);
}

.multi-select-dropdown .ms-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary-light);
}

.ms-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--gray-300);
    border-top: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.ms-list.show {
    display: block;
}

.ms-item {
    padding: 5px 10px;
    cursor: pointer;
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--gray-100);
}

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

.ms-item:hover {
    background: var(--gray-50);
}

.ms-item.ms-selected {
    background: var(--primary-bg);
    font-weight: 500;
}

.ms-item .ms-check {
    width: 14px;
    height: 14px;
    border: 1px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}

.ms-item.ms-selected .ms-check {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.ms-no-results {
    padding: 10px;
    font-size: var(--font-size-sm);
    color: var(--gray-400);
    font-style: italic;
    text-align: center;
}

/* ========================================================================
   ASSIGNEES POPOVER MODAL
   ======================================================================== */
.assignees-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.assignees-modal.active {
    display: flex;
}

.assignees-modal-content {
    background: white;
    max-width: 400px;
    width: 90%;
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
}

.assignees-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-200);
}

.assignees-modal-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
}

.assignees-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.assignees-modal-close:hover {
    color: var(--gray-700);
}

.assignees-modal-body {
    padding: 12px 14px;
}

.assignees-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding: 10px 14px;
    border-top: 1px solid var(--gray-200);
}

/* ========================================================================
   PRINT MODAL
   ======================================================================== */
.print-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.print-modal.active {
    display: flex;
}

.print-modal-content {
    background: white;
    padding: 24px 28px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    border: 1px solid var(--gray-200);
}

.print-modal h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--gray-900);
}

.print-modal p {
    color: var(--gray-500);
    font-size: var(--font-size-sm);
    margin-bottom: 20px;
}

.print-options {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.print-option {
    padding: 16px 28px;
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: var(--transition);
}

.print-option:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.print-option .icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.print-option .label {
    font-size: var(--font-size-base);
    font-weight: 500;
}

.print-modal-close {
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    font-size: var(--font-size-base);
    font-family: var(--font-family);
}

.print-modal-close:hover {
    color: var(--gray-700);
}

/* ========================================================================
   COMMENTS MODAL
   ======================================================================== */
.comments-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.comments-modal.active {
    display: flex;
}

.comments-modal-content {
    background: white;
    max-width: 520px;
    width: 90%;
    max-height: 80vh;
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
}

.comments-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
}

.comments-modal-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
}

.comments-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.comments-modal-close:hover {
    color: var(--gray-700);
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
    min-height: 120px;
    max-height: 50vh;
}

.comment-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
}

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

.comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.comment-author {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--gray-700);
}

.comment-date {
    font-size: var(--font-size-xs);
    color: var(--gray-400);
}

.comment-text {
    font-size: var(--font-size-sm);
    color: var(--gray-800);
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.comments-empty {
    padding: 24px 12px;
    text-align: center;
    color: var(--gray-400);
    font-size: var(--font-size-sm);
}

.comments-loading {
    padding: 24px 12px;
    text-align: center;
    color: var(--gray-400);
    font-size: var(--font-size-sm);
}

.comments-input-row {
    display: flex;
    gap: 6px;
    padding: 10px 16px;
    border-top: 1px solid var(--gray-200);
}

.comments-input-row input {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid var(--gray-300);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    color: var(--gray-800);
    transition: var(--transition);
}

.comments-input-row input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary-light);
}

.comments-input-row .btn {
    flex-shrink: 0;
}
