/* --- Tasker Main Page Styles --- */

/* NEW: Styles for the combined single-row header */
.tasker-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem; /* Space between items */
    margin-bottom: 1.5rem;
    flex-wrap: wrap; /* Allows wrapping on smaller screens */
}

.tasker-main-header h2 {
    flex-shrink: 0; /* Prevents the title "Tasker" from shrinking */
    margin: 0;
    font-size: 1.75rem; /* Slightly larger title */
}

.tasker-search-container {
    position: relative;
    flex-grow: 1; /* Allows search bar to take available space */
    max-width: 450px; /* Prevents it from becoming too wide */
}

.tasker-search-container input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.5rem; /* Left padding for the icon */
    border: 1px solid #ced4da;
    border-radius: 2rem; /* Pill shape for a modern look */
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.tasker-search-container input:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.tasker-search-container .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af; /* A neutral gray */
    pointer-events: none;
}

#create-new-task-button {
    flex-shrink: 0; /* Prevents the button from shrinking */
}

/* Responsive adjustments for the new header */
@media (max-width: 768px) {
    .tasker-main-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    .tasker-search-container {
        order: 2; /* Puts search below title on mobile */
        max-width: none;
    }
    #create-new-task-button {
        order: 3; /* Puts button at the bottom on mobile */
    }
    .tasker-main-header h2 {
        order: 1;
        text-align: center;
    }
}


/* --- Tasker Modal Styles (Mostly Unchanged) --- */

#tasker-modal {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.tasker-modal-content {
    background-color: #fff;
	padding: 10px;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Allow vertical scrolling */
}

.tasker-modal-header {
	border-radius: 10px;
	margin-bottom: 10px;
    padding: 10px;
    background-color: #000;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#tasker-modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
}

.tasker-modal-body {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.tasker-modal-body > *:first-child {
    overflow-y: auto;
}

@media (max-width: 992px) {
    .tasker-modal-body {
        grid-template-columns: 1fr;
    }
}


.tasker-modal-footer {
    padding: 1rem 1.5rem;
    background-color: #ffffff;
    border-top: 1px solid #dee2e6;
    display: flex;
	justify-content: center; /* Center horizontally */
    gap: 0.75rem;
    flex-shrink: 0;
}

.tasker-modal-card {
    background: #d0d3d4;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* For Safari */
    border-radius: 16px; 
    padding: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1); /* Softer, deeper shadow */
    border: 1px solid var(--card-border-color);
    position: relative;
    z-index: 0;
}

.tasker-modal-card h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.tasker-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.tasker-input, .tasker-select {
    width: 100%;
	min-height: 3.5em;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.tasker-input:focus, .tasker-select:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

/* Inline Add for Selects */
.inline-add-group {
    display: flex;
    gap: 0.5rem;
}
.inline-add-btn {
    flex-shrink: 0;
    padding: 0 0.75rem;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}
.inline-add-btn:hover {
    background-color: #5a6268;
}

/* User search dropdown */
#tasker-assign-user-results {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    width: 100%;
    z-index: 105; /* Above modal body */
    max-height: 200px;
    overflow-y: auto;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.user-search-result-item {
    padding: 0.75rem;
    cursor: pointer;
}
.user-search-result-item:hover {
    background-color: #f0f0f0;
}
#tasker-assigned-users-list .assigned-user-pill {
    display: inline-flex;
    align-items: center;
    background-color: #e0e7ff;
    color: #4338ca;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    margin: 0.2rem;
}
#tasker-assigned-users-list .assigned-user-pill button {
    margin-left: 0.5rem;
    background: none;
    border: none;
    color: #4338ca;
    cursor: pointer;
    opacity: 0.7;
}
#tasker-assigned-users-list .assigned-user-pill button:hover {
    opacity: 1;
}

/* --- Tasker Table & Delete Modal --- */

#tasker-table {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

