/* Layout application Elle et Moi */

:root {
    --sidebar-width: 250px;
    --sidebar-bg: #f8f9fa;
    --sidebar-border: #dee2e6;
    --brand-color: #d12424;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background-color: #f5f6f8;
    min-height: 100vh;
}

/* Guest layout (login) */
.guest-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.guest-card {
    width: 100%;
    max-width: 400px;
}

/* Error pages */
.error-page-wrapper {
    background: linear-gradient(160deg, #f5f6f8 0%, #eceef2 100%);
}

.error-page-card {
    width: 100%;
    max-width: 480px;
    border: none;
}

.error-page-icon {
    width: 4.5rem;
    height: 4.5rem;
    margin-inline: auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(209, 36, 36, 0.1);
    color: var(--brand-color);
    font-size: 1.75rem;
}

.error-page-code {
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--brand-color);
    letter-spacing: -0.02em;
}

.error-page-title {
    color: #2c2c2c;
}

.clickable-table-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.clickable-table-row:hover,
.clickable-table-row:focus-visible {
    background-color: rgba(209, 36, 36, 0.06);
    outline: none;
}

.clickable-table-row:hover .clickable-table-row-hint,
.clickable-table-row:focus-visible .clickable-table-row-hint {
    color: var(--brand-color) !important;
}

/* App layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.app-brand {
    padding: 1rem;
    border-bottom: 1px solid var(--sidebar-border);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-brand:hover {
    opacity: 0.92;
}

.app-brand-logo {
    max-width: 100%;
    height: auto;
    max-height: 72px;
    object-fit: contain;
}

.guest-brand-logo {
    max-width: 220px;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.rental-invoice-logo {
    max-width: 200px;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background: #fff;
    border-bottom: 1px solid var(--sidebar-border);
    padding: 1rem 1.75rem;
    min-height: 4.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.35rem 0.85rem 0.35rem 0.35rem;
    border: 1px solid var(--sidebar-border);
    border-radius: 999px;
    background: #fff;
    color: #333;
    line-height: 1.2;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.user-menu-trigger:hover,
.user-menu-trigger:focus,
.user-menu-trigger.show {
    color: #333;
    background: #faf9fb;
    border-color: #cfc6d4;
    box-shadow: 0 2px 8px rgba(84, 58, 97, 0.08);
}

.user-menu-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: linear-gradient(145deg, #f3eef5, #e8dfea);
    color: var(--brand-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    flex-shrink: 0;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(209, 36, 36, 0.12);
}

.user-menu-avatar-lg {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 0.95rem;
}

.user-menu-label {
    font-size: 0.9rem;
    font-weight: 600;
    max-width: 10rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-chevron {
    font-size: 0.65rem;
    color: #8a8490;
    transition: transform 0.15s ease;
}

.user-menu-trigger.show .user-menu-chevron {
    transform: rotate(180deg);
}

.user-menu-btn {
    color: var(--brand-color);
    padding: 0.25rem 0.5rem;
    border: none;
    background: transparent;
    line-height: 1;
}

.user-menu-btn:hover,
.user-menu-btn:focus,
.user-menu-btn.show {
    color: #543a61;
    background: #f0eef2;
    box-shadow: none;
}

.dropdown-toggle-no-caret::after {
    display: none;
}

.user-dropdown-menu {
    min-width: 260px;
    border: 1px solid var(--sidebar-border);
    padding: 0.35rem 0;
    margin-top: 0.5rem !important;
}

.user-dropdown-header {
    padding: 1rem 1rem 0.85rem;
}

.user-dropdown-menu .dropdown-item-text {
    padding: 0.5rem 1rem;
    color: #333;
}

.app-content {
    padding: 1.5rem;
    flex: 1;
}

/* Sidebar navigation */
.sidebar-nav {
    padding: 0.75rem 0;
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    padding: 0.75rem 1rem 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: #e9ecef;
    color: #333;
}

.sidebar-link.active {
    background: #e9ecef;
    border-left-color: var(--brand-color);
    font-weight: 500;
}

