/* view/style.css (Complete File) */

/* --- Root Variables --- */
:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --dark-blue: #1e3a8a;
    --light-blue: #bfdbfe;
    --background: #f1f5f9;
    --white: #ffffff;
    --dark-gray: #334155;
    --medium-gray: #94a3b8;
    --light-gray: #e2e8f0;
    --status-green: #10b981;
    --status-orange: #f59e0b;
    --status-red: #ef4444;
    --priority-high: #fecaca;
    --priority-high-text: #b91c1c;
    --priority-medium: #ffe7aa;
    --priority-medium-text: #b45309;
    --priority-low: #dbeafe;
    --priority-low-text: #1e40af;
}

/* --- Base & Layout --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background);
    color: var(--dark-gray);
    line-height: 1.5;
}
.app-container {
    display: flex;
    height: 100vh;
}
a {
    text-decoration: none;
    color: inherit;
}
ul {
    list-style: none;
}
button {
    font-family: inherit;
    border: none;
    cursor: pointer;
    background: none;
    border-radius: 4px;
    transition: all 0.2s ease-in-out; /* Added transition */
}
.hidden {
    display: none !important;
}

/* --- Main Navigation --- */
.main-nav {
    width: 240px;
    background-color: var(--dark-blue);
    color: var(--light-blue);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.nav-header {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    gap: 0.75rem;
    color: var(--white);
}
.main-nav ul {
    flex-grow: 1;
}
.main-nav li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.2s;
}
.main-nav li a:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
.main-nav li.active a {
    background-color: var(--primary-color);
    color: var(--white);
    border-right: 3px solid var(--light-blue);
}
.main-nav li.nav-separator {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 0.5rem 1.5rem;
}
.main-nav li a i {
    width: 20px;
    text-align: center;
}

/* --- Main Content Area --- */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.content-area {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* --- Main Header --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background-color: var(--white);
    border-bottom: 1px solid var(--light-gray);
    flex-shrink: 0;
}
.main-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
}

/* --- Notifications Button --- */
.notifications-container {
    position: relative;
}
.header-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--white);
    border: 1px solid var(--light-gray);
    color: var(--dark-gray);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s, box-shadow 0.2s;
}
.header-btn:hover {
    background-color: #f8fafc;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.header-btn i {
    font-size: 1.1rem;
}
.header-btn .badge {
    min-width: 18px;
    height: 18px;
    font-size: 0.7rem;
    font-weight: 600;
    background-color: var(--status-red);
    color: var(--white);
    border-radius: 50%;
    display: grid;
    place-items: center;
}

.notifications-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 350px;
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--light-gray);
    z-index: 50;
    overflow: hidden;
}
.notifications-dropdown h3 {
    font-size: 1rem;
    font-weight: 600;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--light-gray);
}
.notifications-dropdown ul {
    max-height: 400px;
    overflow-y: auto;
}
.notifications-dropdown li {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--light-gray);
    font-size: 0.9rem;
}
.notifications-dropdown li:last-child {
    border-bottom: none;
}

/* --- Dashboard Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

/* --- Client Card --- */
.client-card {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--light-gray);
}
.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-right: 1rem;
}
.card-body {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.card-main-info {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}
.info-item {
    display: flex;
    flex-direction: column;
}
.info-title {
    font-size: 0.8rem;
    color: var(--medium-gray);
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}
.info-data {
    font-size: 1rem;
    font-weight: 500;
}

/* Card Tabs */
.card-tabs {
    display: flex;
    gap: 0.25rem;
    background-color: var(--background);
    padding: 0.25rem;
    border-radius: 6px;
    flex-wrap: wrap;
}
.tab-btn {
    flex: 1 1 0;
    background: none;
    border: none;
    padding: 0.5rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--medium-gray);
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}
.tab-btn:hover {
    color: var(--dark-gray);
}
.tab-btn.active {
    background-color: var(--white);
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.tab-btn .badge {
    background-color: var(--medium-gray);
    color: var(--white);
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    transition: background-color 0.2s;
}
.tab-btn.active .badge {
    background-color: var(--primary-color);
}

.tab-content {
    min-height: 150px;
    max-height: 250px;
    overflow-y: auto;
    padding-top: 0.5rem;
}

.data-list {
    font-size: 0.9rem;
}
.data-list li {
    padding: 0.5rem 0.25rem;
    border-bottom: 1px solid var(--light-gray);
}
.data-list li:last-child {
    border-bottom: none;
}
.no-data {
    color: var(--medium-gray);
    font-style: italic;
    padding: 1rem 0;
    text-align: center;
    border-bottom: none !important;
}

/* --- Status & Priority Styles --- */
.status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    text-transform: uppercase;
}
.status-active { background-color: var(--status-green); color: var(--white); }
.status-on-hold { background-color: var(--status-orange); color: var(--white); }
.status-inactive { background-color: var(--medium-gray); color: var(--white); }

