/* Variables globales */
:root {
    /* Thème sombre (défaut) */
    --card-bg: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    --card-text-color: #fff;
    --card-text-muted: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --header-bg: linear-gradient(135deg, rgba(26, 26, 26, 0.9) 0%, rgba(45, 45, 45, 0.9) 100%);
    --accent-color: #FFD700;
    --accent-gradient: linear-gradient(135deg, #FFD700, #FFA500);
    --divider-gradient: linear-gradient(90deg, transparent, rgba(255, 107, 107, 0.3) 50%, rgba(255, 183, 0, 0.4));
    --spacing-base: 1rem;
    --border-radius: 15px;
    --transition-speed: 0.3s;
}

/* Thème clair */
.theme-light {
    --card-bg: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    --card-text-color: #333;
    --card-text-muted: rgba(0, 0, 0, 0.6);
    --card-border: rgba(0, 0, 0, 0.1);
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --header-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(240, 240, 240, 0.9) 100%);
    --accent-color: #FF6B6B;
    --accent-gradient: linear-gradient(135deg, #FF6B6B, #FFB700);
    --divider-gradient: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.08) 50%, rgba(0, 0, 0, 0.12));
}

.woocommerce-certificates {
    padding: calc(var(--spacing-base) * 2);
    max-width: 1200px;
    margin: 0 auto;
}

.certificates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: var(--header-bg);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.certificates-title-wrapper h1 {
    font-size: 2.5rem;
    margin: 0;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 2s infinite linear;
    position: relative;
    display: inline-block;
}

.certificates-title-wrapper h1::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 25%;
    height: 2px;
    background: var(--primary-gradient);
    filter: blur(0.5px);
    box-shadow: 
        0 0 10px rgba(255, 107, 107, 0.2),
        0 0 20px rgba(255, 107, 107, 0.1);
}

.certificates-subtitle {
    color: var(--card-text-muted);
    margin: 0.5rem 0 0;
    font-size: 1.1rem;
}

.certificates-stats {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem 1rem;
    border-radius: 12px;
    box-sizing: border-box;
    min-width: 280px;
    max-width: 100%;
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-left: 1rem;
}

.stat-item {
    text-align: center;
    background: rgb(176 176 176 / 10%);
    padding: 1rem 1.5rem; /* Ajusté pour un meilleur espacement */
    border-radius: 12px;
    min-width: 120px;
    flex: 1; /* Permet aux items de grandir uniformément */
}

.stat-item.inactive .stat-number {
    color: #ff4444;
}

@media (max-width: 768px) {
    .certificates-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .stat-item {
        width: 100%;
        padding: 0.75rem 1rem;
    }
}

/* Ajout d'une media query spécifique pour les écrans moyens */
@media (min-width: 769px) and (max-width: 1080px) {
    .certificates-stats {
        min-width: 320px; /* Légèrement plus large pour les écrans moyens */
        padding: 1rem;
    }

    .stat-item {
        padding: 0.875rem 1rem;
        min-width: 140px;
    }
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent-color);
}

.stat-label {
    color: var(--card-text-muted);
}

.certificates-divider {
    text-align: center;
    position: relative;
    margin: 2rem 0;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.certificates-divider::before,
.certificates-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 40px);
    height: 2px;
    filter: blur(0.5px);
    box-shadow: 
        0 0 10px rgba(255, 107, 107, 0.2),
        0 0 20px rgba(255, 183, 0, 0.1);
}

.certificates-divider::before {
    left: 0;
    transform: translateX(20px);
    background: var(--divider-gradient);
}

.certificates-divider::after {
    right: 0;
    transform: translateX(-20px);
    background: linear-gradient(270deg, transparent, rgba(255, 107, 107, 0.3) 50%, rgba(255, 183, 0, 0.4));
}

.divider-icon {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    border-radius: 50%;
    padding: 8px;
    box-shadow: 
        0 0 20px rgba(255, 107, 107, 0.3),
        0 0 40px rgba(255, 183, 0, 0.2);
    animation: pulse 2s infinite;
    z-index: 1;
}

.divider-icon svg {
    width: 24px;
    height: 24px;
    color: #fff;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 107, 107, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
    }
}

