/* ============================================
   Pont'o'Poker Club - Styles personnalisés
   Version compatible CDN Tailwind (sans @apply)
   ============================================ */

/* Reset et base */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    /* Prevent bounce scroll on iOS */
    overscroll-behavior-y: none;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* Safe area pour iPhone avec notch */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    /* Empêcher la sélection de texte accidentelle */
    -webkit-user-select: none;
    user-select: none;
    /* Empêcher le callout iOS */
    -webkit-touch-callout: none;
}

/* Autoriser la sélection de texte dans les inputs et textareas */
input, textarea, [contenteditable] {
    -webkit-user-select: text;
    user-select: text;
}

/* Améliorer le touch sur les boutons */
button, a, .btn, [role="button"] {
    touch-action: manipulation;
}

/* Supprimer le tap highlight sur tous les éléments */
a, button, input, select, textarea {
    -webkit-tap-highlight-color: transparent;
}

/* ============================================
   Loader
   ============================================ */

#loader {
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@keyframes cardFlip {
    0%, 100% {
        transform: rotateY(0deg) translateY(0);
    }
    50% {
        transform: rotateY(180deg) translateY(-20px);
    }
}

.animate-card-flip {
    animation: cardFlip 2s ease-in-out infinite;
}

.animate-card-flip.delay-0 { animation-delay: 0s; }
.animate-card-flip.delay-100 { animation-delay: 0.1s; }
.animate-card-flip.delay-200 { animation-delay: 0.2s; }
.animate-card-flip.delay-300 { animation-delay: 0.3s; }

