/**
 * Cbran Provider - Task Details Stylesheet
 * @version 33.1.0
 * @location /assets/css/cbran-task-details-style.css
 * @description All styles for the enhanced [cbran_task_details] shortcode page app view.
 */

body.cbran-task-details-active {
    background-color: #f8fafc; /* bg-slate-50 */
    padding-top: 4rem; /* Space for fixed task header (global bar offset via CSS var) */
    padding-bottom: 90px; /* Space for fixed footer */
    font-family: 'Nunito Sans', sans-serif;
}

body.cbran-combined-legacy-details #task-list,
body.cbran-combined-legacy-details #main-nav-container {
    display: none !important;
}

#cbran-task-details-app-root > header.fixed {
    top: var(--cbran-site-top-offset, 0px);
}

.text-payout-pink { color: #d6007a; }
.bg-payout-pink { background-color: #d6007a; }
.ring-payout-pink { --tw-ring-color: #d6007a; }
.border-payout-pink { border-color: #d6007a; }
.focus\:ring-payout-pink:focus { --tw-ring-color: #d6007a; }
.focus\:border-payout-pink:focus { border-color: #d6007a; }


/* Styles for the Sliding Toggle */
.toggle-container {
    position: relative;
    display: flex;
    width: 100%;
    background-color: #e5e7eb; /* Rail color */
    z-index: 1;
    /* Create a stacking context */
    isolation: isolate;
}
.toggle-glider {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: #ffffff !important; /* Active pill color - force white background */
    border-radius: 9999px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 2 !important; /* Above the gray background but below buttons */
    pointer-events: none; /* Allow clicks to pass through to buttons */
}
.toggle-button {
    position: relative;
    z-index: 10 !important; /* Above everything to remain clickable */
    flex: 1;
    text-align: center;
    background-color: transparent !important; /* Ensure transparent background */
    color: #4b5563; /* Inactive text color */
    transition: color 0.4s ease;
    border: none;
    cursor: pointer;
}
.toggle-button.active {
    color: #d6007a; /* Active text color */
}

/* Ensure secondary toggle buttons work correctly */
#secondary-nav-container .toggle-container {
    isolation: isolate;
}

#secondary-nav-container .toggle-glider {
    z-index: 2 !important;
    pointer-events: none !important;
    background-color: #ffffff !important;
}

#secondary-nav-container .toggle-button.secondary-toggle-button {
    z-index: 10 !important;
    background-color: transparent !important;
}

/* Main content fade-in animation for a smoother user experience */
.tab-pane, .main-tab-pane, .modal-container {
    animation: cbran-fadeIn 0.3s ease-in-out;
}
@keyframes cbran-fadeIn {
    from { opacity: 0; transform: scale(0.98) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Top Status Timeline Styles */
.timeline-step { display: flex; flex-direction: column; align-items: center; position: relative; flex-grow: 1; }
.timeline-step:not(:last-child)::after { content: ''; position: absolute; top: 8px; left: 50%; width: 100%; height: 2px; background-color: #e5e7eb; z-index: 1; transition: background-color 0.3s ease-in-out; }
.timeline-circle { width: 16px; height: 16px; border-radius: 50%; z-index: 2; transition: all 0.3s ease-in-out; background-color: #e5e7eb; border: 2px solid #d1d5db;}
.timeline-label { color: #6b7280; font-weight: 600; transition: all 0.3s ease-in-out; }

/* Pulse animation for the active step in the timeline */
@keyframes cbran-pulse-shadow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(214, 0, 122, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(214, 0, 122, 0); }
}

.timeline-step.active .timeline-circle { 
    background-color: #d6007a; 
    border-color: #d6007a;
    animation: cbran-pulse-shadow 2s infinite;
}
.timeline-step.active .timeline-label { color: #d6007a; font-weight: 700; }

.timeline-step.completed .timeline-circle { background-color: #22c55e; border-color: #22c55e; }
.timeline-step.completed .timeline-label { color: #166534; font-weight: 700; }
.timeline-step.completed::after { background-color: #22c55e; }

/* Custom radio button styles for the requirements modal */
.custom-radio:checked {
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e");
    border-color: #d6007a;
    background-color: #d6007a;
}

/* Marquee animation for long text */
@keyframes cbran-marquee-scroll {
    from { transform: translateX(0%); }
    to { transform: translateX(-100%); }
}
.scroll-container .scrolling-text {
    padding-right: 2rem; /* Creates space between the repeated text */
}
.scrolling-text.animate-scroll {
    animation: cbran-marquee-scroll 20s linear infinite;
}

/* --- Wave Animation for Urgency Bar (reused for consistency) --- */
.urgency-bar {
    position: relative;
    overflow: hidden;
}
.urgency-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 150%;
    height: 100%;
    animation-name: cbran-wave-effect;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    transform: translateX(-150%);
}
@keyframes cbran-wave-effect {
    0% { transform: translateX(-150%); }
    100% { transform: translateX(150%); }
}

.wave-urgent::after { 
    animation-duration: 2s; 
    background: linear-gradient(90deg, transparent, rgba(248, 113, 113, 0.4), transparent);
}
.wave-soon::after { 
    animation-duration: 3.5s; 
    background: linear-gradient(90deg, transparent, rgba(251, 146, 60, 0.4), transparent);
}
.wave-today::after { 
    animation-duration: 5s; 
    background: linear-gradient(90deg, transparent, rgba(74, 222, 128, 0.4), transparent);
}
.wave-late::after { 
    animation-duration: 1s;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    z-index: 1;
}
.wave-active::after {
    animation-duration: 4s;
    background: linear-gradient(90deg, transparent, rgba(147, 197, 253, 0.4), transparent);
}

.status-late-bg { background-image: linear-gradient(to right, #ef4444, #dc2626); }
.status-active-bg { background-image: linear-gradient(to right, #60a5fa, #3b82f6); }
.status-urgent-bg { background-image: linear-gradient(to right, #fee2e2, #fecaca); }
.status-soon-bg { background-image: linear-gradient(to right, #ffedd5, #fed7aa); }
.status-today-bg { background-image: linear-gradient(to right, #dcfce7, #bbf7d0); }

.status-late-text, .status-active-text { color: #ffffff; }
.status-urgent-text { color: #b91c1c; }
.status-soon-text { color: #c2410c; }
.status-today-text { color: #166534; }

.modal-overlay { transition: opacity 0.3s; }
.modal-content { transition: opacity 0.3s, transform 0.3s; }

/* Grid for info items */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* =================================================================== */
/* =================== IMPROVED CHAT MODAL STYLES ==================== */
/* =================================================================== */

/* Chat container when inside a tab (not modal) */
.chat-container {
    display: flex !important;
    flex-direction: column !important;
    height: 70vh !important;
    min-height: 70vh;
    background: white;
    border-radius: 1rem;
    overflow: hidden;
}

.chat-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: white;
    border-radius: 1rem 1rem 0 0;
}

.chat-connection-status {
    flex-shrink: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    background: #f3f4f6;
    color: #6b7280;
}

.chat-connection-status[data-state="connected"] {
    background: #dcfce7;
    color: #166534;
}

.chat-connection-status[data-state="reconnecting"] {
    background: #fef3c7;
    color: #92400e;
}

.chat-availability-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #fff7ed;
    border-bottom: 1px solid #fed7aa;
    color: #9a3412;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.chat-availability-notice svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.chat-mode-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f0fdf4;
    border-bottom: 1px solid #bbf7d0;
    color: #166534;
    font-size: 0.75rem;
    font-weight: 500;
}

.chat-mode-banner svg {
    width: 0.875rem;
    height: 0.875rem;
}

.chat-modal-footer--disabled {
    opacity: 0.65;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-avatar-large {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #f3f4f6;
}

.chat-header-details {
    display: flex;
    flex-direction: column;
}

.chat-header-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.25;
}

.chat-header-subtitle {
    margin: 0;
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.25;
}

.dashboard-customer-contact-icon,
.task-customer-contact-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    background-color: #fdf2f8;
    color: #d6007a;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.dashboard-customer-contact-icon:hover,
.task-customer-contact-icon:hover {
    background-color: #fce7f3;
    color: #be185d;
}

.chat-privacy-notice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #fef3c7;
    border-bottom: 1px solid #fde68a;
    font-size:ียว 0.75rem;
    color: #92400e;
    flex-shrink: 0;
}

.chat-privacy-notice svg,
.chat-privacy-notice i {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
}

.chat-history-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    min-height: 0;
    max-height: none;
    display: flex;
    flex-direction: column;
    background: #fafafa;
}

.chat-history-container::-webkit-scrollbar {
    width: 6px;
}

.chat-history-container::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

.chat-history-container::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.chat-history-container::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.chat-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    color: #6b7280;
    flex: 1;
    min-height: 200px;
}

.chat-loading-state p {
    margin: 0;
}

.chat-message {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    margin-bottom: 1rem;
    animation: chatMessageSlideIn 0.3s ease-out;
}

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

.chat-message.client {
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.chat-message-bubble {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    word-wrap: break-word;
    position: relative;
}

.chat-message.client .chat-message-bubble {
    background: #db2777;
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.chat-message.provider .chat-message-bubble {
    background: #f3f4f6;
    color: #111827;
    border-bottom-left-radius: 0.25rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-message-content {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.chat-message-time {
    font-size: 0.65rem;
    color: #9ca3af;
    margin-top: 0.25rem;
    padding: 0 0.5rem;
}

.chat-message.client .chat-message-time {
    text-align: right;
}

.chat-error-alert {
    padding: 0.75rem 1rem;
    margin: 0.5rem 1rem;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    color: #991b1b;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.chat-modal-footer {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    background: white;
    border-radius: 0 0 1rem 1rem;
    flex-shrink: 0;
}

.chat-send-form {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.chat-input-wrapper {
    position: relative;
    flex: 1;
}

.chat-message-input {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-bottom: 1.75rem;
    border: 1px solid #d1d5db;
    border-radius: 1.5rem;
    font-size: 0.875rem;
    background: #f9fafb;
    transition: all 0.2s;
}

.chat-message-input:focus {
    outline: none;
    border-color: #db2777;
    background: white;
    box-shadow: 0 0 0 3px rgba(219, 39, 119, 0.1);
}

.chat-char-count {
    position: absolute;
    bottom: 0.5rem;
    right: 0.75rem;
    font-size: 0.65rem;
    color: #9ca3af;
}

.chat-send-btn {
    padding: 0.75rem;
    background: #db2777;
    color: white;
    border: none;
    border-radius: 50%;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    background: #be185d;
    transform: scale(1.05);
}

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

.chat-send-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.main-tab-pane .chat-container {
    width: 100%;
    margin: 0;
}

.main-tab-pane {
    padding: 1rem;
}

/* Image Preview Styles */
.chat-image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    max-height: 200px;
    overflow-y: auto;
}

.chat-image-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    background: white;
}

.chat-image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-image-preview-item .chat-preview-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #dc2626;
    color: white;
    border: 2px solid white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    transition: all 0.2s;
}

.chat-image-preview-item .chat-preview-remove:hover {
    background: #b91c1c;
    transform: scale(1.1);
}

.chat-image-preview-item .chat-preview-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-image-preview-item .chat-preview-error {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fee2e2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #991b1b;
    font-size: 0.65rem;
    text-align: center;
    padding: 0.25rem;
}

.chat-attach-btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-attach-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}