/* ===================================
   AEQUITAS BREEDER RANKING CSS
   Professional External Stylesheet
   =================================== */

/* --- PREMIUM UI VARIABLES --- */
/* --- PREMIUM UI VARIABLES --- */
:root,
.aeq-premium-ui,
#aequitas-combined-container {
    --aeq-gold: #C8AF00;
    --aeq-gold-light: #fdfbf7;
    --aeq-dark: #1a1a1a;
    --aeq-blue: #092e62;
    --aeq-text: #333;
    --aeq-gray: #f5f5f5;
    --aeq-border: #e0e0e0;
    --aeq-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --aeq-radius: 12px;
}

.aeq-premium-ui {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- FILTERS CARD --- */
.aeq-glass-card {
    background: #fff;
    border-radius: 12px !important;
    box-shadow: var(--aeq-shadow);
    padding: 25px;
    border: 1px solid rgba(0, 0, 0, 0.03);
    margin-bottom: 30px;
}

.aeq-filters-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
}

.aeq-filter-group {
    flex: 1;
    min-width: 200px;
}

.aeq-filter-group label {
    display: block;
    font-weight: 600;
    color: var(--aeq-dark);
    margin-bottom: 8px;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.aeq-select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--aeq-border);
    border-radius: 8px;
    font-size: 14px;
    background-color: #FAFAFA;
    transition: all 0.2s ease;
    height: 44px;
}

.aeq-select:focus {
    border-color: var(--aeq-gold);
    box-shadow: 0 0 0 3px rgba(200, 175, 0, 0.1);
    outline: none;
    background-color: #fff;
}

.aeq-filter-action {
    flex: 0 0 auto;
}

.aeq-btn-primary {
    background: linear-gradient(135deg, var(--aeq-gold) 0%, #b39b00 100%);
    color: #fff;
    border: none;
    padding: 0 25px;
    height: 44px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
}

.aeq-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(200, 175, 0, 0.3);
    background: linear-gradient(135deg, #d4ba00 0%, #c8af00 100%);
}

/* --- LOADING & PLACEHOLDER --- */
#aeq-br-loader {
    text-align: center;
    padding: 40px;
    color: var(--aeq-gold);
}

.aeq-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    background: #fdfdfd;
    border-radius: 12px !important;
    border: 2px dashed #eee;
}

