/* CARTE.CSS - Styles pour les cartes de profil utilisateur */

:root {
    --primary-color: hsl(130, 75%, 86%);
    --primary-dark: hsl(130, 69%, 65%);
    --primary-light: hsl(130, 75%, 92%);
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --background: #ffffff;
    --surface: #f5f5f7;
    --border: #d2d2d7;
    --shadow: rgba(0, 0, 0, 0.1);
    --warning-color: #ff9500;
    --warning-light: #fff3e0;
    --error-color: #dc2626;
    --error-dark: #b91c1c;
    
    /* Variables mobile */
    --mobile-padding: 16px;
    --mobile-gap: 12px;
    --touch-target: 44px;
}

/* GRILLE DE PROFILS MOBILE-OPTIMISÉE */
.profiles-grid {
    display: grid;
    gap: 16px;
    /* Mobile first - 1 colonne parfaitement adaptée */
    grid-template-columns: 1fr;
    width: 100%;
    padding: 16px;
}

/* Grille adaptative selon la largeur - transitions fluides */
@media (min-width: 520px) {
    .profiles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
}

@media (min-width: 768px) {
    .profiles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
}

@media (min-width: 900px) {
    .profiles-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (min-width: 1200px) {
    .profiles-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }
}

@media (min-width: 1600px) {
    .profiles-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 28px;
    }
}

/* CARTES DE PROFIL - DESIGN IDENTIQUE + MOBILE PARFAIT */
.profile-card {
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* Hauteur adaptative mobile parfaite */
    min-height: 200px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 2px 12px var(--shadow);
}

.profile-card:active {
    transform: scale(0.98);
    box-shadow: 0 4px 16px var(--shadow);
}

/* HEADER MOBILE-OPTIMISÉ */
.profile-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "avatar info actions";
    gap: 12px;
    align-items: flex-start;
    position: relative;
    min-height: 50px;
}

.profile-avatar {
    grid-area: avatar;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.profile-info {
    grid-area: info;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Optimisation mobile pour éviter débordements */
    overflow: hidden;
}

.profile-info h3,
.profile-username {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
    word-break: break-word;
    overflow-wrap: break-word;
    /* Troncature intelligente sur mobile */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-description {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: break-word;
    margin: 0;
    /* Troncature mobile */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-author,
.profile-date {
    color: var(--text-secondary);
    font-size: 11px;
    margin: 0;
    line-height: 1.2;
    /* Troncature mobile */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-author {
    font-weight: 500;
}

.profile-date {
    font-style: italic;
}

.profile-actions {
    grid-area: actions;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-shrink: 0;
}

.instagram-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
}

.instagram-link:hover,
.instagram-link:active {
    color: var(--primary-color);
}

/* BOUTONS D'ACTION */
.instagram-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    flex-shrink: 0;
}

.instagram-btn:active {
    background: var(--primary-light);
    transform: scale(0.95);
}

.instagram-btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.delete-profile-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #dc2626;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.delete-profile-btn:active {
    background: #fee2e2;
    transform: scale(0.95);
}

.delete-icon {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

/* SECTION DE NOTATION - AVEC CORRECTION DÉBORDEMENT */
.rating-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
}

/* CONTENEUR DES ÉTOILES - PLEINE LARGEUR SANS COMPTEUR */
.stars-container {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: nowrap;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
}

/* LIGNE DES ÉTOILES - PLEINE LARGEUR */
.stars, .stars-disabled {
    display: flex;
    gap: 2px;
    flex: 1;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
}

.stars-disabled {
    opacity: 0.6;
}

/* ÉTOILES - RÉPARTITION ÉGALE SUR TOUTE LA LARGEUR */
.star {
    flex: 1;
    max-width: 36px;
    height: 32px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    position: relative;
    touch-action: manipulation;
}

/* Zone tactile invisible qui s'étend sans affecter le layout */
.star::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 6px;
    z-index: 1;
}

.star:active {
    transform: scale(0.9);
    background-color: var(--surface);
}

/* COULEURS DES ÉTOILES - NOIRES EN MODE CLAIR */
.star.active {
    color: #000000;
    -webkit-text-stroke: 1px #000000;
    text-stroke: 1px #000000;
}

.star.inactive {
    color: transparent;
    -webkit-text-stroke: 1px var(--primary-color);
    text-stroke: 1px var(--primary-color);
}

.vote-count-display {
    display: none; /* MASQUER COMPLÈTEMENT LE COMPTEUR DE VOTES */
}

