/* ==========================================
   STYLES POUR LA SECTION RECETTES UTILISATEUR
   Version: 1.0 - Styles dédiés au profil utilisateur
   ========================================== */

#userRecipesGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 2rem 1.5rem;
  align-items: stretch;
}


/* ==========================================
   ONGLETS DU PROFIL
   ========================================== */

.profile-tab {
    position: relative;
    overflow: hidden;
}

.profile-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.5s ease;
}

.profile-tab:hover::before {
    left: 100%;
}

.profile-tab-content {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-tab-content.active {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================
   SECTION RECETTES UTILISATEUR
   ========================================== */

.user-recipes-section {
    animation: slideInUp 0.6s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   CARTES DE RECETTES UTILISATEUR
   ========================================== */

.user-recipe-card {
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-recipe-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.03), transparent);
    transform: rotate(-45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.user-recipe-card:hover::before {
    animation: shimmer 1.5s ease-in-out;
    opacity: 1;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(-45deg);
    }

    100% {
        transform: translateX(100%) translateY(100%) rotate(-45deg);
    }
}

.user-recipe-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Animation des cartes au chargement */
.user-recipe-card {
    animation: cardAppear 0.6s ease-out backwards;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Délai d'animation pour chaque carte */
.user-recipe-card:nth-child(1) {
    animation-delay: 0.1s;
}

.user-recipe-card:nth-child(2) {
    animation-delay: 0.2s;
}

.user-recipe-card:nth-child(3) {
    animation-delay: 0.3s;
}

.user-recipe-card:nth-child(4) {
    animation-delay: 0.4s;
}

.user-recipe-card:nth-child(5) {
    animation-delay: 0.5s;
}

.user-recipe-card:nth-child(6) {
    animation-delay: 0.6s;
}

/* ==========================================
   BOUTONS DE FILTRE UTILISATEUR
   ========================================== */

.user-recipe-filter-btn {
    position: relative;
    overflow: hidden;
    transform: perspective(1000px) rotateX(0deg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-recipe-filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.user-recipe-filter-btn:hover::before {
    left: 100%;
}

.user-recipe-filter-btn:hover {
    transform: perspective(1000px) rotateX(-5deg) translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.user-recipe-filter-btn.active {
    transform: perspective(1000px) rotateX(0deg) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* ==========================================
   BADGES ET INDICATEURS
   ========================================== */

.recipe-badge {
    position: relative;
    display: inline-block;
    overflow: hidden;
}

.recipe-badge::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.recipe-badge:hover::after {
    left: 100%;
}

/* ==========================================
   ANIMATIONS SPÉCIALES
   ========================================== */

/* Animation pour les statistiques */
.stat-counter {
    animation: countUp 2s ease-out;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation pour les actions */
.action-button {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.action-button:active {
    transform: translateY(0);
    transition-duration: 0.1s;
}

/* ==========================================
   EFFET DE PULSATION POUR LES ÉLÉMENTS INTERACTIFS
   ========================================== */

.pulse-on-hover:hover {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

/* ==========================================
   STYLES RESPONSIVES
   ========================================== */

@media (max-width: 768px) {
    .user-recipe-card {
        transform: none !important;
        transition: box-shadow 0.3s ease;
    }

    .user-recipe-card:hover {
        transform: none !important;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    }

    .profile-tab {
        font-size: 0.9rem;
        padding: 0.75rem 1rem !important;
    }

    .user-recipe-filter-btn {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .user-recipes-section {
        margin-top: 1rem;
    }

    .profile-tab {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem !important;
    }

    .user-recipe-card {
        margin-bottom: 1rem;
    }
}

/* ==========================================
   THÈME SOMBRE
   ========================================== */

[data-theme="dark"] .user-recipe-card {
    background: linear-gradient(135deg, #2d2d2d, #3a3a3a);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .user-recipe-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .user-recipe-filter-btn {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .user-recipe-filter-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .profile-tab:hover {
    background: rgba(102, 126, 234, 0.2) !important;
}

/* ==========================================
   EFFETS DE CHARGEMENT
   ========================================== */

.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, transparent 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

[data-theme="dark"] .loading-skeleton {
    background: linear-gradient(90deg, #3a3a3a 25%, transparent 50%, #3a3a3a 75%);
    background-size: 200% 100%;
}

@keyframes loading {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ==========================================
   TRANSITIONS FLUIDES
   ========================================== */

* {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* ==========================================
   AMÉLIORATION DES MODALES
   ========================================== */

.modal {
    backdrop-filter: blur(10px);
}

.modal-content {
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================
   STYLES POUR LES TOOLTIPS
   ========================================== */

[title] {
    position: relative;
}

[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
    animation: tooltipFadeIn 0.3s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ==========================================
   STYLES POUR LES BOUTONS D'ACTION
   ========================================== */

.btn {
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* ==========================================
   ANIMATIONS AVANCÉES POUR LES STATISTIQUES
   ========================================== */

.stats-appear {
    animation: statsSlideIn 0.8s ease-out;
}

@keyframes statsSlideIn {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Délai pour chaque statistique */
.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.3s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.4s;
}

.stat-card:nth-child(5) {
    animation-delay: 0.5s;
}

.stat-card:nth-child(6) {
    animation-delay: 0.6s;
}

/* ==========================================
   STYLES POUR LES ALERTES ET NOTIFICATIONS
   ========================================== */

.notification {
    animation: notificationSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.8);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* ==========================================
   OPTIMISATIONS DE PERFORMANCE
   ========================================== */

.user-recipe-card,
.profile-tab,
.user-recipe-filter-btn {
    will-change: transform, box-shadow;
}

/* Désactiver les animations sur les appareils avec préférence pour moins de mouvement */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================
   STYLES POUR L'IMPRESSION
   ========================================== */

@media print {
    .user-recipe-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }

    .profile-tab,
    .user-recipe-filter-btn,
    .action-button {
        display: none !important;
    }
}

/* ==========================================
   STYLES POUR LA HAUTE RÉSOLUTION
   ========================================== */

@media (min-resolution: 2dppx) {
    .user-recipe-card {
        border-width: 0.5px;
    }
}

/* Animations */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes loading {

    0%,
    100% {
        transform: translateX(-100%);
    }

    50% {
        transform: translateX(500%);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Styles spécifiques à la page author-recipes */
#author-recipes {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #00b894;
    --bg-light: #f8f9fa;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
}

#author-recipes .page-header {
    position: relative;
    background-attachment: fixed;
}

#author-recipes .author-recipes-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

/* Cards des recettes d'auteur */
#author-recipes .author-recipe-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeIn 0.6s ease-out;
}

#author-recipes .author-recipe-card:hover {
    z-index: 10;
}

/* Statistiques */
#author-recipes .author-stats-section {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(248, 249, 250, 0.9));
    backdrop-filter: blur(10px);
}

/* Contrôles */
#author-recipes .author-controls-section {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 249, 250, 0.95));
    backdrop-filter: blur(15px);
}

/* Boutons de filtre */
#author-recipes .author-filter-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

#author-recipes .author-filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

#author-recipes .author-filter-btn:hover::before {
    left: 100%;
}

#author-recipes .author-filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Responsive design amélioré */
@media (max-width: 1200px) {
    #author-recipes .author-recipes-container {
        max-width: 100%;
        padding: 0.75rem;
    }
}

@media (max-width: 768px) {
    #author-recipes .page-header {
        padding: 1.5rem;
        border-radius: 12px;
    }

    #author-recipes .page-header h1 {
        font-size: 2rem;
    }

    #author-recipes .page-header p {
        font-size: 1rem;
    }

    #authorPageInfo {
        flex-direction: column;
        text-align: center;
        gap: 1rem !important;
    }

    #authorPageInfo #authorPageAvatar {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    /* Bouton retour responsive */
    #author-recipes .page-header button {
        position: static !important;
        margin-bottom: 1rem;
        font-size: 0.9rem;
        padding: 0.5rem 1rem !important;
    }

    /* Contrôles responsive */
    #author-recipes .author-controls-section>div {
        flex-direction: column;
        gap: 1rem !important;
        align-items: stretch !important;
    }

    #author-recipes .author-controls-section>div>div {
        justify-content: center;
    }

    /* Grille responsive */
    #authorRecipesGrid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    #author-recipes .author-recipes-container {
        padding: 0.5rem;
    }

    #author-recipes .page-header {
        padding: 1rem;
    }

    #author-recipes .page-header h1 {
        font-size: 1.8rem;
    }

    /* Filtres en scroll horizontal sur mobile */
    #author-recipes .author-controls-section>div>div:first-child {
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    #author-recipes .author-filter-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* Animation d'entrée pour la page */
#author-recipes.page.active {
    animation: slideInFromRight 0.4s ease-out;
}

/* Thème sombre support */
[data-theme="dark"] #author-recipes {
    --bg-light: #2d2d2d;
    --text-dark: #ffffff;
    --text-light: #b0b0b0;
}