#tasker-table th {
    color: #1f2937 !important;
    font-weight: 700;
    background-color: #f9fafb;
    text-align: center;
    vertical-align: middle;
}

#tasker-table tr {
    border: 1px solid #e5e7eb;
    color: #1f2937 !important;
    font-weight: 500;
    background-color: #fff;
    text-align: center;
    vertical-align: middle;
}

#tasker-table td {
    border: 1px solid #e5e7eb;
    color: #1f2937 !important;
    font-weight: 500;
    background-color: #fff;
    text-align: center;
    vertical-align: middle;
}

#tasker-table .task-id-item {
    display: inline-block;
    font-weight: 400;
    color: #000;
    background-color: #e0f4f6;
    text-decoration: none;
    margin-top: 10px;
	padding: 3px 5px;
    border-radius: 5px;
    font-size: 0.95em;
    transition: background 0.2s;
}

#tasker-table .task-id-link {
    display: inline-block;
    font-weight: 600;
    color: #fff;
    background-color: #000;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.95em;
    transition: background 0.2s;
}
#tasker-table .task-id-link:hover {
    background-color: #d0e7ff;
}

#tasker-delete-modal .modal-content {
    max-width: 450px;
    text-align: center;
}
#tasker-delete-modal-body i {
    font-size: 3rem;
    color: #dc3545;
    margin-bottom: 1rem;
}
#tasker-delete-confirm-btn {
    background-color: #dc3545;
    color: white;
}
#tasker-delete-confirm-btn:hover {
    background-color: #c82333;
}

/* ======================================================= */
/* NEW: Advanced Attachment Styles for Tasker
/* ======================================================= */

.tasker-attachments-section h4 {
    margin-bottom: 0.75rem;
}

.tasker-upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background-color: #f9fafb;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
    margin-bottom: 1rem;
}

.tasker-upload-area.dragover {
    background-color: #eef2ff;
    border-color: #6366f1;
}

.tasker-upload-area button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.tasker-attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.25rem;
}

