/* admin.css */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --color-primary: #0A2342; /* Bleu marine foncé */
    --color-primary-dark: #071a30;
    --color-primary-light: #e6f0fa;
    --color-secondary: #2CA5B5; /* Bleu sarcelle / Cyan */
    --accent-color: #FFC107; /* Jaune vif */
    --accent-color-dark: #e0ac00; /* Jaune légèrement plus foncé */
    --background-light: #F8F9FA; /* Gris très clair, presque blanc */
    --background-dark: #e9ecef; /* Gris moyen clair */
    --color-text: #343a40; /* Gris très foncé pour le texte principal */
    --color-text-light: #6c757d; /* Gris moyen pour le texte secondaire */
    --color-border: #dee2e6; /* Gris pour les bordures */
    --color-border-light: #f1f3f5; /* Gris clair pour les bordures légères */

    --success: #28a745;
    --success-light: #d4edda;
    --error: #dc3545;
    --error-light: #f8d7da;
    --warning: #ffc107;
    --warning-light: #fff3cd;
    --info: #17a2b8;
    --info-light: #d1ecf1;

    --font-family-base: 'Inter', sans-serif;
    --font-size-base: 1rem;
    --border-radius: 8px;
    --border-radius-small: 4px;
    --border-radius-pill: 50px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 25px rgba(0,0,0,0.15);

    --space-xxs: 4px;
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 20px;
    --space-lg: 30px;
    --space-xl: 40px;
}

/* Global Reset & Body Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--background-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease-in-out;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
    transition: all 0.2s ease-in-out;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    padding: var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-small);
    background-color: var(--background-dark);
    color: var(--color-text);
}

input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(44, 165, 181, 0.2);
}

.admin-body {
    display: flex;
    height: 100vh;
    overflow: hidden; /* Hide scrollbars on body */
}

/* Loader Styles */
.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    background-color: var(--background-light);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-container.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-animation {
    text-align: center;
}

.loader-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-md);
}

.logo-spinner svg {
    animation: rotate 1.5s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.logo-spinner path {
    stroke-dasharray: 180;
    stroke-dashoffset: 0;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes dash {
    0% { stroke-dashoffset: 180; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 180; }
}

.loader-text {
    font-size: 1.1rem;
    color: var(--color-primary);
    font-weight: 500;
    margin-bottom: var(--space-sm);
}

.loader-progress {
    width: 200px;
    height: 8px;
    background-color: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--accent-color);
    animation: fillProgress 2s ease-out forwards;
}

@keyframes fillProgress {
    from { width: 0%; }
    to { width: 100%; }
}


/* Admin Layout */
#admin-app {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--color-primary);
    color: white;
    display: flex;
    flex-direction: column;
    padding: var(--space-md) var(--space-sm);
    box-shadow: var(--shadow-lg);
    transition: width 0.3s ease;
    flex-shrink: 0;
    overflow-y: auto; /* For scrollable sidebar content */
    overflow-x: hidden; /* Hide horizontal scrollbar */
}

.sidebar.collapsed {
    width: 70px; /* Collapsed width */
}

/* Make body scrollable when sidebar is collapsed (for smaller screens) */
body.sidebar-collapsed {
    overflow: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    padding: var(--space-sm) 0;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    white-space: nowrap;
    overflow: hidden;
}

.logo-icon {
    width: 35px;
    height: 35px;
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    width: 0;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    padding: var(--space-xs);
    border-radius: var(--border-radius-small);
}

