/* ==========================================================================
   OSSA Newsletter - Linagora Design System
   ========================================================================== */

/* Variables Linagora - Couleurs extraites de linagora.com */
:root {
    --linagora-red: #c71f45;        /* rgb(199, 31, 69) - couleur principale */
    --linagora-red-hover: #c42d43;  /* rgb(196, 45, 67) - boutons */
    --linagora-red-dark: #a81939;
    --linagora-dark: #30353b;       /* rgb(48, 53, 59) - footer Linagora */
    --text-primary: #212529;        /* rgb(33, 37, 41) */
    --text-secondary: #4a4e52;      /* rgb(74, 78, 82) - menu */
    --text-muted: #818c99;
    --bg-light: #f5f5f7;
    --bg-white: #ffffff;
    --border-color: #dee2e6;
    --success: #198754;
    --success-dark: #157347;
    --error: #dc3545;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Skip to main content link (accessibility) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--linagora-red);
    color: white;
    padding: 8px 16px;
    z-index: 1001;
    transition: top 0.3s;
    text-decoration: none;
    font-weight: 500;
}

.skip-link:focus {
    top: 0;
}

::selection {
    background-color: var(--linagora-red);
    color: white;
}

::-moz-selection {
    background-color: var(--linagora-red);
    color: white;
}

input::selection,
textarea::selection {
    background-color: var(--linagora-red);
    color: white;
}

input::-moz-selection,
textarea::-moz-selection {
    background-color: var(--linagora-red);
    color: white;
}

/* Accent color for form controls (checkboxes, date pickers, etc.) */
:root {
    accent-color: var(--linagora-red);
}

/* Date input styling for WebKit browsers (Chrome, Edge, Safari) */
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-year-field {
    padding: 2px;
}

input[type="date"]::-webkit-datetime-edit-day-field:focus,
input[type="date"]::-webkit-datetime-edit-month-field:focus,
input[type="date"]::-webkit-datetime-edit-year-field:focus {
    background: #c71f45 !important;
    color: #ffffff !important;
    outline: none !important;
    border-radius: 2px;
}

/* Also try without type selector for broader compatibility */
::-webkit-datetime-edit-day-field:focus,
::-webkit-datetime-edit-month-field:focus,
::-webkit-datetime-edit-year-field:focus {
    background: #c71f45 !important;
    color: #ffffff !important;
}

/* Firefox date input */
input[type="date"]:focus {
    outline-color: #c71f45;
}