.sidebar-link i {
    width: 1.25rem;
    text-align: center;
    color: #6c757d;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    color: #333;
    font-size: 0.9rem;
    cursor: pointer;
    text-align: left;
}

.sidebar-toggle:hover {
    background: #e9ecef;
}

.sidebar-submenu {
    padding-left: 0.5rem;
}

.sidebar-submenu .sidebar-link {
    padding-left: 2rem;
    font-size: 0.85rem;
}

/* Stat cards */
.stat-card {
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    height: 100%;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: #333;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #6c757d;
}

.stat-card .stat-icon {
    font-size: 1.5rem;
    color: var(--brand-color);
    opacity: 0.7;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

.table-card {
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.quick-action-btn {
    padding: 0.75rem 1.5rem;
}

.mobile-sidebar-toggle,
.app-sidebar-close {
    display: none;
}

@media (max-width: 767.98px) {
    .app-sidebar.offcanvas-md.offcanvas-start {
        width: min(var(--sidebar-width), calc(100vw - 3rem));
        background: var(--sidebar-bg);
        z-index: var(--bs-offcanvas-zindex, 1045);
    }

    .mobile-sidebar-toggle {
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        padding: 0;
        color: #333;
        border: 1px solid var(--sidebar-border);
        background: #fff;
    }

    .mobile-sidebar-toggle:hover,
    .mobile-sidebar-toggle:focus-visible {
        color: var(--brand-color);
        border-color: var(--brand-color);
    }

    .app-sidebar-close {
        display: block;
        position: absolute;
        top: 1.5rem;
        right: 1rem;
    }

    .app-main {
        margin-left: 0;
    }

    .app-header {
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    .app-header-page {
        min-width: 0;
    }
}

/* User / personnel pages */
.user-card {
    transition: box-shadow 0.2s ease;
}

.user-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #f0eef2;
    color: var(--brand-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.user-avatar-lg {
    width: 72px;
    height: 72px;
    font-size: 1.75rem;
}

.detail-list dt {
    color: #6c757d;
    font-weight: 500;
}

.user-form .form-label {
    font-weight: 500;
    font-size: 0.9rem;
}

.flash-alert {
    margin-bottom: 1rem;
}

/* Account cards & movements */
.account-card {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

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

.account-card-name {
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 0.75rem;
}

.account-card-amount {
    line-height: 1.1;
    color: #333;
}

.movement-credit td {
    background-color: rgba(25, 135, 84, 0.06);
}

.movement-debit td {
    background-color: rgba(220, 53, 69, 0.06);
}

.permission-switch .form-check-label {
    font-size: 0.9rem;
    cursor: pointer;
}

.report-sections .form-check {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.25rem;
    border-radius: 0.375rem;
    background: #f8f9fa;
}

.size-card {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    min-height: 100px;
}

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

.media-card {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    overflow: hidden;
}

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

.media-card-img {
    height: 180px;
    object-fit: cover;
    width: 100%;
}

.media-card-placeholder {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0eef2;
}

.media-select-card {
    cursor: pointer;
    position: relative;
}

.media-select-checkbox {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 2;
    width: 1.1rem;
    height: 1.1rem;
}

.media-preview-thumb {
    max-height: 160px;
    object-fit: cover;
}

.currency-stat-card .currency-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.currency-stat-card .currency-stat-row:last-child {
    border-bottom: none;
}

.account-chart-wrapper {
    position: relative;
    height: 220px;
    width: 100%;
}

.account-chart-wrapper canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.item-card-incomplete {
    border-left: 4px solid #ffc107;
}

.item-unit-row {
    transition: box-shadow 0.15s ease;
}

.item-unit-row:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.item-detail-main-image {
    max-height: 420px;
    object-fit: cover;
    width: 100%;
}

.item-detail-gallery .media-card-img {
    height: 140px;
}

/* Item show page */
.btn-item-action {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 0.625rem;
}

.item-related-table {
    margin-bottom: 0;
}

.item-related-table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    background: #fafbfc;
    border-bottom: 1px solid #eceef2;
    padding: 0.85rem 1.25rem;
    white-space: nowrap;
}

.item-related-table tbody td {
    padding: 0.75rem 1.25rem;
    vertical-align: middle;
}

.item-related-table-img-col {
    width: 5.5rem;
}

.item-related-table-img {
    display: block;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.5rem;
    object-fit: cover;
    flex-shrink: 0;
}

.item-related-table-img--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f5;
    color: #adb5bd;
    font-size: 1rem;
}

.item-related-table-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c2c2c;
}

.item-units-table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    background: #fafbfc;
    border-bottom: 1px solid #eceef2;
    padding: 1rem 1.25rem;
    white-space: nowrap;
}

.item-units-table tbody td {
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    vertical-align: middle;
}

.item-units-table tbody tr:hover {
    background-color: rgba(209, 36, 36, 0.04);
}

.item-units-table tfoot th {
    padding: 1rem 1.25rem;
    font-size: 0.85rem;
    background: #fafbfc;
    border-top: 2px solid #eceef2;
}

.item-index-table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    background: #fafbfc;
    padding: 0.85rem 1.25rem;
    white-space: nowrap;
}

