/* ===================================
   COMMUN
   =================================== */

html, body {
    height: 100%;
    margin: 0;
}
body {
    background: url('/assets/home-background.png') no-repeat center center/cover;
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
}
body.no-background {
    background: none !important;
}
.page-wrapper {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}
main {
    flex: 1 0 auto;
}

/* ---------- BOOTSTRAP OVERRIDES ---------- */

a,
a:hover,
a:focus,
.btn,
.btn:hover,
.btn:focus,
.btn-action {
    text-decoration: none !important;
    box-shadow: none !important;
}
h1 {
    font-size: 1.8rem;
    color: #495057;
    font-weight: 600;
}
input[required],
select[required],
textarea[required] {
    border-left: 4px solid #dc3545;
    padding-left: 0.5rem;
}
input[required]::placeholder,
select[required]::placeholder,
textarea[required]::placeholder {
    color: #dc3545;
    opacity: 0.7;
}
.bootstrap-select .dropdown-toggle {
    display: block;
    width: 100% !important;
    padding: 0.375rem 2.25rem 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
.bootstrap-select {
    width: 100% !important;
}
.bootstrap-select .dropdown-menu {
    width: 100% !important;
    border-radius: 0;
    margin-top: 0;
    font-size: 1rem;
}
.bootstrap-select .dropdown-toggle:focus,
.bootstrap-select .dropdown-toggle:active,
.bootstrap-select.show .dropdown-toggle,
.bootstrap-select.keep-focus .dropdown-toggle {
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
    outline: 0 !important;
}
.hover-opacity-100:hover {
    opacity: 1 !important;
}

/* ---------- BASE CUSTOM ---------- */

.card {
    border-radius: 0.75rem;
    overflow: visible;
}
.card .table thead:first-child tr:first-child th:first-child {
    border-top-left-radius: 0.75rem;
}
.card .table thead:first-child tr:first-child th:last-child {
    border-top-right-radius: 0.75rem;
}
.card .table tbody:last-child tr:last-child td:first-child {
    border-bottom-left-radius: 0.75rem;
}
.card .table tbody:last-child tr:last-child td:last-child {
    border-bottom-right-radius: 0.75rem;
}
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.btn-add {
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
    color: #495057;
    border-radius: 8px;
    font-size: 0.9rem;
    padding: 0.45rem 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}
.btn-add:hover {
    background-color: #e9ecef;
    color: #212529;
}
.btn-action {
    border: 1px solid #ced4da;
    background-color: #fff;
    color: #495057;
    border-radius: 6px;
    font-size: 0.8rem;
    padding: 0.35rem 0.7rem;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-action:hover {
    background-color: #f1f3f5;
    color: #212529;
}
.alert-overlay {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 600px;
    z-index: 2000; /* plus haut que la navbar */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ---------- TABLE / PDF CUSTOM ---------- */
.table tbody td:not(.text-end) {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.table td.text-end {
    white-space: nowrap;
    width: 1%;
}
tr, td, th {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
}
th[colspan="2"] {
    text-align: center;
}
th.sub-col {
    width: 100px;
}
th .dropdown > a {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===================================
   THEME CLAIR (par défaut)
   =================================== */

/* ---------- HEADER ---------- */

.custom-navbar {
    background: linear-gradient(90deg, #f8f9fa, #e9f5f2);
    border-bottom: 1px solid #dee2e6;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1050;
}
.custom-navbar .nav-link {
    color: #2c3e50 !important;
    font-weight: 500;
    transition: color 0.2s ease-in-out;
}
.custom-navbar .nav-link:hover {
    color: #198754 !important;
}
.custom-navbar #darkModeToggle {
    border: 1px solid #ced4da;
    background-color: #ffffff;
    color: #2c3e50;
    margin-right: 0.75rem;
}
.custom-navbar #darkModeToggle:hover {
    background-color: #e9ecef;
}
.logo { max-width: 200px; }
.logo-light { display: inline; }
.logo-dark { display: none; }
.logo-light,
.logo-dark {
    height: 35px;
    width: auto;
}
.logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid #dc3545;
    background: transparent;
    color: #dc3545;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
}
.logout-btn:hover {
    background: #dc3545;
    color: #fff;
}
.account-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid #0d6efd;
    background: transparent;
    color: #0d6efd;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
}
.account-btn:hover {
    background: #0d6efd;
    color: #fff;
}
.navbar {
    padding-left: 1rem;
    padding-right: 1rem;
}
.navbar-toggler {
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    background-color: #ffffff;
}
.navbar-toggler:focus {
    box-shadow: 0 0 0 0.1rem rgba(0,0,0,0.2);
}
.logo-thumbnail {
    max-height: 40px;
}
.navbar-text { color: #212529; }
.lang-flag {
    width: 20px;
    height: 14px;
    object-fit: cover;
}
.custom-navbar .logout-btn,
.custom-navbar .account-btn,
.custom-navbar #darkModeToggle,
.custom-navbar #languageToggle {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.1rem;
    margin-right: 0.1rem;
}
#languageToggle.btn-light {
    border: 1px solid #ced4da;
    background-color: #fff;
}

/* ---------- CONTENT ---------- */

.page-container {
    position: relative;
    min-height: 80vh;
    color: #212529;
    background-color: rgba(255, 255, 255, 0.55);
    background-blend-mode: lighten;
    padding: 80px 2rem 2rem 2rem;
    width: 100%;
    min-width: 320px;
    box-sizing: border-box;
}
.page-container .content {
    position: relative;
    max-width: 1024px;
    z-index: 1;
}
.form-card {
    max-width: 1024px;
    background: var(--bs-body-bg);
}

/* ---------- CONTENT : LIST ---------- */

.table-hover tbody tr:hover {
    background-color: #f8f9fa;
    transition: background-color 0.2s ease-in-out;
}
.table td.text-end {
    white-space: nowrap;
    width: 1%;
}
.table td .d-flex {
    flex-wrap: nowrap !important;
}
.badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.3em 0.65em;
    border-radius: 0.35rem;
    font-weight: 400;
    background-color: #f1f3f5;
    color: #495057;
    border: 1px solid #dee2e6;
}
.badge-anonymous { background-color: #fff3cd; color: #856404; }
.badge-not-anonymous { background-color: #e2e3e5; color: #383d41; }
.badge-active { background-color: #d4edda; color: #155724; }
.badge-inactive { background-color: #f8d7da; color: #721c24; }
.description-cell {
    white-space: normal;
    word-wrap: break-word;
}

/* ---------- FOOTER ---------- */

footer {
    color: #6c757d;
    background-color: #fff;
    flex-shrink: 0;
    width: 100%;
    min-width: 320px;
    box-sizing: border-box;
}

/* ---------- CONTENT : LOGIN ---------- */

.login-container {
    max-width: 972px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    width: 100%;
    min-width: 320px;
    box-sizing: border-box;
}
.login-card {
    max-width: 100%;
    width: 100%;
    border-radius: 10px;
    background: #fff;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-align: center;
}
.login-options {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.login-alert {
    max-width: 100%;
    margin-bottom: 1rem;
}
.auth-section {
    text-align: center;
}
.auth-section .section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #495057;
}
.signup-text {
    font-size: 0.9rem;
    color: #6c757d;
}
.btn-google {
    background: #ffffff;
    color: #000000;
    border: 1px solid #dadce0;
    font-weight: 500;
    padding: 0.6rem 1rem;
    transition: background 0.3s, box-shadow 0.3s;
}
.btn-google:hover {
    background: #f7f8f8;
    box-shadow: 0 1px 3px rgba(60,64,67,0.2);
    color: #000000;
}
.google-logo {
    width: 25px;
    padding: 0 5px 3px 0;
}
.notify-btn:hover {
    background-color: var(--bs-primary);
    color: #fff;
    border-color: var(--bs-primary);
    transition: all 0.3s ease;
}

/* ---------- CONTENT : HOME ---------- */

.home-content {
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 50px;
}
.dashboard-card {
    max-width: 1024px;
    margin: 2rem auto;
    background: var(--bs-body-bg);
}
.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
    margin: auto;
}

/* ---------- CONTENT : ERROR ---------- */

.form-error {
    max-width: 972px;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important
}
.error-wrapper { min-height: 70vh; }
.error-card {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    margin: auto;
}
.error-card h1,
.error-card .error-title {
    color: var(--bs-emphasis-color);
    font-weight: 700;
}
.error-card p {
    color: var(--bs-body-color);
    font-size: 0.95rem;
    line-height: 1.6;
}
.error-icon i { font-size: 3rem; }

/* ---------- SPECIFIC CONDOMINIUM ---------- */

#logoPreview {
    display:none;
    max-height:60px;
    border:1px solid #ccc;
    padding:2px;
    border-radius:4px;
}

/* ---------- SPECIFIC USER ---------- */

.role-badge {
    background-color: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
}

/* ---------- SPECIFIC EVENT ---------- */

.photo-preview-new {
    max-height: 150px;
}
.photo-preview-existing {
    max-height: 50vh;
    object-fit: contain;
}
.preview-thumb {
    max-width: 100%;
    cursor: pointer;
}
.zoom-icon {
    display: none;
    pointer-events: none;
}
.position-relative:hover .zoom-icon {
    display: block;
    background: rgba(0,0,0,0.4);
    padding: 10px;
    border-radius: 50%;
}
.preview-creation {
    height: 100%;
    object-fit: cover;
    max-height: none;
}
.preview-edition {
    max-height: 150px;
    object-fit: contain;
}
.col-etat .d-flex {
    gap: 0.35rem;
}
#statusFilterIcon {
    cursor: pointer;
    transition: color 0.2s;
}
#statusFilterIcon.active {
    color: #0d6efd;
}
.photo-slot { height: 100%; background: var(--bs-body-bg); }
.photo-viewport {
    width: 100%;
    /* Ratio 4/3 pour laisser de la place à la miniature */
    aspect-ratio: 4 / 3;
    position: relative;
    overflow: hidden;
}
.photo-viewport video,
.photo-viewport img,
.photo-viewport .placeholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.photo-viewport .placeholder { object-fit: cover; }