/* Highlight color for all inputs */
input:focus-visible {
    outline-color: #c71f45;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

main.container {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* ==========================================================================
   Navbar
   ========================================================================== */

.navbar {
    background-color: var(--linagora-dark);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar .brand {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar .brand::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 24px;
    background-color: var(--linagora-red);
    border-radius: 2px;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-links a:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.logout-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.user-email {
    color: var(--text-muted);
    margin-right: 1rem;
    font-size: 0.875rem;
}

/* ==========================================================================
   Main Content
   ========================================================================== */

main {
    flex: 1;
    padding: 2rem 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
    background-color: var(--linagora-dark);
    color: rgba(255, 255, 255, 0.7);
    padding: 1.5rem 0;
    text-align: center;
    margin-top: auto;
}

.footer p {
    font-size: 0.875rem;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.card-title {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    border-bottom: 3px solid var(--linagora-red);
    padding-bottom: 0.75rem;
    font-weight: 600;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: var(--bg-white);
}

.form-control:focus {
    outline: none;
    border-color: var(--linagora-red);
    box-shadow: 0 0 0 3px rgba(199, 31, 69, 0.15);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-primary {
    background-color: var(--linagora-red);
    color: white;
}

.btn-primary:hover {
    background-color: var(--linagora-red-hover);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: var(--success-dark);
}

.btn-secondary {
    background-color: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--linagora-red);
    color: var(--linagora-red);
}

.btn-outline:hover {
    background-color: var(--linagora-red);
    color: white;
}

.btn-danger {
    background-color: var(--error);
    color: white;
    border: none;
}

.btn-danger:hover {
    background-color: #bb2d3b;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.delete-form {
    display: inline;
}

/* ==========================================================================
   Alerts & Messages
   ========================================================================== */

.messages {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.alert-error {
    background-color: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

.alert-info {
    background-color: #cff4fc;
    color: #055160;
    border: 1px solid #b6effb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
    border: 1px solid #ffecb5;
}

.errorlist {
    color: var(--error);
    list-style: none;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ==========================================================================
   Subscription Sections
   ========================================================================== */

.subscription-section {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-white);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: box-shadow 0.2s;
}

.subscription-section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Frequency header */
.frequency-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.frequency-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-daily,
.badge-weekly,
.badge-monthly {
    background: linear-gradient(135deg, var(--linagora-red), #e63950);
    color: white;
}

.frequency-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.frequency-toggle label {
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}

.subscription-section input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--linagora-red);
    cursor: pointer;
}


/* ==========================================================================
   Tags Grid
   ========================================================================== */

.select-all-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.tag-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem;
    background: var(--bg-light);
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag-item:hover {
    background: #fff;
    border-color: var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.tag-item:has(input:checked) {
    background: #fef2f4;
    border-color: var(--linagora-red);
}

.tag-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 0.25rem;
    accent-color: var(--linagora-red);
    flex-shrink: 0;
}

.tag-item label {
    cursor: pointer;
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.tag-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tag-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.tag-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.tag-name {
    font-weight: 600;
    color: var(--text-primary);
    text-transform: capitalize;
}

.tag-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top: 2px;
}

/* ==========================================================================
   Authentication Pages
   ========================================================================== */

.auth-container {
    max-width: 420px;
    margin: 2rem auto;
}

.auth-container .card {
    padding: 2.5rem;
}

.auth-container .card-title {
    text-align: center;
    font-size: 1.5rem;
}

.auth-links {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.auth-links a {
    color: var(--linagora-red);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-links a:hover {
    color: var(--linagora-red-dark);
    text-decoration: underline;
}

/* ==========================================================================
   Profile Page
   ========================================================================== */

.profile-info {
    margin-bottom: 2rem;
}

.profile-info p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.profile-info strong {
    color: var(--text-primary);
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-linagora { color: var(--linagora-red); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 2rem; }

.w-full { width: 100%; }
.d-inline { display: inline; }

.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

.link-linagora {
    color: var(--linagora-red);
    text-decoration: none;
}

.link-linagora:hover {
    color: var(--linagora-red-dark);
    text-decoration: underline;
}

.intro-text {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.help-text {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer-brand {
    color: #fff;
    font-weight: 600;
}

.footer-sub {
    margin-top: 0.5rem;
    font-size: 0.75rem;
}

/* ==========================================================================
   Submissions Table
   ========================================================================== */

.submissions-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.submissions-table th,
.submissions-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.submissions-table th {
    background-color: var(--bg-light);
    font-weight: 600;
    color: var(--text-primary);
}

.submissions-table tbody tr:hover {
    background-color: var(--bg-light);
}

.submissions-table a {
    color: var(--linagora-red);
    text-decoration: none;
}

.submissions-table a:hover {
    text-decoration: underline;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-badge.status-processing {
    background-color: #cff4fc;
    color: #055160;
}

.status-badge.status-processed {
    background-color: #d1e7dd;
    color: #0f5132;
}

.status-badge.status-sent {
    background-color: #cfe2ff;
    color: #084298;
}

.status-badge.status-duplicate {
    background-color: #e2e3e5;
    color: #41464b;
}

.success-text {
    color: var(--success);
    font-size: 0.875rem;
}

.error-text {
    color: var(--error);
    font-size: 0.875rem;
}

.warning-text {
    color: #856404;
    font-size: 0.875rem;
}

.muted-text {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-style: italic;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.page-info {
    color: var(--text-secondary);
}

/* ==========================================================================
   SSO / OIDC Authentication
   ========================================================================== */

.sso-section {
    text-align: center;
}

.sso-intro {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.btn-sso {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--linagora-red) 0%, var(--linagora-red-dark) 100%);
    color: white;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-sso:hover {
    background: linear-gradient(135deg, var(--linagora-red-hover) 0%, var(--linagora-red-dark) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(199, 31, 69, 0.3);
    color: white;
}

.sso-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sso-notice {
    background-color: var(--bg-light);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border-left: 3px solid var(--linagora-red);
    font-size: 0.875rem;
}

/* ==========================================================================
   Articles Page
   ========================================================================== */

.articles-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.filter-card {
    padding: 1.5rem;
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.date-row .form-group {
    flex: 0 0 auto;
    min-width: 150px;
}

.search-group {
    flex: 1;
}

.search-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.search-input-wrapper .form-control {
    flex: 1;
}

.btn-search {
    flex-shrink: 0;
}

.semantic-search-options {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.semantic-search-option {
    display: flex;
    align-items: center;
}

.semantic-search-option .form-check-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: normal;
    color: var(--text-secondary);
}

.semantic-search-option .form-check-label:hover {
    color: var(--text-primary);
}

.semantic-search-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--linagora-red);
    cursor: pointer;
}

.similarity-threshold-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.similarity-threshold-option label {
    color: var(--text-secondary);
    font-weight: normal;
    white-space: nowrap;
}

.similarity-threshold-option .form-control-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    width: auto;
    min-width: 120px;
}

/* User autocomplete */
.user-search-group {
    flex: 1;
    min-width: 200px;
}

.user-autocomplete-wrapper {
    position: relative;
}

.user-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.user-autocomplete-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s;
}

.user-autocomplete-item:hover {
    background-color: var(--bg-light);
}

.user-autocomplete-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.user-autocomplete-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--linagora-red), #e63950);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-autocomplete-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-autocomplete-name {
    font-weight: 500;
    color: var(--text-primary);
}

.user-autocomplete-email {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-autocomplete-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.user-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.user-clear-btn:hover {
    color: var(--error);
}

.filter-section {
    margin-top: 0.5rem;
}

.filter-section-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.multi-tag-option {
    font-size: 0.875rem;
    font-weight: normal;
    color: var(--text-secondary);
}

.tags-filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.tag-filter-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background-color: var(--bg-light);
    border: 2px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.tag-filter-item:hover {
    border-color: var(--border-color);
}

.tag-filter-item:has(input:checked) {
    background-color: var(--tag-bg, #fef2f4);
    border-color: var(--border-color);
}

.tag-filter-item input[type="checkbox"] {
    display: none;
}

.tag-filter-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.tag-filter-label img {
    width: 16px;
    height: 16px;
}

/* Active filters */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: var(--bg-light);
    border-radius: 6px;
}

.active-filters-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.875rem;
}

.filter-remove {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    line-height: 1;
}

.filter-remove:hover {
    color: var(--error);
}

/* ==========================================================================
   Article Cards Grid
   ========================================================================== */

.articles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    align-items: stretch;
}

@media (max-width: 1100px) {
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.article-card {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

.article-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.article-card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-card-body .article-meta {
    margin-top: auto;
    padding-top: 0.75rem;
}

.article-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.article-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.article-title a:hover {
    color: var(--linagora-red);
}

.article-header {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.article-header .article-title {
    flex: 1;
}

/* Favorite button */
.favorite-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.favorite-btn:hover {
    background: rgba(199, 31, 69, 0.1);
}

.favorite-star {
    font-size: 1.25rem;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.favorite-btn:hover .favorite-star {
    color: var(--linagora-red);
    transform: scale(1.1);
}

.favorite-btn.active .favorite-star {
    color: #f4b400;
}

.favorite-btn.active:hover .favorite-star {
    color: #e6a700;
}

/* Upvote button */
.upvote-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.upvote-btn:hover {
    border-color: var(--linagora-red);
    color: var(--linagora-red);
}

.upvote-icon {
    font-size: 0.7rem;
    line-height: 1;
}

.upvote-count {
    font-weight: 600;
}

.upvote-btn.active {
    background: var(--linagora-red);
    border-color: var(--linagora-red);
    color: white;
}

.upvote-btn.active:hover {
    background: #a8192d;
    border-color: #a8192d;
}

/* Favorites filter option */
.search-options-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
    align-items: center;
}

.favorites-filter-option {
    display: flex;
    align-items: center;
}

.favorites-filter-option .form-check-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: normal;
    color: var(--text-secondary);
}

.favorites-filter-option .favorite-icon {
    color: #f4b400;
    font-size: 1rem;
}

.upvote-filter-option {
    display: flex;
    align-items: center;
}

.upvote-filter-option .form-check-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: normal;
    color: var(--text-secondary);
}

.upvote-filter-option .upvote-icon {
    color: var(--linagora-red);
    font-size: 0.85rem;
}

.popular-filter-option {
    display: flex;
    align-items: center;
}

.popular-filter-option .form-check-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: normal;
    color: var(--text-secondary);
}

.popular-filter-option .popular-icon {
    font-size: 0.9rem;
}

.importance-filter-options {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.importance-filter-option {
    display: flex;
    align-items: center;
}

.importance-filter-option .form-check-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.importance-filter-option .form-check-input {
    margin: 0;
    width: 16px;
    height: 16px;
    accent-color: var(--linagora-red);
    cursor: pointer;
}

.exact-importance-option,
.min-importance-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.exact-importance-option label,
.min-importance-option label {
    color: var(--text-secondary);
    font-weight: normal;
    white-space: nowrap;
}

.exact-importance-option .form-control-sm,
.min-importance-option .form-control-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    width: auto;
    min-width: 100px;
}

.sort-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.sort-option label {
    color: var(--text-secondary);
    font-weight: normal;
    white-space: nowrap;
}

.sort-option .form-control-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    width: auto;
    min-width: 140px;
}

.article-description-wrapper {
    position: relative;
    margin-bottom: 0.75rem;
}

.article-description,
.article-description-full {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.article-description.truncated {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0.5rem auto 0;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.expand-btn:hover {
    background: var(--linagora-red);
    border-color: var(--linagora-red);
}

.expand-btn:hover .expand-icon {
    color: white;
}

.expand-icon {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.article-description code,
.article-description-full code {
    background-color: rgba(199, 31, 69, 0.1);
    color: var(--linagora-red-dark);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 0.85em;
}

.article-description em,
.article-description-full em {
    font-style: italic;
    color: var(--text-primary);
}

.article-description strong,
.article-description-full strong {
    font-weight: 600;
    color: var(--text-primary);
}

.article-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.article-date-link,
.article-source-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.article-date-link:hover,
.article-source-link:hover {
    color: var(--linagora-red);
    text-decoration: underline;
}

.article-importance-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: transform 0.2s;
}

.article-importance-link:hover {
    transform: scale(1.1);
}

.article-language-link {
    text-decoration: none;
    font-size: 1rem;
    transition: transform 0.2s;
}

.article-language-link:hover {
    transform: scale(1.2);
}

.importance-stars {
    color: #f5a623;
    letter-spacing: 1px;
    font-size: 0.85rem;
}

.article-card-footer {
    padding: 1rem 1.25rem;
    background-color: var(--bg-light);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Article tags with pastel backgrounds */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.article-tag {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    transition: filter 0.2s, transform 0.2s;
}

.article-tag:hover {
    filter: brightness(0.95);
    transform: scale(1.05);
    text-decoration: none;
}

/* Primary tag highlight */
.article-tag.primary-tag {
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: var(--linagora-red);
    text-underline-offset: 2px;
}

/* Submitter info */
.article-submitter {
    flex-shrink: 0;
}

.submitter-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.submitter-link:hover {
    color: var(--linagora-red);
}

.submitter-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.submitter-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--linagora-red), #e63950);
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
}

.submitter-name {
    font-weight: 500;
}

/* ==========================================================================
   Avatar Upload in Profile
   ========================================================================== */

.avatar-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
    flex-shrink: 0;
}

.avatar-preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--linagora-red), #e63950);
    color: white;
    font-weight: 700;
    font-size: 2rem;
    border: none;
}

/* Profile tags */
.profile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 12px;
    color: #333;
    text-transform: capitalize;
}

.avatar-upload {
    flex: 1;
}

.avatar-upload-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.avatar-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Form row for inline fields */
.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .user-email {
        display: block;
        margin: 0 0 0.5rem 0;
        text-align: center;
        width: 100%;
    }

    .tags-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1.5rem;
    }

    .auth-container .card {
        padding: 1.5rem;
    }

    .articles-grid {
        grid-template-columns: 1fr;
    }

    .filter-row {
        flex-direction: column;
    }

    .search-input-wrapper {
        flex-direction: column;
    }

    .article-card-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .avatar-section {
        flex-direction: column;
        text-align: center;
    }

    .form-row {
        flex-direction: column;
    }

    .selection-bar {
        left: 0;
        right: 0;
        border-radius: 0;
    }
}

/* Article Selection Checkbox */
.article-select-checkbox {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 0.5rem;
}

.article-select-checkbox input[type="checkbox"] {
    display: none;
}

.article-select-checkbox .checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.article-select-checkbox:hover .checkbox-custom {
    border-color: var(--linagora-red);
}

.article-select-checkbox input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--linagora-red);
    border-color: var(--linagora-red);
}