.tasker-attachment-thumb {
    position: relative;
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tasker-attachment-thumb:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.thumb-preview {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
}
.thumb-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.thumb-preview i {
    font-size: 2.5rem;
    color: #9ca3af;
}

.thumb-details {
    padding: 0.5rem;
    flex-shrink: 0;
    background-color: #fff;
    border-top: 1px solid #e5e7eb;
}

.thumb-filename {
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.thumb-filename a {
    text-decoration: none;
    color: inherit;
}
.thumb-filename a:hover {
    color: #4f46e5;
    text-decoration: underline;
}

.thumb-filesize {
    font-size: 0.7rem;
    color: #6b7280;
}

.thumb-delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    font-size: 0.8rem;
}
.tasker-attachment-thumb:hover .thumb-delete-btn {
    opacity: 1;
}
.thumb-delete-btn:hover {
    background-color: #ef4444;
}

/* ============================================= */
/* Creatable Searchable Dropdown
/* ============================================= */
.creatable-dropdown-wrapper {
    position: relative;
}

.creatable-dropdown-input {
    width: 100%;
    padding-right: 30px !important;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
}

.creatable-dropdown-panel {
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    z-index: 10000;
    max-height: 200px;
    overflow-y: auto;
}

.creatable-dropdown-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.creatable-dropdown-item, .creatable-dropdown-create-btn {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.creatable-dropdown-item:hover, .creatable-dropdown-create-btn:hover {
    background-color: #f3f4f6;
}
.creatable-dropdown-item.is-focused, .creatable-dropdown-create-btn.is-focused {
    background-color: #e5e7eb;
}

.creatable-dropdown-create-btn {
    color: #1e40af;
    font-weight: 500;
    border-top: 1px solid #e5e7eb;
}

.creatable-dropdown-create-btn span {
    font-style: italic;
    font-weight: bold;
}

.creatable-dropdown-no-results {
    padding: 1rem;
    text-align: center;
    color: #6b7280;
    font-style: italic;
}

.hidden {
    display: none !important;
}

/* ======================================================= */
/* TASKER ATTACHMENT VIEWER (SLIDER)
/* ======================================================= */

.tasker-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.tasker-viewer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.tasker-viewer-slider {
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 900px;
    height: 100%;
    background-color: #f8f9fa;
    z-index: 1050;
    box-shadow: -5px 0 25px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s ease-in-out;
}
.tasker-viewer-slider.active {
    transform: translateX(0);
}

.tasker-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: #fff;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.tasker-viewer-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tasker-viewer-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.2s;
}
.tasker-viewer-close-btn:hover {
    color: #ef4444;
}

.tasker-viewer-content {
    flex-grow: 1;
    overflow: auto;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #4b5563;
}

.tasker-viewer-content img,
.tasker-viewer-content iframe {
    max-width: 100%;
    max-height: 100%;
    border: none;
    display: block;
}
.tasker-viewer-content img {
    object-fit: contain;
}
.tasker-viewer-content iframe {
    width: 100%;
    height: 100%;
    background-color: #fff;
}
.tasker-viewer-content .unsupported-preview {
    color: #fff;
    text-align: center;
}
.tasker-viewer-content .unsupported-preview i {
    font-size: 4rem;
    margin-bottom: 1rem;
}


.tasker-viewer-footer {
    padding: 1rem 1.5rem;
    background-color: #fff;
    border-top: 1px solid #e5e7eb;
    text-align: right;
    flex-shrink: 0;
}

.tasker-viewer-download-btn {
    display: inline-flex;
    align-items: center;
    background-color: var(--color-accent, #6366F1);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s;
}
.tasker-viewer-download-btn:hover {
    background-color: var(--color-accent-dark, #4F46E5);
}

/* ======================================================= */
/* GLOBAL PRE-LOADER STYLES
/* ======================================================= */

.preloader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.preloader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--color-accent, #6366F1);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ================================================= */
/* START: RICH TEXT EDITOR STYLES FOR DETAILS
/* ================================================= */

#tasker-details-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-item-card {
    position: relative;
    background-color: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

/* When the card is focused, show a blue glow */
.detail-item-card.focused {
    box-shadow: 0 0 0 2px rgba(76, 13, 243, 0.4);
    border-color: #a7b5ff;
}

/* Quill Editor Container */
.detail-item-card .ql-container {
    border: none !important; /* Remove Quill's default border */
    font-size: 0.95rem;
    line-height: 1.6;
    color: #212529;
}

/* The actual editor area */
.detail-item-card .ql-editor {
    min-height: 80px; /* Set a minimum height */
    padding-bottom: 25px !important; /* Space for the metadata text */
    overflow-y: auto;
}

/* Placeholder text style */
.detail-item-card .ql-editor.ql-blank::before {
    color: #6c757d;
    font-style: normal;
    left: 12px;
}

/* Quill Toolbar Styling */
.detail-item-card .ql-toolbar {
    background-color: #f8f9fa;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom: 1px solid #e9ecef !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    padding: 6px !important;
}

/* Surprise Feature: Hide toolbar by default */
.detail-item-card .ql-toolbar {
    display: none;
}
/* Surprise Feature: Show toolbar only when the card has the 'focused' class */
.detail-item-card.focused .ql-toolbar {
    display: block;
}


/* The metadata text, positioned absolutely within the card */
.detail-meta-info {
    position: absolute;
    bottom: 5px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.65rem;
    color: #adb5bd;
    pointer-events: none; /* Allows clicking "through" the text */
}

.detail-item-card .remove-detail-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: transparent;
    border: none;
    color: #adb5bd;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.detail-item-card:hover .remove-detail-btn {
    display: flex;
}

#tasker-add-detail-btn {
    background-color: transparent;
    color: #495057;
    border: 1px dashed #ced4da;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}
#tasker-add-detail-btn:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}
/* ================================================= */
/* END: RICH TEXT EDITOR STYLES
/* ================================================= */