.sidebar-toggle-btn i {
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

.sidebar-nav {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.nav-section-title {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    margin-bottom: var(--space-sm);
    padding-left: var(--space-md);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block; /* To apply ellipsis */
}

.sidebar.collapsed .nav-section-title {
    display: none; /* Hide titles when collapsed */
}

.nav-link {
    display: flex;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    color: white;
    border-radius: var(--border-radius-small);
    position: relative;
}

.nav-link i {
    font-size: 1.1rem;
    width: 30px; /* Fixed width for icons */
    text-align: center;
    flex-shrink: 0;
}

.link-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    margin-left: var(--space-sm); /* Spacing between icon and text */
}

.sidebar.collapsed .link-text {
    opacity: 0;
    width: 0;
    margin-left: 0;
}

.nav-link:hover {
    background-color: var(--color-primary-dark);
}

.nav-link.active {
    background-color: var(--accent-color);
    color: var(--color-primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.nav-link.active i {
    color: var(--color-primary);
}

.link-badge {
    background-color: var(--error);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--border-radius-pill);
    min-width: 25px;
    text-align: center;
    margin-left: var(--space-sm);
    flex-shrink: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.link-badge:empty {
    display: none;
}

.sidebar.collapsed .link-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    margin-left: 0;
}

.sidebar-footer {
    padding-top: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: var(--space-lg);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding-left: var(--space-sm); /* Align with nav links */
    white-space: nowrap;
    overflow: hidden;
}

.avatar {
    width: 40px;
    height: 40px;
    background-color: var(--accent-color);
    color: var(--color-primary);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: 1rem;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-role {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.sidebar.collapsed .user-profile {
    justify-content: center;
    padding-left: 0;
}

.sidebar.collapsed .user-info {
    display: none;
}

.nav-link.logout {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-link.logout:hover {
    background-color: var(--error);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Allow content to scroll */
    background-color: var(--background-light);
}

.main-header {
    background-color: white;
    padding: var(--space-md) var(--space-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.mobile-menu-btn {
    display: none; /* Hidden on desktop */
    font-size: 1.5rem;
    color: var(--color-text);
}

#page-title {
    font-size: 1.8rem;
    color: var(--color-primary);
    font-weight: 700;
    margin: 0;
}

.breadcrumb {
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin-top: 5px;
}

.breadcrumb a {
    color: var(--color-secondary);
}

.breadcrumb span {
    margin: 0 5px;
}

.content-container {
    flex-grow: 1;
    padding: var(--space-lg);
    max-width: 1400px; /* Max width for content area */
    width: 100%;
    margin: 0 auto; /* Center content */
}

/* Admin Section Styles */
.admin-section {
    background-color: white;
    padding: var(--space-lg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    min-height: calc(100vh - 120px - var(--space-lg) * 2); /* Adjust based on header/padding */
}

/* Dashboard Specific Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-md);
}

.stat-card {
    background-color: var(--background-light);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-header {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-sm);
}

.stat-icon {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: var(--space-xs);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--color-text-light);
    font-weight: 500;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    background-color: white;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px; /* Ensure table is wide enough for content */
}

table thead tr {
    background-color: var(--background-dark);
    color: var(--color-text);
    text-align: left;
}

table th, table td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: var(--color-text-light);
}

table tbody tr:nth-child(even) {
    background-color: var(--background-light);
}

table tbody tr:hover {
    background-color: var(--color-primary-light);
}

.status-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: var(--border-radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-badge.status-pending { background-color: var(--warning-light); color: var(--warning); }
.status-badge.status-approved { background-color: var(--success-light); color: var(--success); }
.status-badge.status-rejected { background-color: var(--error-light); color: var(--error); }
.status-badge.status-processing { background-color: var(--info-light); color: var(--info); }
.status-badge.status-shipped { background-color: #fce5cd; color: #e69138; /* Orange */ }
.status-badge.status-delivered { background-color: var(--success-light); color: var(--success); }
.status-badge.status-cancelled { background-color: var(--color-border); color: var(--color-text-light); }
.status-badge.status-unread { background-color: var(--warning-light); color: var(--warning); }
.status-badge.status-read { background-color: var(--success-light); color: var(--success); }
.status-badge.status-sent { background-color: var(--info-light); color: var(--info); }
.status-badge.status-closed { background-color: var(--color-border); color: var(--color-text-light); }
.status-badge.status-accepted { background-color: var(--success-light); color: var(--success); }


.action-buttons {
    display: flex;
    gap: var(--space-xs);
    justify-content: flex-end; /* Align to the right in table cells */
    align-items: center;
}

.action-btn {
    background-color: var(--background-dark);
    color: var(--color-text-light);
    padding: var(--space-xs);
    border-radius: var(--border-radius-small);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
}

.action-btn:hover {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.action-btn.view-btn i { color: var(--color-secondary); }
.action-btn.edit-btn i { color: var(--warning); }
.action-btn.delete-btn i { color: var(--error); }


/* Section Headers for forms/lists */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--color-border);
}

.section-header h1 {
    font-size: 1.5rem;
    color: var(--color-primary);
    font-weight: 700;
}

.button-primary {
    background-color: var(--accent-color);
    color: var(--color-primary);
    padding: 10px 20px;
    border-radius: var(--border-radius-small);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
}

.button-primary:hover {
    background-color: var(--accent-color-dark);
    box-shadow: var(--shadow-md);
}

.button-secondary {
    background-color: var(--color-primary);
    color: white;
    padding: 10px 20px;
    border-radius: var(--border-radius-small);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
}

.button-secondary:hover {
    background-color: var(--color-primary-dark);
    box-shadow: var(--shadow-md);
}

/* Form Group Styles */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 600;
    color: var(--color-primary);
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-small);
    background-color: var(--background-light);
    color: var(--color-text);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input.file-input {
    padding: 5px; /* Adjust padding for file input */
}

/* Image Upload Preview */
.image-preview-container {
    width: 150px;
    height: 150px;
    border: 2px dashed var(--color-border);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    cursor: pointer;
    overflow: hidden;
    background-color: var(--background-dark);
    color: var(--color-text-light);
    font-size: 0.9rem;
}

.image-preview-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: none; /* Hidden by default until image is loaded */
}

.image-preview-container span {
    padding: 10px;
}

/* Product List (Accordion) */
.category-accordion {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    background-color: white;
}

.category-accordion summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background-color: var(--background-dark);
    color: var(--color-primary);
    font-weight: 600;
    cursor: pointer;
    list-style: none; /* Remove default marker */
}

.category-accordion summary::-webkit-details-marker {
    display: none; /* Hide Chrome/Safari marker */
}

.category-accordion summary .summary-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.1rem;
}

.category-accordion summary .icon-category {
    color: var(--accent-color);
}

.category-accordion summary .summary-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.category-accordion summary .chevron-icon {
    transition: transform 0.2s ease;
}

.category-accordion[open] summary .chevron-icon {
    transform: rotate(180deg);
}

.product-list-content {
    padding: var(--space-md);
    border-top: 1px solid var(--color-border);
}

.product-item-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    border-bottom: 1px dashed var(--color-border-light);
}

.product-item-row:last-child {
    border-bottom: none;
}

.product-item-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-small);
    flex-shrink: 0;
    background-color: white;
}