.priority-high { background-color: var(--priority-high); color: var(--priority-high-text); font-weight: 600; }
.priority-medium { background-color: var(--priority-medium); color: var(--priority-medium-text); }
.priority-low { background-color: var(--priority-low); color: var(--priority-low-text); }

/* --- Management Page Styles --- */
.management-page {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 1.5rem;
}
.action-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--light-gray);
    padding-bottom: 1.5rem;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    transition: background-color 0.2s;
}
.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
}
.management-table table {
    width: 100%;
    border-collapse: collapse;
}
.management-table th,
.management-table td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--light-gray);
}
.management-table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--medium-gray);
    font-weight: 600;
}
.management-table td.actions {
    display: flex;
    gap: 0.5rem;
}
.btn-icon {
    font-size: 1.1rem;
    color: var(--medium-gray);
}
.btn-icon:hover { color: var(--primary-color); }
.btn-icon.btn-danger:hover { color: var(--status-red); }

/* --- Inbox Page Styles --- */
.inbox-page {
    max-width: 900px;
    margin: 0 auto;
}
.inbox-item {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}
.inbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--light-gray);
    background-color: #f8fafc;
}
.user-info {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.user-info i {
    font-size: 1.2rem;
    color: var(--medium-gray);
}
.timestamp {
    font-size: 0.85rem;
    color: var(--medium-gray);
}
.inbox-body {
    padding: 1.5rem;
}
.user-message {
    font-style: italic;
    color: var(--dark-gray);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}
.ai-response {
    background-color: var(--background);
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--light-gray);
}
.ai-response strong {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* --- AI Chat Widget --- */
#chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
}
.chat-bubble {
    width: 60px;
    height: 60px;
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}
.chat-bubble:hover {
    transform: scale(1.1);
    background-color: var(--primary-hover);
}
#chat-window {
    width: 350px;
    height: 450px;
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.2s, transform 0.2s;
}
#chat-window.hidden {
    display: none;
}
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: var(--primary-color);
    color: var(--white);
}
.chat-header h3 {
    font-size: 1rem;
    font-weight: 600;
}
#close-chat-btn {
    font-size: 1.25rem;
    color: var(--white);
}
#chat-messages {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    background-color: var(--background);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.chat-message {
    padding: 0.5rem 1rem;
    border-radius: 18px;
    max-width: 85%;
    font-size: 0.9rem;
}
.user-message {
    background-color: var(--primary-color);
    color: var(--white);
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}
.ai-message {
    background-color: var(--white);
    color: var(--dark-gray);
    border: 1px solid var(--light-gray);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}
#chat-input-container {
    display: flex;
    padding: 0.5rem;
    border-top: 1px solid var(--light-gray);
}
#chat-input {
    flex-grow: 1;
    border: none;
    padding: 0.5rem;
    font-size: 0.9rem;
}
#chat-input:focus {
    outline: none;
}
#chat-send-btn {
    font-size: 1.1rem;
    color: var(--primary-color);
    padding: 0.5rem;
}

/* --- Onboarding Page Styles --- */
.onboarding-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.onboarding-page-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}
.onboarding-filters {
    display: flex;
    gap: 0.5rem;
    /* Removed margin-bottom, now part of header */
}
.btn-filter {
    background-color: var(--white);
    border: 1px solid var(--light-gray);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    color: var(--dark-gray);
}
.btn-filter:hover {
    background-color: #f8fafc;
    border-color: var(--medium-gray);
}
.btn-filter.active {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.onboarding-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* Slightly wider cards */
    gap: 1.5rem; /* Increased gap */
}

.onboarding-card {
    background-color: #ffffff; /* Explicitly set to white to pop */
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* Made shadow more prominent */
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--light-gray);
}
.onboarding-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* Deeper shadow on hover */
    transform: translateY(-4px);
}

.onboarding-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--light-gray);
}
.card-header-left .client-name {
    font-size: 1.2rem; /* Larger client name */
    font-weight: 600;
    color: var(--dark-blue);
}
.card-header-right {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}
.o-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    text-transform: uppercase;
}