/* --- RANKING LIST --- */
.aeq-br-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* --- ACCORDION ITEM --- */
.aeq-accordion-item {
    background: #fff;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.aeq-accordion-item:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.aeq-accordion-item.active {
    border-color: var(--aeq-gold);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* --- ACCORDION HEADER --- */
.aeq-accordion-header {
    padding: 20px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    background: #fff;
}

.aeq-rank-col {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    min-width: 0;
    margin-right: 20px;
}

/* === RANK BADGES === */
/* Ordre important : Défaut d'abord, Spécifiques après */

/* 1. BADGE PAR DÉFAUT (Rangs 4+) */
/* 1. BADGE PAR DÉFAUT (Rangs 4+) */
.aeq-rank-badge {
    width: 40px;
    height: 40px;
    background: #555 !important;
    /* Gris foncé pour rangs 4+ */
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

/* 2. BADGES SPÉCIFIQUES (Écrasent le défaut) */
.aeq-rank-1 .aeq-rank-badge {
    background: linear-gradient(135deg, #bf953f, #fcf6ba, #b38728, #fbf5b7, #aa771c) !important;
    color: #5a400a;
    border: 2px solid #cfaa48;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(0, 0, 0, 0.2);
    font-size: 18px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.aeq-rank-2 .aeq-rank-badge {
    background: linear-gradient(135deg, #a8a9ad, #f0f2f5, #8a8b8e, #e8e8e8, #6d6d6d) !important;
    color: #333;
    border: 2px solid #babcbf;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(0, 0, 0, 0.1);
    font-size: 18px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.aeq-rank-3 .aeq-rank-badge {
    background: linear-gradient(135deg, #8a5a44, #e6cfa3, #804a33, #e3c798, #6e3b2e) !important;
    color: #421C02;
    border: 2px solid #a67c52;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(0, 0, 0, 0.2);
    font-size: 18px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.aeq-producer-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.aeq-producer-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--aeq-dark);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aeq-score-col {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex: 0 0 auto;
    min-width: 80px;
}

.aeq-total-score {
    font-size: 20px;
    font-weight: 800;
    color: var(--aeq-gold);
}

.aeq-score-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 0.5px;
}

.aeq-toggle-btn {
    margin-left: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f5f5f5;
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.aeq-accordion-item.active .aeq-toggle-btn {
    background: var(--aeq-gold);
    color: #fff;
    transform: rotate(180deg);
}

/* --- ACCORDION CONTENT --- */
.aeq-accordion-content {
    display: none;
    padding: 25px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    position: relative;
    overflow: hidden;
    border-bottom-left-radius: 12px !important;
    border-bottom-right-radius: 12px !important;
}

.aeq-details-layout {
    display: flex !important;
    gap: 30px;
    flex-wrap: wrap;
}

/* Left Column: Profile */
.aeq-breeder-profile-col {
    flex: 0 0 220px;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-right: 20px;
    border-right: 1px solid #f0f0f0;
}

.aeq-breeder-photo-lg {
    width: 100px !important;
    height: 100px !important;
    border-radius: 12px !important;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
}

.aeq-breeder-identity h4 {
    margin: 0 0 5px 0;
    color: var(--aeq-dark);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.aeq-breeder-identity span {
    color: #777;
    font-size: 13px;
    display: block;
}

.aeq-breeder-actions {
    margin-top: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aeq-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.aeq-btn-website {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
    border: 1px solid #dee2e6;
}

.aeq-btn-website:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    color: #212529;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.aeq-btn-contact {
    background: linear-gradient(135deg, var(--aeq-blue) 0%, #061f42 100%);
    color: #fff;
    border: 1px solid var(--aeq-blue);
}

.aeq-btn-contact:hover {
    background: linear-gradient(135deg, #061f42 0%, #041428 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(9, 46, 98, 0.3);
    color: #fff;
}

/* Right Column: Dogs */
.aeq-breeder-dogs-col {
    flex: 1;
    min-width: 300px;
}

.aeq-content-title {
    margin: 0 0 15px 0;
    font-size: 14px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
}

.aeq-content-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #f0f0f0;
    margin-left: 15px;
}

/* --- DOG LIST --- */
.aeq-dogs-grid {
    display: grid;
    gap: 15px;
}

.aeq-dog-card {
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.aeq-dog-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.aeq-dog-photo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.aeq-dog-photo-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ccc;
}

.aeq-dog-info {
    flex: 1;
}

.aeq-dog-name {
    font-weight: 700;
    color: var(--aeq-dark);
    font-size: 15px;
}

.aeq-dog-owner {
    font-size: 12px;
    color: #777;
}

.aeq-dog-score {
    background: var(--aeq-gold);
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
}

/* --- RESULTS TABLE --- */
.aeq-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.aeq-results-table th {
    text-align: left;
    color: #999;
    font-weight: 600;
    padding: 8px;
    border-bottom: 1px solid #eee;
    font-size: 11px;
    text-transform: uppercase;
}

.aeq-results-table td {
    padding: 8px;
    border-bottom: 1px solid #f9f9f9;
    color: #555;
}

.aeq-results-table tr:last-child td {
    border: none;
}

.aeq-bonus-pill {
    display: inline-block;
    padding: 2px 6px;
    background: #e6f4ea;
    color: #1e7e34;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
}

.aeq-pts-total {
    font-weight: 700;
    color: var(--aeq-dark);
}

/* --- BAREME CARD --- */
.aeq-scale-card {
    background: linear-gradient(135deg, #092e62 0%, #031b3d 100%);
    color: #fff;
    padding: 20px;
    border-radius: 12px !important;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    box-shadow: 0 5px 15px rgba(9, 46, 98, 0.2);
}

.aeq-scale-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.aeq-scale-subtitle {
    font-size: 13px;
    opacity: 0.8;
    margin-top: 5px;
}

.aeq-thresholds {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.aeq-threshold-badge {
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.aeq-threshold-badge strong {
    color: #FFD700;
}

/* --- STATS CARD ---  */
.aeq-stats-card {
    background: #fff;
    border-radius: 12px !important;
    box-shadow: var(--aeq-shadow);
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.aeq-stats-grid {
    display: flex;
    justify-content: space-around;
    text-align: center;
    gap: 15px;
}

.aeq-stat-item {
    display: flex;
    flex-direction: column;
}

.aeq-stat-val {
    font-size: 24px;
    font-weight: 800;
    color: var(--aeq-gold);
}

.aeq-stat-label {
    font-size: 12px;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- INELIGIBLE LIST --- */
.aeq-ineligible-section {
    margin-top: 30px;
    padding-top: 20px;
    transition: opacity 0.3s;
}

.aeq-ineligible-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.aeq-ineligible-item {
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
    opacity: 0.85;
    transition: opacity 0.3s;
}

.aeq-ineligible-item:hover {
    opacity: 1;
}

.aeq-ineligible-item:first-child {
    border-top: 1px solid #eee;
}

.aeq-ineligible-item .aeq-accordion-header {
    padding: 10px 15px;
    background: transparent;
}

.aeq-ineligible-header-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    flex-wrap: wrap;
}

.aeq-producer-name-sm {
    font-size: 14px;
    font-weight: 600;
    color: #555;
}

.aeq-producer-owner-sm {
    font-weight: 400;
    font-size: 0.9em;
    color: #888;
    font-style: italic;
}

.aeq-ineligible-status {
    font-size: 12px;
    color: #999;
}

.aeq-msg-fail {
    color: #d32f2f;
    font-weight: 500;
    background: #ffebee;
    padding: 2px 6px;
    border-radius: 4px;
}

.aeq-toggle-btn-sm {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f0f0f0;
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    font-size: 14px;
}

/* Compact Dog Cards */
.aeq-dog-card-sm {
    padding: 8px 12px;
    gap: 10px;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
}

.aeq-dog-photo-sm,
.aeq-dog-photo-placeholder-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.aeq-dog-photo-placeholder-sm {
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 18px;
}

.aeq-text-sm {
    font-size: 13px;
    font-weight: 600;
    color: #444;
}

.aeq-text-xs {
    font-size: 11px;
    color: #888;
}

.aeq-dog-score-sm {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.aeq-dog-warning {
    font-size: 11px;
    color: #c62828;
    padding-top: 5px;
    border-top: 1px solid #ffcdd2;
    margin-top: 5px;
}

.aeq-dog-empty {
    min-height: 50px;
    border: 1px dashed #ddd;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 11px;
    border-radius: 6px;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .aeq-accordion-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        position: relative;
    }

    .aeq-score-col {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        border-top: 1px solid #eee;
        padding-top: 15px;
    }

    .aeq-rank-col {
        width: 100%;
    }

    .aeq-toggle-btn {
        margin-left: 0;
        position: absolute;
        top: 20px;
        right: 20px;
    }

    .aeq-filters-grid {
        flex-direction: column;
    }

    .aeq-filter-group {
        width: 100%;
    }

    .aeq-filter-action {
        width: 100%;
    }

    .aeq-btn-primary {
        width: 100%;
        justify-content: center;
    }

    .aeq-details-layout {
        flex-direction: column !important;
        gap: 20px !important;
    }

    .aeq-breeder-profile-col {
        border-right: none !important;
        border-bottom: 1px solid #f0f0f0;
        padding-right: 0 !important;
        padding-bottom: 20px;
        flex: auto !important;
        min-width: 0 !important;
        width: 100% !important;
    }

    .aeq-breeder-dogs-col {
        min-width: 0 !important;
        width: 100% !important;
        flex: auto !important;
    }

    .aeq-breeder-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    /* RESPONSIVE TABLE (Card View) */
    .aeq-results-table thead {
        display: none;
    }

    .aeq-results-table tr {
        display: block;
        border: 1px solid #eee;
        margin-bottom: 15px;
        border-radius: 8px;
        padding: 10px;
        background: #fafafa;
    }

    .aeq-results-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none;
        border-bottom: 1px dashed #eee;
        padding: 8px 0;
        text-align: right;
    }

    .aeq-results-table td:last-child {
        border-bottom: none;
    }

    .aeq-results-table td:before {
        content: attr(data-label);
        font-weight: 700;
        color: #999;
        font-size: 11px;
        text-transform: uppercase;
        margin-right: 15px;
        text-align: left;
    }

    /* Fallback labels if data-label is missing (using nth-child) */
    .aeq-results-table td:nth-child(1):before {
        content: "Date";
    }

    .aeq-results-table td:nth-child(2):before {
        content: "Type";
    }

    .aeq-results-table td:nth-child(3):before {
        content: "Expo";
    }

    .aeq-results-table td:nth-child(4):before {
        content: "Classe";
    }

    .aeq-results-table td:nth-child(5):before {
        content: "Base";
    }

    .aeq-results-table td:nth-child(6):before {
        content: "Bonus";
    }

    .aeq-results-table td:nth-child(7):before {
        content: "Total";
    }
}

/* --- NEW FILTER LAYOUT (Line Split) --- */
.aeq-filters-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.aeq-filters-top-row {
    display: flex;
    flex-wrap: wrap;
    /* Falls back to wrapping on mobile */
    gap: 20px;
    align-items: flex-end;
    width: 100%;
}

.aeq-filters-bottom-row {
    width: 100%;
    margin-top: 10px;
}

.aeq-btn-full {
    width: 100%;
    justify-content: center;
    height: 50px;
    font-size: 15px;
    letter-spacing: 1px;
}

@media (max-width: 768px) {
    .aeq-filters-top-row {
        flex-direction: column;
    }
}