.empty-certificates {
    text-align: center;
    padding: 4rem 2rem;
    background: rgba(26, 26, 26, 0.5);
    border-radius: 15px;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.shop-now {
    margin-top: 2rem;
    background: var(--accent-gradient);
    color: #1a1a1a;
    padding: 1rem 2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.3s ease;
    display: inline-block;
    max-width: 80%;
    box-sizing: border-box;
    white-space: normal;
}

.shop-now:hover {
    transform: translateY(-2px);
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.certificates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: calc(var(--spacing-base) * 2);
    margin-top: calc(var(--spacing-base) * 2);
}

/* Modification du style des cartes pour ajouter un bandeau coloré */
.certificate-card {
    position: relative;
    border-radius: var(--border-radius);
    padding: calc(var(--spacing-base) * 1.5);
    color: var(--card-text-color);
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: transform var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
}

.certificate-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 12px;
    background: linear-gradient(90deg, var(--theme-primary), var(--theme-accent));
    opacity: 0.9;
    transition: height var(--transition-speed) ease;
}

.certificate-card:hover::before {
    height: 16px;
}

.certificate-card:hover {
    transform: translateY(-5px);
}

.certificate-header {
    border-bottom: 1px solid var(--card-border);
    padding-bottom: var(--spacing-base);
    margin-bottom: var(--spacing-base);
}

.certificate-header h3 {
    margin: 0;
    font-size: 1.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.certificate-number {
    display: block;
    font-family: 'Courier New', monospace;
    color: color-mix(in srgb, var(--card-text-color) 70%, transparent);
    margin-top: 0.5rem;
}

.certificate-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.bracelet-set-details h4 {
    color: var(--card-text-color);
    margin-bottom: 1rem;
}

.bracelet-set-details ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bracelet-set-details li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--card-border);
}

.certificate-meta {
    font-size: 0.9rem;
    color: color-mix(in srgb, var(--card-text-color) 70%, transparent);
    margin-top: auto;
    padding-top: 1rem;
}

.certificate-meta p {
    margin: 0.5rem 0;
}

.certificate-footer {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    margin-top: auto;
    padding-top: 1.5rem;
    justify-content: center;
}

.certificate-footer .button {
    flex: 0 1 auto;
    min-width: 200px;
    max-width: 100%;
    padding: 0.8rem 1.5rem;
    text-align: center;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    font-weight: 600;
}

.view-certificate {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
}

.download-certificate {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
}

.view-certificate:hover,
.download-certificate:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.certificate-status-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.certificate-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.certificate-status.inactive {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: white;
    margin-left: auto;
}

.back-link {
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    :root {
        --spacing-base: 0.75rem;
    }

    .woocommerce-certificates {
        padding: 1rem;
    }

    .certificates-header {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .certificates-title-wrapper h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }

    .certificates-subtitle {
        font-size: 1rem;
        margin-top: 0.5rem;
    }

    .certificates-stats {
        width: fit-content;
        padding: 0.75rem 1.5rem;
        margin: 0 1rem;
    }

    .stat-number {
        font-size: 1.75rem;
    }

    .stat-label {
        font-size: 0.9rem;
    }

    .certificates-divider {
        margin: 1.5rem 0;
        height: 32px;
    }

    .divider-icon {
        width: 32px;
        height: 32px;
        padding: 6px;
    }

    .divider-icon svg {
        width: 20px;
        height: 20px;
    }

    .certificates-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin: 1.25rem 0;
    }
    
    .certificate-card {
        padding: 1.25rem;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
        min-height: auto;
    }

    .certificate-content {
        margin-bottom: 1rem;
    }

    .certificate-meta {
        padding-top: 0.75rem;
        font-size: 0.85rem;
    }

    .certificate-footer {
        flex-direction: column;
        align-items: center;
        width: 100%;
        padding-top: 1rem;
    }

    .certificate-footer .button {
        width: auto;
        min-width: 180px;
        max-width: 90%;
    }

    .empty-certificates {
        padding: 2rem 1rem;
    }

    .empty-icon {
        font-size: 3rem;
    }
}