[data-theme="dark"] #author-recipes .author-stats-section,
[data-theme="dark"] #author-recipes .author-controls-section {
    background: linear-gradient(135deg, rgba(45, 45, 45, 0.95), rgba(58, 58, 58, 0.95));
    color: #ffffff;
}

/* Effets de focus améliorés pour l'accessibilité */
#author-recipes button:focus,
#author-recipes input:focus,
#author-recipes select:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* Smooth scrolling */
#author-recipes {
    scroll-behavior: smooth;
}

/* Loading states améliorés */
#author-recipes .loading-shimmer {
    background: linear-gradient(90deg, var(--bg-light) 25%, rgba(255, 255, 255, 0.5) 50%, var(--bg-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

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

    100% {
        background-position: 200% 0;
    }
}

.author-recipe-card.selected {
    outline: 3px solid var(--primary-color);
    transform: scale(1.02);
}


/* ==========================================
   MODAL D'AJOUT AU PLANNING
   ========================================== */

#addToPlannerModal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.28);
  z-index: 9999;
  align-items: center; justify-content: center;
}
#addToPlannerModal.active {
  display: flex;
}

#addToPlannerModal .modal-inner {
  background: var(--bg-white);
  border-radius: 18px;
  padding: 1.2rem 2.4rem 1.8rem 2.4rem;
  min-width: 300px; max-width: 96vw;
  box-shadow: var(--shadow);
  text-align: center;
  position: relative;
  color: var(--text-dark);
  transition: background 0.22s, color 0.18s;
  min-height: 260px;
}

