@import "style.css";
@import "forms.css";
@import "table.css";
@import "detail.css";

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

header {
    min-height: 72px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4em;
}

#app_title {
    font-size: 1.4em;
}

#nav {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 30px;
    height: 30px;
    z-index: 50;
    border: 4px solid rgb(94, 94, 94);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease-out;
}

.switch-view {
    width: 20px;
    height: 20px;
    margin: 20px 30px;
    padding: 0px;
    background: none;
}

/* ----------------- NAV ----------------- */

:root {
    --sidebar-width: 300px;
}

#main-wrap {
    transition: margin-left 0.3s ease;
}

body.sidebar-open #main-wrap {
    margin-left: var(--sidebar-width);
}

#sidebar {
    padding-top: 100px;
    width: 0;
    min-width: 0;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background-color: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(6px);
    overflow-x: hidden;
    transition: width 0.3s ease;
    box-shadow: 2px 2px 10px 0px rgba(138, 138, 138, 0.2);
    z-index: 40;
    border-top-right-radius: 14px;
    border-bottom-right-radius: 14px;
}

#sidebar ul.sidebar-list {
    list-style-type: none;
    padding: 16px 12px;
    margin: 0;
}

#sidebar ul li {
    padding: 6px 12px;
    white-space: nowrap;
    overflow: hidden;
    transition: width 0.3s;
    font-size: 1.05em;
}

/* Section labels */
.sidebar-section-label {
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b6b6b;
    margin-top: 14px;
    margin-bottom: 4px;
    padding-left: 12px !important;
}

.sidebar-section-label:first-child {
    margin-top: 0;
}

/* Divider */
.sidebar-divider {
    height: 0;
    padding: 0 !important;
    margin: 12px 8px;
    border-bottom: 1px solid #e5e5e5;
    list-style: none;
}

/* Main nav links */
.main-li {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.main-li > a:first-child {
    font-weight: 600;
    font-size: 1.1em;
    color: #1a1a1a;
    text-decoration: none;
    flex: 1;
    padding: 9px 8px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
    border-left: 2px solid transparent;
}

.main-li > a:first-child:hover {
    background: #f3f3f3;
    color: #000;
    border-left-color: #b5b5b5;
    transform: translateX(1px);
}

.sidebar-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 6px;
    color: #555;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-add:hover {
    background: #e8e8e8;
    color: #1a1a1a;
}

#sidebar a:focus-visible,
#sidebar button:focus-visible,
#sidebar input:focus-visible {
    outline: 2px solid #9a9a9a;
    outline-offset: 1px;
    border-radius: 6px;
}

.sidebar-add .icon-sm {
    width: 14px;
    height: 14px;
}

/* Form block in sidebar */
.sidebar-form-li {
    padding: 8px 12px !important;
}

.sidebar-form {
    margin: 0;
}

.sidebar-field-label {
    display: block;
    font-size: 0.78em;
    color: #6b6b6b;
    margin-bottom: 4px;
    font-weight: 500;
}

.sidebar-form-row {
    gap: 8px;
}

.sidebar-form-row input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    font-size: 0.95em;
    border-radius: 6px;
    border: 1px solid #cfcfcf;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-form-row input:focus {
    outline: none;
    border-color: #888;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

.sidebar-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid #d0d0d0;
    background: #fafafa;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.sidebar-btn:hover {
    background: #f0f0f0;
    border-color: #bbb;
}

.sidebar-btn .icon {
    width: 16px;
    height: 16px;
    opacity: 0.8;
}

/* Sign out — style distinct du reste du menu */
.sidebar-signout {
    margin-top: 8px;
}

.sidebar-signout-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: #7e7e7e;
    text-decoration: none;
    padding: 8px 4px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-signout-link:hover {
    background: #f5f5f5;
    color: #4f4f4f;
}

.sidebar-signout-link .icon-sm {
    width: 13px;
    height: 13px;
    opacity: 0.85;
}

.icon.icon-sm {
    width: 14px;
    height: 14px;
}

#sidebar.active {
    width: var(--sidebar-width);
    z-index: 40;
}

@media only screen and (max-width: 650px) {
    body.sidebar-open #main-wrap {
        margin-left: 0;
    }

    #sidebar.active {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    #sidebar ul.sidebar-list {
        margin: 0 auto;
        width: 60%;
        max-width: 280px;
    }
}

.form-inline {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.form-inline input {
    margin: 0;
}

.form-inline button {
    background: none;
}

#logout {
    width: 15px;
    margin: 15px;
}

/* ----------------- COLLECTION ----------------- */

section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 5vw 20px 8% 20px;
}

