/*
Theme Name: EM Style
Theme URI: 
Description: Thème inspiré d'Events Manager avec affichage liste/damier et dates formatées esthétiquement
Version: 1.0.0
Author: Asso & Manif Plugin
*/

/* Variables CSS - Style Events Manager */
:root {
    --wpem-primary-color: #0096ff;
    --wpem-dark-color: #111111;
    --wpem-gray-color: #555555;
    --wpem-white-color: #ffffff;
    --wpem-gray-border-color: #e4e4e4;
    --wpem-gray-bg-color: #f5f5f5;
    
    /* Variables pour compatibilité */
    --am-primary-color: var(--wpem-primary-color);
    --am-primary-hover: var(--wpem-dark-color);
    --am-text-color: var(--wpem-dark-color);
    --am-text-light: var(--wpem-gray-color);
    --am-border-color: var(--wpem-gray-border-color);
    --am-bg-color: var(--wpem-white-color);
    --am-bg-light: var(--wpem-gray-bg-color);
    --am-spacing: 20px;
    --am-border-radius: 4px;
}

/* Container principal */
.am-events-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--am-spacing);
}

/* Barre de contrôle avec sélecteur de vue (style Events Manager) */
.am-view-controls.am-event-listings-header {
    display: flex;
    width: 100%;
    margin-bottom: 20px;
    justify-content: space-between;
    align-items: center;
}

/* Barre de recherche et tri */
.am-filters-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--wpem-gray-bg-color);
    border-radius: var(--am-border-radius);
    flex-wrap: wrap;
}

.am-search-box,
.am-sort-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.am-search-label,
.am-sort-label {
    font-weight: 600;
    color: var(--wpem-dark-color);
    font-size: 14px;
}

.am-search-input,
.am-sort-select {
    padding: 8px 12px;
    border: 1px solid var(--wpem-gray-border-color);
    border-radius: var(--am-border-radius);
    font-size: 14px;
    min-width: 200px;
}

.am-search-input:focus,
.am-sort-select:focus {
    outline: none;
    border-color: var(--wpem-primary-color);
    box-shadow: 0 0 0 2px rgba(0, 150, 255, 0.1);
}

.am-view-controls .am-view-title.am-event-listing-header-title {
    flex: 1;
}

.am-view-controls .am-view-title .am-heading-text {
    font-size: 24px;
    line-height: 1.42;
    font-weight: 500;
    margin: 0;
    color: var(--wpem-dark-color);
}

.am-view-switcher.am-event-layout-action-wrapper {
    display: inline-flex;
    margin-left: auto;
}

.am-view-switcher .am-event-layout-action {
    display: inline-flex;
}

.am-view-btn.am-event-layout-icon {
    height: 34px;
    width: 34px;
    background-color: var(--wpem-gray-bg-color);
    color: var(--wpem-dark-color);
    margin-left: 5px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: none;
    padding: 0;
}

.am-view-btn.am-event-layout-icon:hover {
    background-color: var(--wpem-gray-color);
    color: var(--wpem-white-color);
}

.am-view-btn.am-event-layout-icon.wpem-active-layout,
.am-view-btn.am-event-layout-icon.active {
    background-color: var(--wpem-primary-color);
    color: var(--wpem-white-color);
}

/* Vue LISTE (style Events Manager) */
.am-list-view {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: none;
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 30px;
}

.am-list-item {
    display: inline-flex;
    width: 100%;
    padding: 23px 17px;
    border-left: 3px solid var(--wpem-gray-border-color);
    border-top: 1px solid var(--wpem-gray-border-color);
    border-right: 1px solid var(--wpem-gray-border-color);
    margin: 0;
    transition: border-width 0.2s ease, background 0.2s ease;
    background: var(--wpem-white-color);
    cursor: pointer;
}

.am-list-item:hover {
    border-left-width: 7px;
    background: var(--wpem-gray-bg-color);
}

.am-list-item:last-child {
    border-bottom: 1px solid var(--wpem-gray-border-color);
}

/* Image dans la liste (style Events Manager) */
.am-list-image {
    float: left;
    padding-right: 20px;
    flex-shrink: 0;
}