#addToPlannerModal h2 {
  font-size: 1.21rem;
  margin-bottom: 1.2rem;
  font-weight: 700;
  color: var(--primary-color);
}

#addToPlannerModal label {
  font-weight: 600;
  color: var(--text-dark);
}

#addToPlannerModal input[type="date"],
#addToPlannerModal select {
  padding: 0.5em 1.1em;
  border-radius: 7px;
  border: 1px solid var(--text-light);
  margin-left: 0.5em;
  font-size: 1rem;
  background: var(--bg-light);
  color: var(--text-dark);
  margin-top: 0.3em;
  transition: background 0.18s, color 0.18s, border 0.2s;
}

#addToPlannerModal input[type="date"]:focus,
#addToPlannerModal select:focus {
  border: 1.5px solid var(--accent-color);
  outline: none;
}

#addToPlannerModal button {
  border: none;
  outline: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
#addToPlannerModal .btn.theme-aware-btn,
#addToPlannerModal #modalAddBtn {
  background: var(--gradient);
  color: #fff;
  margin-top: 0.7rem;
  min-width: 170px;
  font-size: 1rem;
  box-shadow: var(--shadow);
  padding: 0.6em 1.6em;
}

#addToPlannerModal .btn.theme-aware-btn:hover,
#addToPlannerModal #modalAddBtn:hover {
  background: var(--premium-gradient);
  color: var(--text-dark);
}

/* Place la croix pile dans le coin réel du bloc modal */
#addToPlannerModal .close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 2.1rem;
  border: none; background: none;
  cursor: pointer;
  color: var(--text-light);
  padding: 0;
  line-height: 1;
  transition: color 0.2s, transform 0.13s;
  z-index: 2;
}
#addToPlannerModal .close-btn:hover {
  color: var(--accent-color);
  transform: scale(1.18) rotate(10deg);
}