.gallery {
    margin: 5vw 20px 4% 20px;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.gallery .small-button {
    background: white;
}

.gallery .image-container {
    position: relative;
}

.gallery .image-container img.object-image {
    height: auto;
    max-height: 90vh;
    width: auto;
}

.gallery .image-container img.object-image.landscape {
    max-width: 800px;
}

.gallery .image-container img.object-image.portrait {
    max-width: 500px;
}

.gallery .edit-icons {
    position: absolute;
    top: 20;
    right: 20;
    opacity: 0;
    transition: opacity 0.3s;
}

.gallery .image-container:hover .edit-icons {
    opacity: 1;
}

.collection {
    padding: 50px;
    justify-content: center;

    flex-wrap: wrap;
    gap: 40px 40px;
}

.card {
    max-width: 220px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 2px 2px 10px 0px rgba(138, 138, 138, 0.2);
}

.card-object img {
    width: 220px;
    height: 220px;
}

.card-person img {
    width: 220px;
    height: 280px;
}

.cat {
    width: 150px;
    height: 150px;
}

.thumbnail {
    object-fit: cover;
    object-position: center;
}

.card div {
    padding: 20px;
}

.card p {
    padding: 3px;
    margin: 0px;
}

footer {
    min-height: 20px;
}

.form {
    justify-content: center;
    flex-direction: column;
}

#edit-title-form form {
    display: flex;
    flex-direction: row;
    margin-top: 30px;
    align-items: center;
    gap: 20px;
}

#edit-title-form input {
    margin: 0;
    width: 160px;
    border-radius: 10px;
    /* Vous pouvez ajuster le rayon pour obtenir l'arrondi souhaité */
    padding: 10px;
    /* Ajoutez du padding pour l'espace intérieur du champ d'entrée */
    border: 1px solid #ccc;
    /* Ajoutez une bordure pour la visibilité */
}

@media only screen and (max-width: 550px) {
    section {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        margin: 5vw 20px 8% 20px;
    }
}

/* Categories table layout */
.categories-section {
    width: 100%;
    max-width: 500px;
    margin: 40px auto 60px auto;
    display: block;
}

.categories-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.categories-table th,
.categories-table td {
    padding: 6px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
    text-align: center;
}

.categories-table th {
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.categories-table th:nth-child(2),
.categories-table td:nth-child(2),
.categories-table th:nth-child(3),
.categories-table td:nth-child(3) {
    width: 90px;
}

.categories-table th:last-child,
.categories-table td:last-child {
    width: 80px;
}

.cat-col-name a {
    text-decoration: none;
    color: inherit;
}

.cat-col-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cat-col-actions {
    white-space: nowrap;
}

@media only screen and (max-width: 550px) {
    .categories-section {
        margin: 3% 10px 8% 10px;
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 20px 0 40px;
    font-size: 14px;
}

.pagination a {
    text-decoration: none;
    color: #555;
    padding: 4px 8px;
}

.pagination a:hover {
    color: #000;
}

.pagination strong {
    padding: 4px 8px;
    color: #000;
}

/* Legal commissions cards */
.legal-commissions-section {
    width: 100%;
    max-width: 1000px;
    margin: 40px auto 60px auto;
    display: block;
}

.legal-commission-card {
    width: 100%;
    box-sizing: border-box;
    border-radius: 8px;
    box-shadow: 2px 2px 10px 0 rgba(138, 138, 138, 0.2);
    padding: 16px 18px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: relative;
}

.legal-commission-link {
    text-decoration: none;
    color: inherit;
}

.legal-commission-link p {
    margin: 2px 0;
}

.legal-commission-stretch-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 8px;
}

.legal-commission-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    position: relative;
    z-index: 2;
}

/* Category cards actions overlay */
.category-card-wrap {
    width: 220px;
}

.category-card {
    position: relative;
    overflow: hidden;
}

.category-card a {
    color: inherit;
    text-decoration: none;
}

.category-card-image-wrap {
    position: relative;
    padding: 0 !important;
    line-height: 0;
}

.category-card-image-wrap a {
    display: block;
}

.category-card-image-wrap img {
    display: block;
}

.category-card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.category-card:hover .category-card-actions {
    opacity: 1;
}

.category-card-actions .small-button {
    width: 30px;
    height: 30px;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
}

.category-card-actions .icon {
    width: 13px;
    height: 13px;
}

/* Legal certificate form */
.legal-certificate-form .legal-field {
    margin: 0 0 10px 0;
}

.legal-certificate-form .legal-field label {
    margin-bottom: 4px;
}

.legal-certificate-form .legal-owner-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    width: 100%;
}

.legal-certificate-form .legal-owner-row .legal-field {
    flex: 1;
}

@media only screen and (max-width: 700px) {
    .legal-certificate-form .legal-owner-row {
        flex-direction: column;
        gap: 0;
    }
}

@media only screen and (max-width: 550px) {
    .commission-object-entry + .commission-object-entry {
        border-top: 1px solid #ddd;
        padding-top: 16px;
        margin-top: 8px;
    }
}