.am-list-image .am-list-image-inner {
    height: 90px;
    width: 90px;
    background-size: var(--am-card-image-bg-size, contain) !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    border-radius: 4px;
    background-color: var(--am-image-bg-color, #ffffff);
    display: flex;
    align-items: center;
    justify-content: center;
}

.am-list-image .am-list-image-inner img {
    height: 90px;
    width: 90px;
    object-fit: cover;
    border-radius: 4px;
    padding: 0;
    border: 0;
    margin: 0;
    display: block;
}

.am-list-image .am-list-image-inner.no-image {
    background: var(--am-image-bg-color, #ffffff);
    color: var(--wpem-gray-color);
    font-size: 30px;
}

.am-list-image .am-list-image-inner.no-image span {
    display: block;
    font-size: 40px;
    line-height: 1;
}

/* Contenu de la liste */
.am-list-content {
    float: left;
    font-size: 15px;
    line-height: 20px;
    width: 100%;
    position: relative;
    padding-left: 90px;
}

/* Date formatée esthétique (style Events Manager) */
.am-list-date {
    width: 80px;
    position: absolute;
    left: 0;
    top: 0;
}

.am-list-date-type {
    display: flex;
    align-items: flex-start;
}

.am-list-date .am-from-date {
    width: 40px;
    display: inline-block;
    float: left;
    text-align: center;
    padding-right: 3px;
}

.am-list-date .am-from-date .am-date {
    font-size: 29px;
    line-height: 30px;
    font-weight: 600;
    color: var(--wpem-gray-color);
}

.am-list-date .am-from-date .am-month {
    font-size: 13px;
    text-transform: uppercase;
    font-weight: 400;
    line-height: 15px;
    color: var(--wpem-gray-color);
}

.am-list-date .am-to-date {
    float: left;
    padding-left: 13px;
    position: relative;
    padding-top: 3px;
}

.am-list-date .am-to-date .am-date-separator {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translate(0, -50%);
    font-size: 20px;
    color: var(--wpem-gray-color);
}

.am-list-date .am-to-date .am-date {
    font-size: 15px;
    line-height: 15px;
    font-weight: 500;
    color: var(--wpem-gray-color);
}

.am-list-date .am-to-date .am-month {
    font-size: 9px;
    text-transform: uppercase;
    font-weight: 400;
    line-height: 12px;
    color: var(--wpem-gray-color);
}

/* Titre */
.am-list-title {
    margin: 0 5px 10px;
}

.am-list-title .am-heading-text {
    font-size: 22px;
    line-height: 30px;
    font-weight: 700;
    color: var(--wpem-dark-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.am-list-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.am-list-title a:hover {
    color: var(--wpem-primary-color);
}

/* Métadonnées (style Events Manager) */
.am-list-meta {
    width: 100%;
    padding-left: 5px;
    float: left;
    font-size: 15px;
    line-height: 23px;
    color: var(--wpem-gray-color);
}

.am-list-meta-line {
    margin: 5px;
    min-height: 22px;
    color: var(--wpem-gray-color);
    position: relative;
    padding-left: 20px;
}

.am-list-meta-line.am-date-time::before {
    content: "\e94e";
    font-family: wp-event-manager;
    position: absolute;
    left: 0;
    top: 0;
    font-size: 15px;
}

.am-list-meta-line.am-location::before {
    content: "\e947";
    font-family: wp-event-manager;
    position: absolute;
    left: 0;
    top: 0;
    font-size: 15px;
}

.am-list-meta-line.am-association::before {
    content: "\e94f";
    font-family: wp-event-manager;
    position: absolute;
    left: 0;
    top: 0;
    font-size: 15px;
}

.am-list-meta-text {
    flex: 1;
}

.am-list-meta-text a {
    color: var(--wpem-gray-color);
    text-decoration: none;
}

.am-list-meta-text a:hover {
    color: var(--wpem-primary-color);
}

/* Vue DAMIER (grid) - Style Events Manager */
.am-grid-view {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 30px;
}

.am-grid-item {
    flex: unset;
    max-width: unset;
    padding-bottom: 30px;
}

.am-grid-item .am-event-layout-wrapper {
    border: 1px solid var(--wpem-gray-border-color);
    width: 100%;
    height: 100%;
    border-radius: 4px;
    overflow: hidden;
    margin: 0;
    transition: box-shadow 0.2s ease;
    cursor: pointer;
}

.am-grid-item:hover .am-event-layout-wrapper {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.am-grid-image {
    float: none;
    padding-right: 0;
    width: 100%;
    background-color: var(--am-image-bg-color, #ffffff);
    position: relative;
}

.am-grid-image .am-grid-image-inner {
    height: 230px;
    width: 100%;
    border-radius: 0;
    background-size: var(--am-card-image-bg-size, contain) !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

.am-grid-image img {
    height: 230px;
    width: 100%;
    object-fit: cover;
    border-radius: 0;
}

.am-grid-image.no-image .am-grid-image-inner {
    background: var(--am-image-bg-color, #ffffff);
    color: var(--wpem-gray-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
}

/* Badge de date sur l'image (style Events Manager) */
.am-date-badge {
    display: inline-block;
    text-align: center;
    background: var(--wpem-white-color);
    padding: 10px 15px;
    width: auto;
    height: auto;
    position: absolute;
    top: 15px;
    left: 15px;
    border-radius: 4px;
    box-shadow: 5px 3px 15px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.am-date-badge .am-event-date-type {
    display: block;
}

.am-date-badge .am-from-date {
    display: inline-block;
    text-align: center;
    width: auto;
    height: auto;
    float: none;
}

.am-date-badge .am-from-date .am-date {
    font-size: 23px;
    line-height: 23px;
    font-weight: 600;
    color: var(--wpem-dark-color);
    display: block;
}

.am-date-badge .am-from-date .am-month {
    font-size: 13px;
    text-transform: uppercase;
    font-weight: 600;
    line-height: 15px;
    color: var(--wpem-gray-color);
    display: block;
}

.am-grid-content {
    padding: 10px;
    line-height: 18px;
    float: left;
    font-size: 15px;
    line-height: 20px;
    width: 100%;
    position: relative;
    clear: both;
    box-sizing: border-box;
    overflow: hidden;
}

.am-grid-content .am-event-infomation {
    width: 100%;
    float: left;
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
}

.am-grid-content .am-event-details {
    width: 100%;
    padding: 10px;
    line-height: 18px;
    float: left;
    position: relative;
    clear: both;
    box-sizing: border-box;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.am-grid-title {
    margin: 5px;
    min-height: 23px;
    color: var(--wpem-gray-color);
    line-height: 1.42;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.am-grid-title .am-heading-text {
    font-size: 22px;
    line-height: 1.42;
    font-weight: 700;
    color: var(--wpem-dark-color);
    margin: 0 0 10px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.am-grid-title a {
    color: inherit;
    text-decoration: none;
}

.am-grid-title a:hover {
    color: var(--wpem-primary-color);
}

.am-grid-meta {
    margin: 5px;
    min-height: 23px;
    color: var(--wpem-gray-color);
    line-height: 1.42;
}

.am-grid-meta-line {
    position: relative;
    padding-left: 20px;
    margin: 5px;
    min-height: 22px;
    color: var(--wpem-gray-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.am-grid-meta-line.am-date-time::before {
    content: "\e94e";
    font-family: wp-event-manager;
    position: absolute;
    left: 0;
    top: 0;
    font-size: 15px;
}

.am-grid-meta-line.am-location::before {
    content: "\e947";
    font-family: wp-event-manager;
    position: absolute;
    left: 0;
    top: 0;
    font-size: 15px;
}

/* Responsive */
@media (max-width: 767px) {
    .am-view-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .am-list-item {
        display: flex;
        flex-direction: column;
    }
    
    .am-list-image {
        float: none;
        padding-right: 0;
        width: 100%;
        margin-bottom: 15px;
    }
    
    .am-list-image .am-list-image-inner {
        width: 100%;
        height: 200px;
    }
    
    .am-list-image img {
        width: 100%;
        height: 200px;
    }
    
    .am-list-content {
        float: none;
        width: 100%;
    }
    
    .am-list-date {
        display: none;
    }
    
    .am-list-meta {
        padding-left: 0;
    }
    
    .am-grid-view {
        display: flex;
        flex-direction: column;
    }
    
    .am-grid-item {
        padding-bottom: 30px;
    }
}

@media (max-width: 575px) {
    .am-list-item {
        padding: 15px;
    }
    
    .am-list-title .am-heading-text {
        font-size: 21px;
        line-height: 25px;
    }
}

/* Masquer les vues non actives */
.am-view-hidden {
    display: none !important;
}

/* Styles supplémentaires pour correspondre à Events Manager */
.am-event-layout-wrapper {
    border-top: 1px solid var(--wpem-gray-border-color);
    border-right: 1px solid var(--wpem-gray-border-color);
    margin: 0;
    transition: background 0.2s;
}

.am-event-layout-wrapper .am-event-layout-wrap {
    width: 100%;
    display: inline-block;
    margin: 0;
}

/* Nettoyage des floats */
.am-list-view::after,
.am-grid-view::after,
.am-list-item::after,
.am-list-content::after,
.am-event-infomation::after {
    content: "";
    display: table;
    clear: both;
}

/* Styles pour les icônes (fallback si la police wp-event-manager n'est pas disponible) */
.am-list-meta-line.am-date-time::before,
.am-list-meta-line.am-location::before,
.am-list-meta-line.am-association::before,
.am-grid-meta-line.am-date-time::before,
.am-grid-meta-line.am-location::before {
    font-family: "Dashicons", sans-serif;
    font-size: 15px;
    line-height: 20px;
}

.am-list-meta-line.am-date-time::before {
    content: "\f469"; /* Dashicons calendar */
}

.am-list-meta-line.am-location::before {
    content: "\f230"; /* Dashicons location */
}

.am-list-meta-line.am-association::before {
    content: "\f307"; /* Dashicons groups */
}

.am-grid-meta-line.am-date-time::before {
    content: "\f469";
}

/* Styles spécifiques pour les associations */
.am-list-meta-line.am-contact,
.am-list-meta-line.am-phone,
.am-list-meta-line.am-email,
.am-list-meta-line.am-description,
.am-grid-meta-line.am-contact,
.am-grid-meta-line.am-phone {
    margin: 5px;
    min-height: 22px;
    color: var(--wpem-gray-color);
    position: relative;
    padding-left: 20px;
}

.am-list-meta-line.am-contact::before,
.am-grid-meta-line.am-contact::before {
    content: "\f307"; /* Dashicons groups */
    font-family: "Dashicons", sans-serif;
    position: absolute;
    left: 0;
    top: 0;
    font-size: 15px;
    line-height: 20px;
}

.am-list-meta-line.am-phone::before,
.am-grid-meta-line.am-phone::before {
    content: "\f525"; /* Dashicons phone */
    font-family: "Dashicons", sans-serif;
    position: absolute;
    left: 0;
    top: 0;
    font-size: 15px;
    line-height: 20px;
}

.am-list-meta-line.am-email::before {
    content: "\f466"; /* Dashicons email */
    font-family: "Dashicons", sans-serif;
    position: absolute;
    left: 0;
    top: 0;
    font-size: 15px;
    line-height: 20px;
}

.am-list-meta-line.am-description {
    font-size: 14px;
    line-height: 1.5;
    color: var(--wpem-gray-color);
    margin-top: 10px;
    padding-left: 0;
}

.am-list-meta-line.am-email a {
    color: var(--wpem-primary-color);
    text-decoration: none;
}

.am-list-meta-line.am-email a:hover {
    text-decoration: underline;
}

.am-grid-meta-line.am-location::before {
    content: "\f230";
}

/* Styles pour les liens dans les métadonnées */
.am-list-meta-text a,
.am-grid-meta-line a {
    color: var(--wpem-gray-color);
    text-decoration: none;
    transition: color 0.2s;
}

.am-list-meta-text a:hover,
.am-grid-meta-line a:hover {
    color: var(--wpem-primary-color);
}

/* Ajustements pour la vue liste */
.am-list-view .am-list-item {
    border-left: 3px solid var(--wpem-gray-border-color);
}

.am-list-view .am-list-item:hover {
    border-left-width: 7px;
}

/* Ajustements pour la vue damier */
.am-grid-view .am-grid-item {
    flex: 0 0 calc(33.333% - 20px);
    margin: 0 10px 20px 10px;
}

.am-grid-view .am-event-layout-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    overflow: hidden;
}

.am-grid-view .am-event-banner {
    position: relative;
    width: 100%;
    flex-shrink: 0;
}

.am-grid-view .am-event-infomation {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.am-grid-view .am-event-details {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

@media (max-width: 992px) {
    .am-grid-view .am-grid-item {
        flex: 0 0 calc(50% - 20px);
    }
}

@media (max-width: 767px) {
    .am-grid-view .am-grid-item {
        flex: 0 0 100%;
        margin: 0 0 20px 0;
    }
}