@media (max-width: 480px) {
    :root {
        --spacing-base: 0.5rem;
    }

    .certificates-stats {
        padding: 0.75rem 1.25rem;
        margin: 0 0.75rem;
        min-width: auto;
    }

    .certificates-header {
        padding: 1.25rem 1rem;
    }

    .certificates-header {
        padding: 1.25rem;
    }

    .certificates-title-wrapper h1 {
        font-size: 1.5rem;
    }

    .certificates-subtitle {
        font-size: 0.9rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .certificate-card {
        padding: 1rem;
    }

    .certificate-header h3 {
        font-size: 1.25rem;
    }

    .certificate-number {
        font-size: 0.85rem;
    }

    .bracelet-set-details h4 {
        font-size: 1.1rem;
    }

    .bracelet-set-details li {
        font-size: 0.9rem;
        padding: 0.4rem 0;
    }

    .certificate-meta {
        font-size: 0.8rem;
    }

    .certificate-footer .button {
        padding: 0.7rem 0.9rem;
        font-size: 0.85rem;
    }

    .shop-now {
        padding: 0.8rem 1.5rem;
        width: 100%;
        max-width: 90%;
        font-size: 0.9rem;
    }
}

/* Pour les très petits écrans */
@media (max-width: 360px) {
    .certificates-stats {
        padding: 0.5rem 1rem;
        margin: 0 0.5rem;
    }

    .certificates-header {
        padding: 1rem 0.75rem;
    }

    .certificates-header {
        padding: 1rem;
    }

    .certificates-title-wrapper h1 {
        font-size: 1.35rem;
    }

    .certificates-stats {
        padding: 0.5rem;
        min-width: 90px;
    }
}

@media (max-width: 768px) {
    .woocommerce-certificates {
        padding: 1rem;
    }

    .certificates-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin: 1.5rem 0;
    }
    
    .certificate-card {
        padding: 1.25rem;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .certificate-footer {
        flex-direction: column;
        width: 100%;
        padding-top: 1rem;
    }

    .certificate-footer .button {
        width: 100%;
        box-sizing: border-box;
        padding: 0.8rem 1rem;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .certificates-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding: 1.5rem;
    }

    .certificates-title-wrapper h1 {
        font-size: 1.75rem;
    }

    .certificates-stats {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .certificate-card {
        padding: 1rem;
    }

    .certificate-header h3 {
        font-size: 1.25rem;
    }

    .certificate-content {
        margin-bottom: 1rem;
    }

    .certificate-meta {
        font-size: 0.85rem;
    }
}

/* Adaptations pour le thème light */
.theme-light .woocommerce-certificates {
    color: #333;
}

.theme-light .certificates-header {
    background: var(--header-bg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.theme-light .certificates-title-wrapper h1 {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.theme-light .certificates-subtitle {
    color: var(--card-text-muted);
}

.theme-light .certificates-stats {
    background: rgba(0, 0, 0, 0.05);
}

.theme-light .stat-number {
    color: #efcb00;
}

.theme-light .stat-label {
    color: var(--card-text-muted);
}

.theme-light .certificates-divider::before,
.theme-light .certificates-divider::after {
    background: var(--divider-gradient);
    filter: none;
    box-shadow: none;
}

.theme-light .divider-icon {
    box-shadow: 
        0 0 15px rgba(255, 107, 107, 0.2),
        0 0 30px rgba(255, 183, 0, 0.15);
}

.theme-light .empty-certificates {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-light .certificate-card {
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
}

.theme-light .certificate-header {
    border-bottom: 1px solid var(--card-border);
}

.theme-light .certificate-number {
    color: var(--card-text-muted);
}

.theme-light .bracelet-set-details h4 {
    color: var(--card-text-color);
}

.theme-light .bracelet-set-details li {
    border-bottom: 1px solid var(--card-border);
}

.theme-light .certificate-meta {
    color: var(--card-text-muted);
}

.theme-light .view-certificate {
    background: var(--primary-gradient);
    color: #fff;
}

.theme-light .download-certificate {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.2);
    color: #333;
}

.theme-light .shop-now {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.theme-light .shop-now:hover {
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

/* Thèmes des produits avec couleurs assombries */
.theme-larme-de-soutien { --theme-primary: #ff4500; --theme-secondary: #301c03; --theme-accent: #ff8c6a; }
.theme-les-liens-dasteria { --theme-primary: #0077ff; --theme-secondary: #001f4d; --theme-accent: #80bfff; }
.theme-medaillon-d-achevement { --theme-primary: #ff6b2b; --theme-secondary: #2a0f02; --theme-accent: #ffd700; }
.theme-bague-dengagement-personnel { --theme-primary: #00a8cc; --theme-secondary: #003344; --theme-accent: #7fdbff; }
.theme-bracelet-familial { --theme-primary: #4caf50; --theme-secondary: #1b5e20; --theme-accent: #81c784; }
.theme-bague-damour-unique { --theme-primary: #ff1a4d; --theme-secondary: #2b0014; --theme-accent: #ff80ab; }
.theme-cle-de-souvenir { --theme-primary: #9c7b4e; --theme-secondary: #2a1810; --theme-accent: #d4af37; }
.theme-bague-de-reconciliation { --theme-primary: #a5f2f3; --theme-secondary: #062635; --theme-accent: #ffffff; }
.theme-talisman-de-gratitude { --theme-primary: #9370DB; --theme-secondary: #2a1b3d; --theme-accent: #E6E6FA; }

/* Suppression du style de fond précédent */
.certificate-card[class*="theme-"] {
    background: var(--card-bg);
}

/* Thème sombre (par défaut) */
:root {
    --card-bg: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    --card-text-color: #fff;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --card-border-color: rgba(255, 255, 255, 0.1);
}

/* Thème clair */
.theme-light {
    --card-bg: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    --card-text-color: #333;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --card-border-color: rgba(0, 0, 0, 0.1);
}

/* Suppression des styles spécifiques au thème clair qui sont maintenant gérés par les variables */
.theme-light .certificate-card,
.theme-light .certificate-header,
.theme-light .certificate-number,
.theme-light .bracelet-set-details h4,
.theme-light .bracelet-set-details li,
.theme-light .certificate-meta {
    background: none;
    border-color: var(--card-border-color);
    color: var(--card-text-color);
}

.certificates-notice {
    margin: 1.5rem 0;
    padding: 1.25rem;
    border-radius: var(--border-radius);
    background: linear-gradient(135deg, rgba(var(--theme-primary-rgb), 0.05), rgba(var(--theme-accent-rgb), 0.1));
    border: 1px solid rgba(var(--theme-primary-rgb), 0.15);
    box-shadow: 0 4px 15px rgba(var(--theme-primary-rgb), 0.1);
    transition: all 0.3s ease;
}

.certificates-notice:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--theme-primary-rgb), 0.15);
}

.notice-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    color: var(--card-text-color);
}

.notice-content i {
    font-size: 1.25rem;
    color: var(--theme-primary);
    margin-top: 0.2rem;
    filter: drop-shadow(0 0 3px rgba(var(--theme-primary-rgb), 0.3));
}

.fa-bounce {
    animation: subtle-bounce 2s infinite;
}

@keyframes subtle-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.notice-content p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    font-weight: 400;
    letter-spacing: 0.01em;
}

@media (max-width: 768px) {
    .certificates-notice {
        margin: 1rem 0;
        padding: 0.875rem;
    }
    
    .notice-content {
        gap: 0.75rem;
    }
    
    .notice-content p {
        font-size: 0.9rem;
    }
}

.theme-light .certificates-divider::before {
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.12));
}

.theme-light .certificates-divider::after {
    background: linear-gradient(-90deg, transparent, rgba(0, 0, 0, 0.12));
}

/* Styles des bandeaux d'information */
.certificates-info-banners {
    max-width: 1000px;
    margin: 0 auto 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 0 1rem;
}

.info-banner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
    transform: translateY(0);
    max-height: 100px;
    overflow: hidden;
}

.info-banner:only-child {
    grid-column: 1 / -1;
}

.info-banner.closing {
    opacity: 0;
    transform: translateX(-10px);
    max-height: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.info-banner i {
    font-size: 1rem;
    color: white;
}

.info-banner p {
    margin: 0;
    margin-right: 2rem;
    font-size: 0.9rem;
    color: white;
    opacity: 0.9;
}

.info-banner.magic {
    background: linear-gradient(135deg, rgba(44, 62, 80, 0.9), rgba(52, 152, 219, 0.9));
}

.info-banner.warning {
    background: linear-gradient(135deg, rgba(192, 57, 43, 0.9), rgba(231, 76, 60, 0.9));
}

.info-banner-close {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    transition: all 0.2s ease;
}

.info-banner-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: scale(1.1);
}

.info-banner-close i {
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .certificates-info-banners {
        grid-template-columns: 1fr;
        margin: 1rem;
        gap: 0.5rem;
    }

    .info-banner {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .info-banner p {
        font-size: 0.85rem;
    }
}