.current-rating {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rating-display {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rating-score {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 16px;
}

.rating-details {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
}

.user-vote-display {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid var(--primary-dark);
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-vote-label {
    color: #1d1d1f !important;
    font-size: 11px;
    font-weight: 500;
}

.user-vote-score {
    color: #1d1d1f !important;
    font-size: 13px;
    font-weight: 700;
}

.login-to-vote {
    color: #1d1d1f !important;
    font-size: 12px;
    font-weight: 600;
    font-style: normal;
    text-align: center;
    padding: 8px;
    background-color: #ffffff;
    border-radius: 8px;
    border: 2px solid var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: inherit;
}

/* ADAPTATIONS MOBILES - ÉTOILES PLEINE LARGEUR */
@media (max-width: 480px) {
    .profile-card {
        padding: 14px;
        gap: 14px;
        min-height: 190px;
    }
    
    .profile-header {
        gap: 10px;
        grid-template-columns: 40px 1fr auto;
    }
    
    .profile-avatar {
        width: 40px;
        height: 40px;
        font-size: 15px;
    }
    
    .profile-info h3,
    .profile-username {
        font-size: 15px;
    }
    
    .instagram-btn {
        width: 34px;
        height: 34px;
    }
    
    .instagram-btn img {
        width: 18px;
        height: 18px;
    }
    
    .delete-profile-btn {
        width: 30px;
        height: 30px;
    }
    
    .stars-container {
        gap: 0;
    }
    
    .stars, .stars-disabled {
        gap: 1px;
    }
    
    .star {
        max-width: 30px;
        height: 26px;
        font-size: 17px;
    }
    
    .star::before {
        width: 40px;
        height: 40px;
    }
    
    .rating-score {
        font-size: 15px;
    }
    
    .rating-details {
        font-size: 11px;
    }
}

/* TRÈS PETITS ÉCRANS (≤320px) */
@media (max-width: 320px) {
    .profile-card {
        padding: 12px;
        gap: 12px;
        min-height: 180px;
    }
    
    .profile-header {
        gap: 8px;
        grid-template-columns: 36px 1fr auto;
    }
    
    .profile-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .profile-info h3,
    .profile-username {
        font-size: 14px;
    }
    
    .profile-description {
        font-size: 12px;
    }
    
    .profile-author,
    .profile-date {
        font-size: 10px;
    }
    
    .instagram-btn {
        width: 32px;
        height: 32px;
    }
    
    .instagram-btn img {
        width: 16px;
        height: 16px;
    }
    
    .delete-profile-btn {
        width: 28px;
        height: 28px;
    }
    
    .delete-icon {
        font-size: 14px;
    }
    
    .stars-container {
        gap: 0;
    }
    
    .stars, .stars-disabled {
        gap: 0px;
    }
    
    .star {
        max-width: 26px;
        height: 22px;
        font-size: 14px;
        border-radius: 4px;
    }
    
    .star::before {
        width: 32px;
        height: 32px;
    }
    
    .rating-score {
        font-size: 14px;
    }
    
    .rating-details {
        font-size: 11px;
    }
    
    .user-vote-display {
        padding: 4px 8px;
        gap: 4px;
    }
    
    .user-vote-label {
        font-size: 10px;
    }
    
    .user-vote-score {
        font-size: 12px;
    }
    
    .login-to-vote {
        font-size: 11px;
        padding: 6px;
    }
}

/* GRANDS MOBILES (481px - 640px) */
@media (min-width: 481px) and (max-width: 640px) {
    .profile-card {
        min-height: 200px;
    }
    
    .profile-header {
        grid-template-columns: 42px 1fr auto;
    }
    
    .profile-avatar {
        width: 42px;
        height: 42px;
    }
    
    .star {
        max-width: 32px;
        height: 28px;
        font-size: 18px;
        border-radius: 5px;
    }
    
    .star::before {
        width: 42px;
        height: 42px;
    }
    
    .stars, .stars-disabled {
        gap: 2px;
    }
    
    .stars-container {
        gap: 0;
    }
}

/* PETITES TABLETTES (641px - 767px) */
@media (min-width: 641px) and (max-width: 767px) {
    .profile-card {
        min-height: 210px;
    }
    
    .star {
        max-width: 34px;
        height: 30px;
        font-size: 19px;
        border-radius: 6px;
    }
    
    .star::before {
        width: 44px;
        height: 44px;
    }
    
    .stars, .stars-disabled {
        gap: 2px;
    }
    
    .stars-container {
        gap: 0;
    }
}

/* TABLETTES (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .profile-card {
        padding: 18px;
        gap: 18px;
        min-height: 220px;
    }
    
    .profile-header {
        gap: 14px;
    }
    
    .profile-info h3,
    .profile-username {
        font-size: 17px;
    }
    
    .profile-description {
        font-size: 14px;
    }
    
    .star {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}

/* DESKTOP (1024px+) */
@media (min-width: 1024px) {
    .profile-card {
        padding: 20px;
        gap: 20px;
        min-height: 240px;
    }
    
    .profile-card:hover {
        box-shadow: 0 8px 24px var(--shadow);
        transform: translateY(-2px);
    }
    
    .profile-header {
        gap: 16px;
    }
    
    .profile-info h3,
    .profile-username {
        font-size: 18px;
    }
    
    .profile-description {
        font-size: 14px;
    }
    
    .instagram-btn:hover {
        background: var(--primary-color);
        transform: translateY(-2px) scale(1.1);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    }
    
    .delete-profile-btn:hover {
        background: var(--primary-light);
        transform: translateY(-2px) scale(1.05);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    }
    
    .star:hover {
        transform: scale(1.1);
        background-color: var(--surface);
    }
    
    .star {
        flex: 1;
        max-width: 38px;
        height: 34px;
        font-size: 22px;
    }
}

/* GRANDS ÉCRANS (1200px+) */
@media (min-width: 1200px) {
    .profile-card {
        padding: 24px;
        gap: 24px;
        min-height: 260px;
    }
    
    .profile-info h3,
    .profile-username {
        font-size: 19px;
    }
    
    .profile-description {
        font-size: 15px;
    }
    
    .profile-author,
    .profile-date {
        font-size: 12px;
    }
    
    .star {
        flex: 1;
        max-width: 40px;
        height: 36px;
        font-size: 24px;
    }
    
    .rating-score {
        font-size: 18px;
    }
    
    .rating-details {
        font-size: 13px;
    }
}

/* ADAPTATIONS ORIENTATION PAYSAGE MOBILE */
@media (max-height: 500px) and (orientation: landscape) {
    .profile-card {
        min-height: 160px;
        padding: 12px;
        gap: 10px;
    }
    
    .profile-header {
        gap: 8px;
    }
    
    .profile-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .star {
        width: 24px;
        height: 24px;
        font-size: 16px;
    }
    
    .rating-section {
        gap: 8px;
    }
}

/* ANIMATION DES PROFILS AU CHARGEMENT */
.profile-card {
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

.profile-card:nth-child(1) { animation-delay: 0.1s; }
.profile-card:nth-child(2) { animation-delay: 0.2s; }
.profile-card:nth-child(3) { animation-delay: 0.3s; }
.profile-card:nth-child(4) { animation-delay: 0.4s; }
.profile-card:nth-child(5) { animation-delay: 0.5s; }
.profile-card:nth-child(n+6) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* GESTION DES DÉBORDEMENTS */
.profile-info h3,
.profile-username,
.profile-description,
.profile-author,
.profile-date {
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

/* OPTIMISATIONS MOBILE */
.profile-card * {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.star {
    touch-action: manipulation;
}

.star:active {
    transform: scale(0.9);
    background-color: var(--surface);
}

.profile-card:active {
    transform: scale(0.98);
}

/* MODE SOMBRE */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f5f5f7;
        --text-secondary: #a1a1a6;
        --background: #1d1d1f;
        --surface: #2c2c2e;
        --border: #38383a;
        --shadow: rgba(0, 0, 0, 0.3);
    }
    
    .instagram-btn,
    .delete-profile-btn {
        background: rgba(44, 44, 46, 0.95);
        color: var(--text-primary);
        border-color: rgba(56, 56, 58, 0.6);
    }
    
    /* ÉTOILES EN MODE SOMBRE - BLANCHES */
    .star.active {
        color: #ffffff;
        -webkit-text-stroke: 1px #ffffff;
        text-stroke: 1px #ffffff;
    }
}

/* NOTIFICATIONS POUR INSTAGRAM REQUIS */
.notification {
    position: fixed;
    top: 16px;
    left: 16px;
    right: 16px;
    padding: 16px 20px;
    border-radius: 12px;
    font-weight: 600;
    z-index: 3000;
    animation: slideInMobile 0.3s ease-out;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    line-height: 1.4;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Notification spéciale Instagram avec dégradé rouge-orange */
.notification.instagram-required {
    background: linear-gradient(135deg, #dc2626, #ea580c);
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 32px rgba(220, 38, 38, 0.25);
    font-weight: 700;
}

@keyframes slideInMobile {
    from {
        transform: translateY(-100%) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}
@media (prefers-reduced-motion: reduce) {
    .profile-card,
    .star {
        animation: none !important;
        transition: none !important;
    }
    
    .star:active,
    .profile-card:active {
        transform: none;
    }
}

.star:focus-visible,
.instagram-btn:focus-visible,
.delete-profile-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ANIMATIONS FLUIDES */
@media (prefers-reduced-motion: no-preference) {
    .profile-card {
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }
    
    .star {
        transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    }
}