.product-item-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-item-name {
    font-size: 1rem;
    color: var(--color-primary);
    margin-bottom: 5px;
}

.product-item-details {
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.product-item-actions {
    flex-shrink: 0;
}

.no-product-message {
    text-align: center;
    padding: var(--space-md);
    color: var(--color-text-light);
    font-style: italic;
}

/* Modal Styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-backdrop[style*="display: flex"] { /* Use attribute selector for display to trigger transition */
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 700px; /* Default max-width, can be overridden */
    max-height: 90vh; /* Max height to prevent overflow on small screens */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal-backdrop[style*="display: flex"] .modal-container {
    transform: translateY(0);
    opacity: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border);
    background-color: var(--background-dark);
}

.modal-header h3 {
    font-size: 1.2rem;
    color: var(--color-primary);
    margin: 0;
}

.modal-close-btn {
    font-size: 1.8rem;
    color: var(--color-text-light);
    line-height: 1;
    padding: var(--space-xs);
    border-radius: var(--border-radius-small);
}

.modal-close-btn:hover {
    color: var(--error);
    background-color: var(--error-light);
}

.modal-body {
    padding: var(--space-md);
    flex-grow: 1;
    overflow-y: auto; /* Allow modal content to scroll */
}

/* Error Message Styles */
.error-message {
    color: var(--error);
    background-color: var(--error-light);
    padding: var(--space-sm);
    border-radius: var(--border-radius-small);
    text-align: center;
    margin-top: var(--space-md);
}

/* Order Details Modal Specific Styles (reused in Quote Details Modal) */
.order-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
}

.order-details-grid .detail-block {
    background-color: var(--background-light);
    padding: var(--space-md);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.order-details-grid .detail-block h4 {
    color: var(--color-primary);
    font-size: 1.1em;
    margin-bottom: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-xs);
}

.order-details-grid .detail-block p {
    font-size: 0.9em;
    margin-bottom: 5px;
    line-height: 1.5;
}

.order-details-grid .detail-block.full-width {
    grid-column: 1 / -1;
}

.order-items-list-admin {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.order-item-admin {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    padding: var(--space-xs) 0;
    border-bottom: 1px dashed var(--color-border-light);
}

.order-item-admin:last-child {
    border-bottom: none;
}

.item-name-admin {
    flex-grow: 1;
    margin-left: var(--space-xs);
    font-weight: 500;
}

.item-price-admin {
    font-weight: 600;
    flex-shrink: 0;
}

.totals-block p {
    display: flex;
    justify-content: space-between;
    font-size: 0.95em;
    padding: 3px 0;
}

.totals-block p strong {
    font-weight: 700;
    color: var(--color-primary);
}

.grand-total-admin {
    font-size: 1.1em !important;
    font-weight: 700;
    border-top: 2px solid var(--color-primary);
    padding-top: var(--space-sm) !important;
    margin-top: var(--space-sm);
}

.management-block .form-group {
    margin-bottom: var(--space-sm);
}

.management-block .button-primary,
.management-block .button-secondary {
    width: 100%;
    margin-top: var(--space-sm);
}

.management-block .button-secondary {
    background-color: var(--color-secondary);
    color: white;
    border-color: var(--color-secondary);
}

.management-block .button-secondary:hover {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}


/* NEW: Conversation history styles */
.conversation-history-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 15px;
    background-color: var(--background-dark);
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px; /* Space between history and reply box */
}