/* Onboarding Stage Colors */
.o-stage-live { background-color: var(--status-green); color: var(--white); }
.o-stage-trial { background-color: var(--status-orange); color: var(--white); }
.o-stage-onboarding { background-color: var(--primary-color); color: var(--white); }
.o-stage-leads { background-color: var(--medium-gray); color: var(--white); }

/* Onboarding Type Colors */
.o-type-ai-humans { background-color: var(--light-blue); color: var(--dark-blue); }
.o-type-ai { background-color: #c7d2fe; color: #3730a3; }
.o-type-humans { background-color: #e0e7ff; color: #4338ca; }

.onboarding-card-body {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-grow: 1;
    background-color: #fcfdfe; /* Slight off-white for body */
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.btn-toggle-details {
    display: none; /* Removed old button */
}

.btn-view-details {
    background-color: var(--medium-gray); /* Gray by default */
    color: var(--white); /* White text on gray */
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none; /* Removed border */
}
.btn-view-details:hover {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
    box-shadow: 0 2px 5px rgba(60, 130, 246, 0.3);
}
.btn-view-details i {
    margin-right: 0.25rem;
}

.onboarding-details {
    display: grid;
    grid-template-columns: 1fr; /* Single column in modal is better */
    gap: 1.5rem;
}
@media (min-width: 768px) {
    .onboarding-details {
        grid-template-columns: 1fr 2fr; /* Restore 2-col on wider modals */
    }
}

.detail-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--medium-gray);
    padding-bottom: 0.5rem;
}
.detail-section ul {
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.detail-section ul li strong {
    color: var(--dark-gray);
}
.checklist {
    font-size: 0.9rem;
    display: flex; /* Use flexbox for the list */
    flex-direction: column; /* Stack items vertically */
    gap: 0.25rem; /* Space between tasks */
}
.checklist li {
    display: flex; /* Use flexbox for each task item */
    justify-content: space-between; /* Pushes task to left, owner to right */
    align-items: center; /* Vertically center */
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--light-gray);
    gap: 1rem; /* Space between task and owner */
}
.checklist li:last-child { border: none; }

.task-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-grow: 1; /* Allows task name to take available space */
    flex-shrink: 1; /* Allows task name to shrink if needed */
}

.task-toggle-icon {
	cursor: pointer;
	font-size: 1.1rem \!important;
	transition: color 0.2s;
}
.task-toggle-icon:hover {
	color: var(--primary-color);
}

.checklist li i {
    margin-right: 0.25rem; /* Reduced margin */
    font-size: 0.9rem;
    width: 16px; /* Ensure alignment */
    flex-shrink: 0; /* Prevent icon from shrinking */
}
li.task-pending {
    color: var(--dark-gray);
}
li.task-pending .task-main {
    color: var(--dark-gray);
}
li.task-pending i {
    color: var(--medium-gray);
}
li.task-completed {
    color: var(--medium-gray);
    text-decoration: line-through;
}
li.task-completed .task-main {
    color: var(--medium-gray);
}
li.task-completed i {
    color: var(--status-green);
}
.task-meta {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	flex-shrink: 0;
}
.task-owner {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--medium-gray);
    font-style: italic;
    padding: 0.25rem 0.5rem;
    background-color: var(--background);
    border-radius: 4px;
    display: inline-block; /* Fit content */
    margin-left: 0; /* Remove old margin */
    flex-shrink: 0; /* Prevent owner name from shrinking */
}

.task-meta .btn-icon {
	padding: 0.25rem;
	font-size: 0.85rem;
}
.completed-divider {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--medium-gray);
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--light-gray);
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
}
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 1001;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--light-gray);
}
.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}
.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    font-weight: 300;
    color: var(--dark-gray);
    cursor: pointer;
    padding: 0 0.5rem;
}
.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

/* --- Add Task Form Styles --- */
.add-task-form-container {
margin-top: 1.5rem;
padding-top: 1.5rem;
border-top: 1px solid var(--light-gray);
}
.add-task-form-container h4 {
font-size: 1rem;
font-weight: 600;
margin-bottom: 1rem;
}
#add-task-form {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.form-row {
display: flex;
gap: 0.75rem;
}
.form-row > input,
.form-row > select {
flex-grow: 1;
border: 1px solid var(--light-gray);
padding: 0.6rem;
border-radius: 6px;
font-size: 0.9rem;
}
.form-row > button {
flex-shrink: 0;
}

.modal.hidden,
.modal-overlay.hidden {
    display: none;
}