/* ============================================
   Animations
   ============================================ */

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

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-left {
    animation: slideInLeft 0.5s ease-out forwards;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-right {
    animation: slideInRight 0.5s ease-out forwards;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.animate-pulse-on-hover:hover {
    animation: pulse 0.5s ease-in-out;
}

/* Stagger delay classes */
.stagger-1 { animation-delay: 0.1s; opacity: 0; }
.stagger-2 { animation-delay: 0.2s; opacity: 0; }
.stagger-3 { animation-delay: 0.3s; opacity: 0; }
.stagger-4 { animation-delay: 0.4s; opacity: 0; }
.stagger-5 { animation-delay: 0.5s; opacity: 0; }
.stagger-6 { animation-delay: 0.6s; opacity: 0; }

/* ============================================
   Cards
   ============================================ */

.card {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid #f3f4f6;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-4px);
}

.card-header {
    padding: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f3f4f6;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background-color: #f9fafb;
    border-top: 1px solid #f3f4f6;
}

.card-tournoi {
    position: relative;
    overflow: hidden;
}

.card-tournoi::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    z-index: 0;
}

.card-tournoi .content {
    position: relative;
    z-index: 1;
}

.card-tournoi .badge-statut {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2;
}

/* ============================================
   Boutons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    outline: none;
}

.btn:focus-visible {
    outline: 2px solid;
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #DC2626;
    color: white;
}

.btn-primary:hover {
    background-color: #B91C1C;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.btn-primary:focus-visible {
    outline-color: #DC2626;
}

.btn-secondary {
    background-color: #374151;
    color: white;
}

.btn-secondary:hover {
    background-color: #1f2937;
}

.btn-secondary:focus-visible {
    outline-color: #374151;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid #DC2626;
    color: #DC2626;
}

.btn-outline:hover {
    background-color: #DC2626;
    color: white;
}

.btn-outline:focus-visible {
    outline-color: #DC2626;
}

.btn-ghost {
    color: #4b5563;
    background-color: transparent;
}

.btn-ghost:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-danger:focus-visible {
    outline-color: #ef4444;
}

.btn-success {
    background-color: #22c55e;
    color: white;
}

.btn-success:hover {
    background-color: #16a34a;
}

.btn-success:focus-visible {
    outline-color: #22c55e;
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

/* ============================================
   Formulaires
   ============================================ */

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

.form-input {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    outline: none;
    transition: all 0.2s ease;
}

.form-input:focus {
    border-color: transparent;
    box-shadow: 0 0 0 2px #DC2626;
}

.form-input.error {
    border-color: #ef4444;
}

.form-input.error:focus {
    box-shadow: 0 0 0 2px #ef4444;
}

.form-input.success {
    border-color: #22c55e;
}

.form-input.success:focus {
    box-shadow: 0 0 0 2px #22c55e;
}

.form-text {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.form-error {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #ef4444;
}

.form-checkbox {
    width: 1rem;
    height: 1rem;
    accent-color: #DC2626;
    border-color: #d1d5db;
    border-radius: 0.25rem;
}

.form-select {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    outline: none;
    transition: all 0.2s ease;
    background-color: white;
}

.form-select:focus {
    border-color: transparent;
    box-shadow: 0 0 0 2px #DC2626;
}

.form-textarea {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    outline: none;
    transition: all 0.2s ease;
    resize: none;
}

.form-textarea:focus {
    border-color: transparent;
    box-shadow: 0 0 0 2px #DC2626;
}

/* ============================================
   Badges
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary {
    background-color: #fecaca;
    color: #b91c1c;
}

.badge-success {
    background-color: #bbf7d0;
    color: #15803d;
}

.badge-warning {
    background-color: #fef08a;
    color: #a16207;
}

.badge-danger {
    background-color: #fecaca;
    color: #b91c1c;
}

.badge-info {
    background-color: #bfdbfe;
    color: #1d4ed8;
}

.badge-gold {
    background-color: #facc15;
    color: #713f12;
}

.badge-silver {
    background-color: #d1d5db;
    color: #374151;
}

.badge-bronze {
    background-color: #fed7aa;
    color: #9a3412;
}

/* ============================================
   Alertes
   ============================================ */

.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    border-left-width: 4px;
    border-left-style: solid;
}

.alert-success {
    background-color: #f0fdf4;
    border-left-color: #22c55e;
    color: #15803d;
}

.alert-error {
    background-color: #fef2f2;
    border-left-color: #ef4444;
    color: #b91c1c;
}

.alert-info {
    background-color: #eff6ff;
    border-left-color: #3b82f6;
    color: #1d4ed8;
}

.alert-warning {
    background-color: #fefce8;
    border-left-color: #eab308;
    color: #a16207;
}

/* Flash messages avec auto-dismiss */
.flash-messages .flash-message {
    animation: slideInRight 0.3s ease-out;
}

/* ============================================
   Tableaux
   ============================================ */

.table-container {
    overflow-x: auto;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.table {
    width: 100%;
}

.table thead {
    background-color: #f9fafb;
}

.table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    border-top: 1px solid #e5e7eb;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: #f9fafb;
}

.table tbody tr:nth-child(even) {
    background-color: rgba(249, 250, 251, 0.5);
}

/* ============================================
   Hero sections
   ============================================ */

.hero {
    position: relative;
    overflow: hidden;
}

.hero-gradient-red {
    background: linear-gradient(to bottom right, #DC2626, #b91c1c, #7f1d1d);
}

.hero-overlay {
    background: linear-gradient(135deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 100%);
}

/* ============================================
   Stats cards
   ============================================ */

.stat-card {
    background-color: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border: 1px solid #f3f4f6;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: #111827;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.stat-icon.primary {
    background: linear-gradient(to bottom right, #DC2626, #b91c1c);
}

.stat-icon.secondary {
    background: linear-gradient(to bottom right, #374151, #1f2937);
}

.stat-icon.gold {
    background: linear-gradient(to bottom right, #F59E0B, #d97706);
}

/* ============================================
   Modal
   ============================================ */

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 32rem;
    width: 100%;
    margin: 1rem;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background-color: #f9fafb;
    border-top: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ============================================
   Podium classement
   ============================================ */

.podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.podium-place {
    text-align: center;
}

.podium-place.first {
    order: 2;
}

.podium-place.second {
    order: 1;
}

.podium-place.third {
    order: 3;
}

.podium-bar {
    border-radius: 0.5rem 0.5rem 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-top: 1rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.podium-bar.first {
    height: 8rem;
    background: linear-gradient(to top, #eab308, #facc15);
}

.podium-bar.second {
    height: 6rem;
    background: linear-gradient(to top, #9ca3af, #d1d5db);
}

.podium-bar.third {
    height: 5rem;
    background: linear-gradient(to top, #ea580c, #fed7aa);
}

.podium-medal {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.podium-position {
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
}

.podium-pseudo {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    margin-top: 0.5rem;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   Scrollbar personnalisée
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background-color: #f3f4f6;
}

::-webkit-scrollbar-thumb {
    background-color: #9ca3af;
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #6b7280;
}

/* ============================================
   Utilitaires
   ============================================ */

.container-custom {
    max-width: 80rem;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container-custom {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container-custom {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

.section {
    padding-top: 4rem;
    padding-bottom: 4rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .section-title {
        font-size: 1.875rem;
    }
}

.section-subtitle {
    color: #6b7280;
    margin-bottom: 2rem;
}

.divider {
    border-top: 1px solid #e5e7eb;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.text-gradient {
    background: linear-gradient(to right, #DC2626, #b91c1c);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 640px) {
    .section {
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .podium {
        gap: 0.5rem;
    }

    .podium-bar {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }
}

/* ============================================
   Navigation (remplace le @apply)
   ============================================ */

.nav-link {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.nav-link:hover {
    color: #111827;
    background-color: #f3f4f6;
    transform: translateY(-2px);
}

.nav-link.active {
    color: #DC2626;
    background-color: #fef2f2;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    color: #374151;
    transition: background-color 0.2s ease;
    text-decoration: none;
}

.mobile-nav-link:hover {
    background-color: #f3f4f6;
}

.mobile-nav-link.active {
    color: #DC2626;
    background-color: #fef2f2;
    font-weight: 500;
}

/* ============================================
   Dark mode toggle (préparé)
   ============================================ */

@media (prefers-color-scheme: dark) {
    /* Dark mode styles si activé plus tard */
}

/* ============================================
   Mode App Mobile (PWA)
   ============================================ */

/* Footer avec safe-area pour iPhone */
footer {
    padding-bottom: calc(env(safe-area-inset-bottom) + 1rem);
}

/* Sur mobile, le footer est masqué car on a la bottom nav (mode app iOS) */
@media (max-width: 767px) {
    footer {
        display: none;
    }
}

/* Navigation mobile avec safe-area */
@media (max-width: 768px) {
    .mobile-menu {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Améliorer la taille du touch sur mobile */
    button, a, .btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Inputs plus grands sur mobile */
    input, select, textarea {
        min-height: 44px;
        font-size: 16px !important; /* Empêche le zoom automatique iOS */
    }
}

/* Sticky header avec safe-area */
nav {
    padding-top: env(safe-area-inset-top);
}

/* Améliorer les boutons mobiles */
@media (max-width: 640px) {
    .btn, button, a[class*="btn"] {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
    }
}

/* Supprimer le delay de click sur mobile */
* {
    -webkit-touch-callout: none;
}

/* Améliorer le scrolling sur mobile */
@media (max-width: 768px) {
    main {
        overscroll-behavior-y: contain;
    }
}

/* ============================================
   Page Transitions
   ============================================ */

/* Animation d'entrée de page */
@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-transition-in {
    animation: pageIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Animation de sortie de page */
@keyframes pageOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-15px) scale(0.98);
    }
}

.page-transition-out {
    animation: pageOut 0.25s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* Overlay de transition */
.page-transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.page-transition-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Loader de transition */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #DC2626, #F59E0B, #DC2626);
    background-size: 200% 100%;
    z-index: 10000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.page-loader.loading {
    animation: loadingBar 1s ease-in-out infinite;
}

@keyframes loadingBar {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0); }
    100% { transform: translateX(100%); }
}

/* Précharger les liens */
a[href] {
    position: relative;
}

/* Lien actif pendant la transition */
a.transitioning {
    pointer-events: none;
    opacity: 0.7;
}