.item-index-table tbody td {
    padding: 0.75rem 1.25rem;
    vertical-align: middle;
}

.item-index-img-col {
    width: 5rem;
}

.item-index-thumb {
    display: block;
    width: 3rem;
    height: 3rem;
    border-radius: 0.5rem;
    object-fit: cover;
}

.item-index-thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f5;
    color: #adb5bd;
}

/* Rental wizard & invoice */
.rental-wizard-steps .rental-wizard-step {
    flex: 1;
    min-width: 120px;
}

.rental-wizard-step-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background: #f5f3f7;
    color: #6c757d;
    text-decoration: none;
    font-size: 0.875rem;
}

.rental-wizard-step.active .rental-wizard-step-link {
    background: var(--bs-primary);
    color: #fff;
}

.rental-wizard-step.done .rental-wizard-step-link {
    background: #e8f5e9;
    color: #2e7d32;
}

.rental-wizard-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    font-size: 0.75rem;
    font-weight: 600;
}

.rental-wizard-step.active .rental-wizard-step-num {
    background: rgba(255, 255, 255, 0.25);
}

.rental-invoice {
    border-top: 3px solid var(--bs-primary);
}

.rental-invoice-header .letter-spacing {
    letter-spacing: 0.15em;
}

.field-auto {
    pointer-events: none;
}

.rental-list-card {
    transition: box-shadow 0.15s ease;
}

.rental-list-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.rental-status-badge.rental-status-confirme {
    background: #e3f2fd;
    color: #1565c0;
}

.rental-status-badge.rental-status-en_cours {
    background: #fff3e0;
    color: #ef6c00;
}

.rental-status-badge.rental-status-termine {
    background: #e8f5e9;
    color: #2e7d32;
}

.rental-status-badge.rental-status-annulee {
    background: #fce4ec;
    color: #c62828;
}

.appointment-card {
    transition: box-shadow 0.15s ease;
}

.appointment-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

/* User menu */
.user-menu-dropdown {
    display: flex;
    align-items: center;
}

.user-dropdown-name {
    display: block;
    padding: 0;
    white-space: normal;
    line-height: 1.3;
}

.user-dropdown-menu .dropdown-item {
    padding: 0.55rem 1rem;
}

.user-dropdown-menu .dropdown-item:hover {
    background-color: #f8f6fa;
}

/* Filter toolbars */
.filter-toolbar .filter-form {
    margin-bottom: 0;
}

.filter-toolbar .filter-form .mb-3 {
    margin-bottom: 0 !important;
}

.filter-toolbar .filter-actions {
    height: 100%;
    align-items: stretch;
}

.filter-toolbar .filter-actions .btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 992px) {
    .filter-toolbar .filter-actions {
        padding-top: 1.75rem;
    }
}

/* Item forms & units */
.item-form-full .item-edit-main-preview {
    max-height: 280px;
    object-fit: cover;
}

.item-units-collection .item-unit-row .form-label {
    margin-bottom: 0.25rem;
}