.article-select-checkbox input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* Selection Bar */
.selection-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--linagora-dark);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    align-items: center;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.selection-bar-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.selection-count {
    font-weight: 500;
    white-space: nowrap;
}

#selection-count-number {
    font-weight: 700;
    font-size: 1.1rem;
}

.selection-actions {
    display: flex;
    gap: 0.75rem;
}

.selection-bar .btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
}

.selection-bar .btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

.selection-bar .btn-primary {
    background: var(--linagora-red);
    border-color: var(--linagora-red);
}

.selection-bar .btn-primary:hover {
    background: var(--linagora-red-hover);
}

.pdf-icon {
    margin-right: 0.25rem;
}

/* Loading spinner for PDF generation */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
}

/* Spinner pour boutons outline (fond clair) */
.btn-outline .loading-spinner {
    border-color: rgba(199, 31, 69, 0.3);
    border-top-color: var(--linagora-red);
}

/* Spinner pour boutons outline au survol (fond rouge) */
.btn-outline:hover .loading-spinner {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: white;
}

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

/* ==========================================================================
   Review Selection Page
   ========================================================================== */

.review-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 0;
}

.review-header {
    margin-bottom: 2rem;
}

.review-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.review-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

.review-articles {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.review-article-card {
    background: var(--bg-white);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.review-article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.review-reorder-controls {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-shrink: 0;
}

.btn-reorder {
    width: 28px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-reorder:hover:not(:disabled) {
    background: var(--linagora-red);
    border-color: var(--linagora-red);
    color: white;
}

.btn-reorder:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.review-custom-slide {
    border: 2px dashed var(--linagora-red);
    background: linear-gradient(135deg, #fff 0%, #fef7f8 100%);
}

.review-custom-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--linagora-red);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-danger-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    color: #dc3545;
    border: 1px solid #dc3545;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger-outline:hover {
    background: #dc3545;
    color: white;
}

@media (max-width: 768px) {
    .btn-danger-outline .btn-text-desktop {
        display: none;
    }
}

.review-article-title-section {
    flex: 1;
}

.review-article-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.review-article-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.review-article-title a:hover {
    color: var(--linagora-red);
}

.review-article-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.review-article-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.btn-ai {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ai:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-ai:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-ai-icon {
    font-size: 1.1rem;
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: var(--bg-light);
}

.ai-status[data-status="pending"] {
    color: var(--text-muted);
}

.ai-status[data-status="loading"] {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.ai-status[data-status="success"] {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.ai-status[data-status="error"] {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.review-article-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.review-original-link {
    text-decoration: none;
    font-size: 1rem;
}

.review-original-link:hover {
    opacity: 0.7;
}

.review-editable-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.review-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.review-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.review-input:focus {
    outline: none;
    border-color: var(--linagora-red);
    box-shadow: 0 0 0 3px rgba(199, 31, 69, 0.1);
}

.description-editor {
    min-height: 80px;
}

.review-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .review-content-grid {
        grid-template-columns: 1fr;
    }
}

.review-column {
    display: flex;
    flex-direction: column;
}

.review-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.review-label-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.review-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.review-textarea:focus {
    outline: none;
    border-color: var(--linagora-red);
    box-shadow: 0 0 0 3px rgba(199, 31, 69, 0.1);
}

.review-textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.review-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-white);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    bottom: 1rem;
}

.review-actions-left,
.review-actions-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-generate-pdf {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-icon {
    margin-right: 0.5rem;
}

@media (max-width: 640px) {
    .review-article-header {
        flex-direction: column;
    }

    .review-article-actions {
        width: 100%;
        justify-content: space-between;
    }

    .review-actions-bar {
        flex-direction: column;
        gap: 1rem;
    }

    .review-actions-left,
    .review-actions-right {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================================
   Error Pages (404, 500)
   ========================================================================== */

.error-page {
    text-align: center;
    padding: 3rem 2rem;
    max-width: 500px;
    margin: 2rem auto;
}

.error-page h1 {
    font-size: 6rem;
    font-weight: 700;
    color: var(--linagora-red);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.error-page h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.error-page p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