.message-item {
    background-color: var(--blanc);
    padding: 10px 15px;
    border-radius: var(--border-radius-small);
    box-shadow: var(--shadow-sm);
    max-width: 90%; /* Messages don't take full width */
}

.admin-message {
    align-self: flex-end; /* Align to the right for admin */
    background-color: var(--color-primary-light); /* Light blue for admin */
    color: var(--color-primary);
}

.client-message {
    align-self: flex-start; /* Align to the left for client */
    background-color: var(--blanc); /* White for client */
    border: 1px solid var(--color-border);
}

.message-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: var(--color-text-light);
    margin-bottom: 5px;
}

.message-body p {
    margin: 0;
    line-height: 1.4;
    font-size: 0.9em;
    color: var(--color-text);
}

.attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    padding: 5px 10px;
    background-color: var(--accent-color);
    color: var(--color-primary);
    border-radius: var(--border-radius-small);
    font-size: 0.85em;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.attachment-link:hover {
    background-color: var(--accent-color-dark);
}

.attachment-link i {
    font-size: 1em;
}

.no-messages-yet {
    text-align: center;
    color: var(--color-text-light);
    font-style: italic;
    padding: 20px;
}

/* NEW: Toast Notifications (enhanced) */
#toast-container {
    position: fixed;
    top: 25px;
    right: 25px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 380px;
    pointer-events: none;
    font-family: var(--font-family-base);
}

.toast {
    background-color: var(--blanc);
    color: var(--color-primary);
    padding: 16px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.4s ease, transform 0.4s ease; /* Use transition for smooth hide/show */
    pointer-events: auto;
    border-left: 6px solid;
    box-sizing: border-box;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast.info { border-left-color: var(--color-secondary); }
.toast.warning { border-left-color: var(--warning); }


.toast-icon {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--error); }
.toast.info .toast-icon { color: var(--color-secondary); }
.toast.warning .toast-icon { color: var(--warning); }


.toast-content { flex-grow: 1; }

.toast-title {
    font-weight: 700;
    font-size: 1.15em;
    margin-bottom: 4px;
    line-height: 1.2;
    color: var(--color-primary);
}

.toast-message {
    font-size: 0.95em;
    line-height: 1.5;
    color: var(--color-text-light);
}

/* Animations for toasts */
@keyframes slideInToast {
    from { opacity: 0; transform: translateX(120%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOutToast {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(120%); }
}

/* Apply animations dynamically in JS, but define them here */
/* .toast { animation: slideInToast 0.4s forwards, fadeOutToast 0.4s forwards 3.5s; } */


/* Responsive Design */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: -250px; /* Hide sidebar off-screen */
        top: 0;
        height: 100vh;
        z-index: 1100;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.collapsed {
        left: 0; /* Show on collapse */
        width: 70px;
    }

    .main-content {
        margin-left: 0; /* No margin when sidebar is hidden */
    }

    .sidebar-toggle-btn {
        display: block; /* Show on desktop for toggle functionality */
        position: absolute;
        right: 10px;
        top: 10px;
        z-index: 1101;
    }

    .mobile-menu-btn {
        display: block; /* Show hamburger on mobile */
    }

    body.sidebar-collapsed .sidebar {
        left: 0; /* Fully visible when toggled for mobile */
    }

    body.sidebar-collapsed .main-content {
        margin-left: 70px; /* Push content when sidebar is fully open */
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: var(--space-md);
    }

    #page-title {
        font-size: 1.5rem;
    }

    .breadcrumb {
        font-size: 0.8rem;
    }

    .content-container {
        padding: var(--space-md);
    }

    .admin-section {
        padding: var(--space-md);
    }

    .stats-grid {
        grid-template-columns: 1fr; /* Stack stats on small screens */
    }

    .table-container {
        border-radius: 0; /* No border radius on small screens for better fit */
    }

    table {
        min-width: 100%; /* Make table take full width */
    }

    .action-buttons {
        justify-content: flex-start; /* Align actions to left */
    }

    .modal-container {
        max-width: 95%; /* Wider modal on smaller screens */
    }

    /* Toast on mobile */
    #toast-container {
        top: auto;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        max-width: 90%;
        width: calc(100% - 40px);
    }

    .toast {
        transform: translateY(100%);
        /* animation is set in JS */
    }
    @keyframes slideInToastMobile {
        from { opacity: 0; transform: translateY(120%); }
        to { opacity: 1; transform: translateY(0); }
    }
    @keyframes fadeOutToastMobile {
        from { opacity: 1; transform: translateY(0); }
        to { opacity: 0; transform: translateY(120%); }
    }
}