.item-units-collection .item-unit-row .mb-3 {
    margin-bottom: 0 !important;
}

.sensitive-actions-card {
    border: 1px solid #f5c2c7;
}

.sensitive-actions-card .card-header {
    background: #fff5f5 !important;
}

/* Rental detail tabs */
.rental-detail-tabs {
    border-bottom: 1px solid var(--sidebar-border);
    gap: 0.25rem;
}

.rental-detail-tabs .nav-link {
    color: #6c757d;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.75rem 1rem;
    display: inline-flex;
    align-items: center;
}

.rental-detail-tabs .nav-link:hover {
    color: #333;
    border-bottom-color: #dee2e6;
}

.rental-detail-tabs .nav-link.active {
    color: var(--brand-color);
    background: transparent;
    border-bottom-color: var(--brand-color);
    font-weight: 500;
}

.rental-detail-tab-content {
    padding-top: 0.25rem;
}

.rental-amount-summary > div {
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 0.375rem;
}

/* Rental wizard form sections */
.rental-wizard-form section.card {
    overflow: visible;
}

.rental-wizard-form .form-text,
.rental-wizard-form .help-text,
.rental-wizard-form .form-help {
    color: #6c757d;
    font-size: 0.875rem;
}

.delete-form-inline {
    display: inline-block;
    margin: 0;
}

/* Rental all list */
.rental-all-filters .rental-filter-section-label {
    letter-spacing: 0.04em;
}

.rental-all-filters .filter-actions {
    padding-top: 0;
}

@media (min-width: 992px) {
    .rental-all-filters .filter-actions {
        padding-top: 1.75rem;
    }
}

.rental-all-table-card .table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
    white-space: nowrap;
}

.rental-all-table tbody tr {
    cursor: default;
}

.rental-all-table tbody tr:hover {
    background-color: #f8f9fa;
}

.cash-closing-status {
    font-size: 0.75rem;
}

.cash-closing-status-attente_validation {
    background: #fff3cd;
    color: #856404;
}

.cash-closing-status-valide {
    background: #e8f5e9;
    color: #2e7d32;
}

.cash-closing-table .badge {
    font-weight: 500;
}

/* Dashboard */
.dashboard-hero {
    background: linear-gradient(135deg, rgba(209, 36, 36, 0.08) 0%, rgba(209, 36, 36, 0.02) 55%, #fff 100%);
    border: 1px solid rgba(209, 36, 36, 0.12);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
}

.dashboard-hero-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-hero-eyebrow {
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--brand-color);
    font-weight: 600;
}

.dashboard-kpi {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    height: 100%;
    padding: 1.1rem 1rem;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    color: inherit;
}

a.dashboard-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    color: inherit;
}

.dashboard-kpi-alert {
    border-color: rgba(209, 36, 36, 0.35);
    background: linear-gradient(180deg, rgba(209, 36, 36, 0.06), #fff 70%);
}

.dashboard-kpi-icon {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: rgba(209, 36, 36, 0.1);
    color: var(--brand-color);
    font-size: 0.95rem;
}

.dashboard-kpi-icon-soft {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

.dashboard-kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    color: #212529;
}

.dashboard-kpi-label {
    font-size: 0.82rem;
    color: #6c757d;
}

.dashboard-panel .card-header strong {
    font-size: 1rem;
}

.dashboard-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    margin-bottom: 0.65rem;
}

.dashboard-feed-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dashboard-feed-item:last-child {
    border-bottom: 0;
}

.dashboard-feed-item-alert {
    background: rgba(209, 36, 36, 0.04);
    margin: 0 -0.35rem;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
    border-radius: 0.5rem;
    border-bottom-color: transparent;
}

.dashboard-feed-title {
    font-weight: 600;
    color: #212529;
}

.dashboard-feed-title:hover {
    color: var(--brand-color);
}

.dashboard-feed-meta {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    color: #6c757d;
}

.dashboard-table td,
.dashboard-table th {
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

@media (max-width: 575.98px) {
    .dashboard-hero {
        padding: 1rem;
    }

    .dashboard-kpi-value {
        font-size: 1.45rem;
    }
}