/* ---------- LOADER OVERLAY ---------- */

.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    display: none;
}
.loader-spinner {
    width: 4rem;
    height: 4rem;
    border: 6px solid #dee2e6;
    border-top: 6px solid #0d6efd;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}


/* ===================================
   THEME SOMBRE
   =================================== */

/* ---------- COMMON ---------- */

.dark {
    background: #121212;
    color: #e0e0e0;
}
.dark input[required],
.dark select[required],
.dark textarea[required] {
    border-left: 4px solid #ff6b6b;
}
.dark .text-muted { color: #aaa !important; }
.dark .role-badge { background-color: #2c2c2c; color: #ddd; }
.dark .btn-add {
    background-color: #2c2c2c;
    border: 1px solid #444;
    color: #e0e0e0;
}
.dark .btn-add:hover { background-color: #3a3a3a; color: #fff; }
.dark .btn-action {
    background-color: #2c2c2c;
    border: 1px solid #444;
    color: #e0e0e0;
}
.dark .btn-action:hover { background-color: #3a3a3a; color: #fff; }

/* ---------- HEADER ---------- */

.dark .custom-navbar {
    background: #1e1e1e;
    border-bottom: 1px solid #333;
}
.dark .custom-navbar .nav-link { color: #e0e0e0 !important; }
.dark .custom-navbar .nav-link:hover { color: #20c997 !important; }
.dark .custom-navbar #darkModeToggle {
    border: 1px solid #444;
    background-color: #2c2c2c;
    color: #e0e0e0;
}
.dark .custom-navbar #darkModeToggle:hover { background-color: #3a3a3a; }
.dark .custom-navbar .navbar-toggler-icon {
    filter: invert(80%) sepia(0%) saturate(0%) hue-rotate(0deg);
}
.dark .logo-light { height: 35px; display: none; }
.dark .logo-dark { height: 35px; display: inline; }
.dark .logout-btn {
    border-color: #ff6b6b;
    color: #ff6b6b;
}
.dark .logout-btn:hover {
    background: #ff6b6b;
    color: #fff;
}
.dark .account-btn {
    border-color: #0d6efd;
    color: #0d6efd;
}
.dark .account-btn:hover {
    background: #0d6efd;
    color: #fff;
}
.dark .navbar-text { color: #e9ecef; }
.dark .navbar-toggler {
    border: 1px solid #444;
    background-color: #2c2c2c;
}
.dark .navbar-toggler:focus {
    box-shadow: 0 0 0 0.1rem rgba(255,255,255,0.2);
}
.dark .custom-navbar #languageToggle,
.dark .custom-navbar #darkModeToggle,
.dark .custom-navbar .logout-btn {
    background-color: #2c2c2c;
    border: 1px solid #444;
    color: #e0e0e0;
}
.dark .custom-navbar #languageToggle:hover,
.dark .custom-navbar #darkModeToggle:hover,
.dark .custom-navbar .logout-btn:hover {
    background-color: #3a3a3a;
}

/* ---------- CONTENT ---------- */

.dark .page-container {
    background-color: rgba(18, 18, 18, 0.85);
    background-blend-mode: multiply;
    color: #e0e0e0;
}
.dark .form-card { background: #1e1e1e; }
.dark .login-card,
.dark .card {
    background: #1e1e1e;
    border: 1px solid #333;
}
.dark .table { color: #e0e0e0; }
.dark .table thead { background-color: #2c2c2c; color: #f1f1f1; }
.dark .table-hover tbody tr:hover { background-color: #2a2a2a; }
.dark .badge { border: 1px solid #444; }
.dark .badge-anonymous { background-color: #3a2f00; color: #ffda6a; }
.dark .badge-not-anonymous { background-color: #343a40; color: #adb5bd; }
.dark .badge-active { background-color: #0f5132; color: #d1e7dd; }
.dark .badge-inactive { background-color: #842029; color: #f8d7da; }
.dark .error-card {
    background: #1e1e1e;
    border: 1px solid #333;
    color: #e0e0e0;
}
.dark .error-card h1,
.dark .error-card .error-title { color: #ffffff; }
.dark .error-card p { color: #e0e0e0; }
.dark .form-label,
.dark .form-check-label,
.dark .form-text { color: #e0e0e0; }
.dark .chart-container {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 1rem;
}
.dark .chartjs-render-monitor {
    color: #e0e0e0 !important;
}
.dark .chartjs-render-monitor .legend,
.dark .chartjs-render-monitor text,
.dark .chartjs-render-monitor tspan {
    fill: #e0e0e0 !important;
    color: #e0e0e0 !important;
}
.dark .chartjs-render-monitor .grid line {
    stroke: #444 !important;
}
.dark .dashboard-card h2 {
    color: #aaa;
}
.dark .dashboard-card h3 {
    color: #aaa;
}
.dark #statusFilterIcon {
    color: #bbb;
}
.dark #statusFilterIcon.text-primary {
    color: #20c997 !important;
}

/* ---------- FOOTER ---------- */

.dark footer { color: #aaa; }

/* ---------- LOADER OVERLAY ---------- */

.dark .loader-overlay {
    background: rgba(18, 18, 18, 0.8);
}
.dark .loader-spinner {
    border: 6px solid #444;
    border-top: 6px solid #20c997;
}

/* ===================================
   FRAMES
   =================================== */

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (min-width: 992px) {
    .login-options {
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
        gap: 2rem;
    }
    .login-options .auth-section {
        flex: 1;
        max-width: 400px;
        border: 1px solid #dee2e6;
        border-radius: 10px;
        padding: 1rem;
        background: #fff;
    }
    .dark .login-options .auth-section {
        background: #1e1e1e;
        border: 1px solid #333;
    }
}
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: transparent !important;
        border: none !important;
        padding: 1rem 0;
    }
    .navbar-collapse .nav-link {
        display: block;
        text-align: center;
        margin: 0.4rem auto;
        border: 1px solid #dadce0;
        border-radius: 6px;
        background: #ffffff;
        color: #000000 !important;
        font-weight: 500;
        padding: 0.6rem 1rem;
        transition: background 0.3s, box-shadow 0.3s;
        width: 90%;
        max-width: 300px;
    }
    .navbar-collapse .nav-link:hover {
        background: #f7f8f8;
        box-shadow: 0 1px 3px rgba(60,64,67,0.2);
    }
    .navbar-collapse #darkModeToggle {
        display: block;
        margin: 1rem auto 0 auto;
        border: 1px solid #dadce0;
        background: #fff;
        color: #000;
        border-radius: 6px;
        padding: 0.6rem 1rem;
        width: 90%;
        max-width: 300px;
        text-align: center;
    }
    .navbar-collapse #languageToggle {
        display: block;
        margin: 0.5rem auto;
        border: 1px solid #dadce0;
        background: #ffffff;
        color: #000000;
        border-radius: 6px;
        padding: 0.6rem 1rem;
        width: 90%;
        max-width: 300px;
        text-align: center;
    }
    .dark .navbar-collapse #languageToggle {
        background: #2c2c2c;
        border: 1px solid #444;
        color: #e0e0e0;
    }
    .dark .navbar-collapse .nav-link {
        background: #2c2c2c;
        border: 1px solid #444;
        color: #e0e0e0 !important;
    }
    .dark .navbar-collapse .nav-link:hover {
        background: #3a3a3a;
    }
    .dark .navbar-collapse #darkModeToggle {
        background: #2c2c2c;
        border: 1px solid #444;
        color: #e0e0e0;
    }
    .login-options {
        flex-direction: column;
        gap: 1.5rem;
    }
    .login-options .auth-section {
        flex: 1 1 100%;
        max-width: 100% !important;
        width: 100% !important;
        border: none;
        border-radius: 0;
        padding: 1rem;
    }
}
@media (min-width: 576px) and (max-width: 767.98px) {
    .btn-action span { display: none !important; }
    .btn-action {
        padding: 0.35rem 0.6rem;
        font-size: 0.85rem;
        border-radius: 6px;
    }
    td .d-flex {
        flex-wrap: nowrap !important;
        gap: 0.3rem !important;
    }
    .badge {
        font-size: 0.65rem !important;
        padding: 0.2em 0.4em !important;
    }
}
@media (max-width: 575.98px) {
    .btn-action {
        border-radius: 50% !important;
        width: 2.4rem;
        height: 2.4rem;
        padding: 0 !important;
    }
    .btn-action span { display: none !important; }
    .navbar-text { display: none !important; }
    #darkModeToggle { margin-right: 0.5rem; }
}
@media (min-width: 576px) {
    .condo-select-sm {
        min-width: 160px;
        width: auto !important;
    }
}
@media (max-width: 400px) {
    .logo-thumbnail {
        display: none;
    }
}
