/* Premium UI - Comité de Lecture Revamp */

:root {
  /* Extended Palette - Brown Theme (Livres Agités) */
  --primary-color: #6D4C41; /* Brown (Cuir) */
  --primary-dark: #4E342E;  /* Darker Brown */
  --primary-light: #8D6E63; /* Lighter Brown */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px 0 rgba(109, 76, 65, 0.15); /* Shadow tinted with brown */
  --text-dark: #3E2723; /* Dark Brown Text */
  --text-muted: #8D6E63; /* Muted Brown */

  /* Global Overrides */
  .stat-number, 
  .kpi-number {
      color: #6D4C41;
  }
  
  a {
      color: #6D4C41;
      transition: color 0.2s ease;
  }
  a:hover {
      color: #4E342E;
      text-decoration: none;
  }

  /* Status Colors */
  --status-pending: #f39c12; /* Orange remains for warnings/pending */
  --status-reading: #5D4037; /* En lecture -> Deep Brown */
  --status-done: #2ecc71;    /* Green remains for success */

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-medium: 0.3s ease;
}

/* Glassmorphism Utilities */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 16px;
  transition:
    transform var(--transition-medium),
    box-shadow var(--transition-medium);
}

.glass-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.25);
}

.glass-panel {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Layout Improvements */
.container-premium {
  /* Padding removed as requested */
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0;
}

@media (max-width: 768px) {
  .container-premium {
    padding: 0 1.5rem;
  }
}

.manuscrit-grid-mosaic {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 2.5rem;
  padding: 2.5rem 0;
}

.tab-content {
  margin-top: 2rem;
}

/* Card Styling */
.manuscrit-premium-card {
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.manuscrit-premium-header {
  padding: 1.5rem;
  padding-bottom: 0.5rem;
}

/* Global Page Headers */
.page-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-top: 2rem;
}

.page-title {
    font-family: "Playfair Display", serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #6D4C41; /* Brown */
    margin-bottom: 1rem;
    line-height: 1.2;
}

.page-description {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto;
    font-weight: 400;
}

.manuscrit-title {
  font-family:
    "Playfair Display", serif; /* Assuming this font exists or fallback */
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.manuscrit-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.premium-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-genre {
  background: #eef2f7;
  color: #5dade2;
}
.badge-pages {
  background: #000000;
  color: #ffffff;
}
.badge-priority-high {
  background: #fdedec;
  color: #e74c3c;
  box-shadow: 0 2px 5px rgba(231, 76, 60, 0.2);
}

.manuscrit-premium-body {
  padding: 0 1.5rem 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.manuscrit-excerpt {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.manuscrit-premium-footer {
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.3);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Badges & Status */
.premium-badge,
.badge-status {
  border-radius: 5px; /* User Request: 5px everywhere */
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

/* Status Colors - UX Principles */
.badge-en-lecture {
  background-color: #3498db; /* Soft Blue: Active but calm */
  color: white;
}
.badge-soumis {
  background-color: #6c757d; /* Grey: Neutral/Initial */
  color: white;
}
.badge-accepte {
  background-color: #2ecc71; /* Green: Success */
  color: white;
}
.badge-refuse {
  background-color: #e74c3c; /* Red: Negative/Stop */
  color: white;
}
.badge-en-evaluation {
  background-color: #f39c12; /* Orange: Action needed/In progress */
  color: white;
}

/* Buttons & Actions */
.btn-premium,
.btn {
  border: none; /* Reset for premium, careful with bootstrap */
  padding: 0.6rem 1.2rem;
  border-radius: 5px; /* Global 5px User Request */
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-premium-primary {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(109, 76, 65, 0.3);
}

.btn-premium-primary:hover {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(109, 76, 65, 0.4);
}

.btn-premium-outline {
  background: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}

.btn-premium-outline:hover {
  background: rgba(109, 76, 65, 0.1);
}

/* Force Brown Theme on Standard Bootstrap/Theme Buttons */
/* Force Brown Theme on Standard Bootstrap/Theme Buttons */
.btn-primary, 
.evaluate-btn,
button.btn-primary {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(109, 76, 65, 0.3);
  transition: all var(--transition-fast);
}

.btn-primary:hover,
.evaluate-btn:hover,
button.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(109, 76, 65, 0.4);
}

/* Secondary Buttons - Lighter Brown */
.btn-secondary {
    background-color: #A1887F; /* Light Brown */
    border: none;
    color: white;
    box-shadow: 0 4px 10px rgba(161, 136, 127, 0.2);
}
.btn-secondary:hover {
    background-color: #8D6E63;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(161, 136, 127, 0.3);
}

/* Outline Buttons - Brown Theme */
.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
    font-weight: 600;
}
.btn-outline-primary:hover {
    background-color: rgba(109, 76, 65, 0.05);
    color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-secondary {
    border: 2px solid #D7CCC8; /* Very Light Brown Border */
    color: #8D6E63; /* Muted Brown Text */
    background: transparent;
    font-weight: 600;
}
.btn-outline-secondary:hover {
    background-color: rgba(109, 76, 65, 0.05);
    color: #6D4C41;
    border-color: #6D4C41;
    transform: translateY(-1px);
}

/* Animations */
@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-slide-up {
  animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Rating System - Evaluation Page */
.premium-rating-container {
  display: flex;
  align-items: center;
  gap: 5px;
}

.star-icon {
  width: 32px;
  height: 32px;
  fill: #e0e0e0;
  cursor: pointer;
  transition:
    fill 0.2s,
    transform 0.2s;
}

.star-icon:hover,
.star-icon.active {
  fill: #f1c40f;
  transform: scale(1.1);
  filter: drop-shadow(0 0 5px rgba(241, 196, 15, 0.5));
}

.sentiment-glow {
  transition: background-color 0.5s ease;
  padding: 2rem;
  border-radius: 12px;
}

/* Split View Layout */
.split-view-container {
  display: flex;
  height: calc(100vh - 100px); /* Adjust based on header height */
  gap: 20px;
}

.split-view-left {
  flex: 1;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: var(--glass-shadow);
}

.split-view-right {
  flex: 1;
  overflow-y: auto;
  padding-right: 10px; /* Space for scrollbar */
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Enhanced Filter Components */
.filter-panel {
    z-index: 10;
    position: relative;
}

.premium-filter-container {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    padding: 1.75rem;
    transition: all var(--transition-medium);
    width: 100%;
}

.premium-filter-container .row {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
}

.premium-filter-container:hover {
    box-shadow: 0 15px 35px rgba(109, 76, 65, 0.1);
    border-color: rgba(109, 76, 65, 0.2);
}

.premium-select-group {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.premium-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #6D4C41; /* Brown matching buttons */
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0px;
    padding-left: 0.25rem;
    opacity: 0.9;
}

.premium-select-wrapper {
    position: relative;
    width: 100%;
}

.premium-select {
    width: 100%;
    height: 48px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 0 1rem;
    font-size: 0.95rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
}

.premium-select-wrapper::after {
    content: "";
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    transform: translateY(-70%) rotate(45deg);
    position: absolute;
    right: 1.25rem;
    top: 50%;
    pointer-events: none;
    transition: transform var(--transition-fast);
}

.premium-select:focus {
    border-color: var(--primary-light);
    background: white;
    box-shadow: 0 0 0 4px rgba(109, 76, 65, 0.1);
    outline: none;
}

.premium-select:focus + .premium-select-wrapper::after {
    transform: translateY(-20%) rotate(-135deg);
}

.filter-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    height: 48px;
}

.btn-premium-reset {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    text-decoration: none;
    transition: color var(--transition-fast);
    padding: 0.5rem 1rem;
}

.btn-premium-reset:hover {
    color: var(--primary-color);
    background: rgba(109, 76, 65, 0.05);
    border-radius: 8px;
}

/* Premium Navigation Tabs - Segmented Control style */
#manuscritsTabs {
    border: none;
    background: rgba(0, 0, 0, 0.04);
    display: inline-flex;
    list-style: none;
    padding: 6px;
    border-radius: 14px;
    margin-bottom: 2.5rem;
}

#manuscritsTabs .nav-item {
    margin-bottom: 0;
}

#manuscritsTabs .nav-link {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 10px 24px;
    border-radius: 10px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

#manuscritsTabs .nav-link:hover {
    color: var(--primary-color);
}

#manuscritsTabs .nav-link.active {
    background: white;
    color: #6D4C41; /* Brown matching buttons */
    box-shadow: 0 4px 12px rgba(109, 76, 65, 0.15); /* Brown tinted shadow */
}

#manuscritsTabs .badge {
    margin-left: 8px;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: transform var(--transition-fast);
}

/* Global Chatbot Help Section Styling */
.chatbot-contextual-help {
    background: white;
    border: 1px solid #6D4C41;
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.chatbot-contextual-help h4 {
    color: #6D4C41;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.chatbot-contextual-help p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}
#manuscritsTabs .nav-link.active .badge {
    transform: scale(1.1);
}


/* ATOMIC OVERRIDES - DO NOT REMOVE */
body.livresagites-premium .premium-label {
    color: #6D4C41;
    opacity: 1;
}

body.livresagites-premium #manuscritsTabs .nav-link.active,
body.livresagites-premium .nav-tabs .nav-link.active {
    color: #6D4C41;
    border-color: transparent;
}

/* NUCLEAR OVERRIDE for Blue #1F40AA issue */
/* The user reported a specific blue background on outline buttons. 
   We use high specificity to override [type="button"] selectors from the theme. */
body.livresagites-premium button.btn-premium-outline,
body.livresagites-premium button[class*="btn-premium-outline"] {
    background-color: transparent;
    color: #6D4C41;
    border: 1px solid #6D4C41;
    box-shadow: none;
}

body.livresagites-premium button.btn-premium-outline:hover,
body.livresagites-premium button[class*="btn-premium-outline"]:hover {
    background-color: rgba(109, 76, 65, 0.1);
    color: #4E342E;
    border-color: #4E342E;
    transform: translateY(-1px);
}

/* Ensure all button types respect the brown theme */
body.livresagites-premium button[type="button"].btn-primary,
body.livresagites-premium button[type="submit"].btn-primary,
body.livresagites-premium button[type="reset"].btn-primary,
body.livresagites-premium input[type="submit"].btn-primary,
body.livresagites-premium input[type="button"].btn-primary {
    background: linear-gradient(135deg, #8D6E63 0%, #6D4C41 100%);
    background-color: #6D4C41; /* Fallback */
    color: white;
    border: none;
}

/* --- Task 4: Cookie Consent Persistence Fix --- */
.cookie-consent-hidden .cmplz-cookiebanner,
.cookie-consent-hidden #cmplz-cookiebanner-container,
.cookie-consent-hidden .cmplz-blocked-content-notice {
    display: none;
}

/* --- Task 3: Mobile Responsive Header Fixes --- */
@media (max-width: 576px) {
    .site-header-inner {
        flex-direction: column;
        align-items: center;
        padding-bottom: 15px;
    }
    
    .site-branding {
        margin-bottom: 15px;
        max-width: 100%;
    }
    
    .site-logo-align img {
        max-width: 180px;
        height: auto;
    }

    .site-title {
        font-size: 1.5rem;
    }

    .menu-toggle {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
}

@media (max-width: 360px) {
    .site-logo-align img {
        max-width: 150px;
    }
    
    .site-title {
        font-size: 1.2rem;
    }
}

/* --- Chatbot Legacy Fixes (Jamin) --- */

/* 1. Harmonize "Clear" / "Effacer" button */
.mwai-chatbot .mwai-buttons .mwai-clear {
    background: transparent;
    color: #6D4C41;
    border: 1px solid #6D4C41;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.mwai-chatbot .mwai-buttons .mwai-clear:hover {
    background: rgba(109, 76, 65, 0.1);
    opacity: 1;
}

/* 2. Chatbot Popup Mobile Responsiveness */
@media (max-width: 600px) {
    .mwai-container.mwai-window {
        width: 90%;
        height: 70vh;
        bottom: 80px;
        right: 5%;
        max-width: none;
        border-radius: 20px;
    }

    /* Adjust trigger position if it overlaps bottom bar */
    .mwai-trigger {
        bottom: 20px;
        right: 20px;
    }
}
