/* Styles généraux */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Variables pour le thème clair */
    --bg-color: #f4f4f4;
    --text-color: #333;
    --header-bg: #2c3e50;
    --footer-bg: #2c3e50;
    --card-bg: #fff;
    --card-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    --btn-bg: #4CAF50;
    --btn-text: #fff;
    --border-color: #ddd;
    --modal-bg: #fff;
    --modal-overlay: rgba(0, 0, 0, 0.5);
    --header-height: 100px; /* Nouvelle variable pour la hauteur du header */
    --footer-height: 100px; /* Nouvelle variable pour la hauteur du footer */
}

[data-theme="dark"] {
    /* Variables pour le thème sombre */
    --bg-color: #1a1a1a;
    --text-color: #fff;
    --header-bg: #2c3e50;
    --footer-bg: #2c3e50;
    --card-bg: #2d2d2d;
    --card-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    --btn-bg: #45a049;
    --btn-text: #fff;
    --border-color: #444;
    --modal-bg: #2d2d2d;
    --modal-overlay: rgba(0, 0, 0, 0.8);
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    padding-top: var(--header-height); /* Ajouter un padding pour le header fixe */
    padding-bottom: var(--footer-height); /* Ajouter un padding pour le footer fixe */
    min-height: 100vh;
    position: relative;
}

header {
    background-color: var(--header-bg);
    color: #ecf0f1;
    padding: 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex: 1;
}

header h1 {
    margin: 0;
    font-size: 1.8rem;
}

footer {
    background-color: var(--footer-bg);
    color: #ecf0f1;
    text-align: center;
    padding: 1rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--footer-height);
}

main {
    margin: 2rem auto;
    padding: 0 2rem;
    width: 100%;
    max-width: 100%;
    min-height: calc(100vh - var(--header-height) - var(--footer-height) - 4rem);
}

/* Styles des tickets */
.tickets-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Exactement 3 tickets par ligne */
    gap: 1.5rem;
    margin: 0 auto;
    margin-top:100px;
    margin-bottom: 100px;
    width: 100%;
    max-width: 100%;
}

.ticket {
    position: relative;
    width: 100%;
    aspect-ratio: 1701/567; /* Ratio exact des images */
    perspective: 1000px;
    cursor: pointer;
    transition: transform 0.3s ease;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    background-color: var(--card-bg);
}

.ticket:hover {
    transform: scale(1.05);
}

/* Désactiver l'effet de survol pour les tickets non ouverts des utilisateurs non-admin */
.ticket[data-admin="false"]:not([data-opened="true"]):hover {
    transform: none;
    cursor: default;
}

.ticket.special {
    grid-column: 1 / -1;
}

.ticket-front, .ticket-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    transition: transform 0.6s;
    border-radius: 10px;
    overflow: hidden;
}

.ticket-front {
    background-color: #3498db;
    transform: rotateY(0deg);
    position: relative;
}

.ticket-front img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Change de 'cover' à 'contain' pour éviter le rognage */
    background-color: var(--card-bg); /* Ajoute un fond pour les espaces vides */
}

.ticket-id {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 33.33%;
    background: rgba(0, 0, 0, 0);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.ticket.special .ticket-id {
    font-size: 3em;
    background: rgba(255, 215, 0, 0.7);
}

.ticket-back {
    background-color: #353535;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.winner-banner {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(46, 204, 113, 0.9);
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 0.9em;
    font-weight: bold;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.ticket.opened .ticket-front {
    transform: rotateY(180deg);
}

.ticket.opened .ticket-back {
    transform: rotateY(0deg);
}

.ticket.opened .winner-banner {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Styles des cases */
.cases-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    position: relative;
    z-index: 5;
}

.case {
    width: 30%;
    height: auto;
    background-color: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    text-align: center;
    transition: all 0.3s ease;
    opacity: 1;
    position: relative;
    z-index: 5;
    border: 1px solid var(--border-color);
}

.case img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.case.revealed {
    opacity: 1;
    transform: scale(1);
    animation: pulse 1s ease-in-out;
    cursor: pointer;
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Styles spécifiques pour les tickets déjà ouverts */
[data-opened="true"] .cases-container {
    opacity: 1;
}

[data-opened="true"] .case {
    opacity: 1;
    cursor: pointer;
}

.prize {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    font-weight: bold;
    transition: all 0.3s ease;
}

.prize.hidden {
    opacity: 0;
    transform: translateY(100%);
    height: 0;
    padding: 0;
    overflow: hidden;
}

.case.clicked.first-opened .prize {
    background-color: #2ecc71; /* Vert pour la première case */
    color: white;
}

.case.clicked.second-opened .prize {
    background-color: #e67e22; /* Orange pour la deuxième case */
    color: white;
}

.case.clicked.third-opened .prize {
    background-color: #e74c3c; /* Rouge pour la troisième case */
    color: white;
}

.case.clicked {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.case.clicked .prize {
    opacity: 1;
    transform: translateY(0);
    height: auto;
    padding: 10px;
}

.scratch-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 3;
    pointer-events: none;
}

.progress-bar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    overflow: hidden;
    z-index: 3;
}

.progress {
    height: 100%;
    width: 0%;
    background-color: #2ecc71;
    transition: width 0.3s ease;
}

/* Modal de grattage */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--modal-bg);
    padding: 2rem;
    border-radius: 10px;
    width: 95%;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    margin: 0 auto;
    color: var(--text-color);
}

#winner-modal .modal-content {
    max-width: 500px;
    background: linear-gradient(135deg, var(--modal-bg), var(--card-bg));
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: scale(0.7);
    opacity: 0;
    animation: modalOpen 0.3s ease-out forwards;
}

@keyframes modalOpen {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

#winner-modal .modal-title {
    color: var(--text-color);
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: bold;
}

#winner-modal .form-group {
    margin-bottom: 1.8rem;
    position: relative;
}

#winner-modal label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 600;
    color: var(--text-color);
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

#winner-modal input[type="text"] {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1.1rem;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: all 0.3s ease;
}

#winner-modal input[type="text"]:focus {
    outline: none;
    border-color: #9146FF;
    box-shadow: 0 0 0 3px rgba(145, 70, 255, 0.2);
}

#winner-modal .btn-primary {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #9146FF, #7D2EFF);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#winner-modal .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(145, 70, 255, 0.4);
}

#winner-modal .btn-primary:active {
    transform: translateY(0);
}

#winner-modal .close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    color: var(--text-color);
    opacity: 0.7;
    cursor: pointer;
    transition: all 0.3s ease;
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

#winner-modal .close:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.1);
    transform: rotate(90deg);
}

/* Animation pour l'apparition des champs */
#winner-modal .form-group {
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.3s ease-out forwards;
}

#winner-modal .form-group:nth-child(2) {
    animation-delay: 0.1s;
}

#winner-modal .btn-primary {
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.3s ease-out forwards;
    animation-delay: 0.2s;
}

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

/* Style pour le fond de la modal */
#winner-modal.modal {
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

/* Message de succès/erreur dans la modal */
#winner-modal .message {
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transform: translateY(-10px);
    animation: fadeIn 0.3s ease-out forwards;
}

#winner-modal .message.success {
    background-color: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border: 2px solid #2ecc71;
}

#winner-modal .message.error {
    background-color: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 2px solid #e74c3c;
}

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

#scratch-container {
    position: relative;
    width: 1720px;
    height: 643px;
    margin: 0 auto;
    background: transparent;
    overflow: visible;
}

#scratch-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: url('../images/cursors/piece.png') 20 20, auto;
    z-index: 10;
}

#prize-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 1720px;
    height: 643px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
    background: transparent;
}

/* Styles pour l'administration */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--card-shadow);
}

.admin-container h2 {
    color: var(--text-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.admin-container .form-section {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

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

.admin-container .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.admin-container .form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.admin-container .form-control:focus {
    outline: none;
    border-color: var(--btn-bg);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.admin-container .alert {
    padding: 12px;
    margin-bottom: 1rem;
    border-radius: 4px;
    font-weight: bold;
}

.admin-container .alert-success {
    background-color: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
    border: 1px solid #4CAF50;
}

.admin-container .alert-danger {
    background-color: rgba(244, 67, 54, 0.1);
    color: #f44336;
    border: 1px solid #f44336;
}

.admin-container .stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 2rem;
}

.admin-container .stat-box {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.admin-container .stat-box h3 {
    color: var(--text-color);
    margin-bottom: 1rem;
}

.admin-container .action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.admin-container .btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background-color: var(--btn-bg);
    color: var(--btn-text);
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.admin-container .btn:hover {
    background-color: #45a049;
}

.admin-container .btn-danger {
    background-color: #f44336;
}

.admin-container .btn-danger:hover {
    background-color: #d32f2f;
}

/* Responsive */
@media (max-width: 992px) {
    .tickets-container {
        grid-template-columns: repeat(2, 1fr); /* 2 tickets par ligne sur tablette */
    }
    
    .ticket.special {
        grid-column: 1 / -1;
    }
}

@media (max-width: 576px) {
    main {
        padding: 0 1rem;
    }

    .tickets-container {
        grid-template-columns: 1fr; /* 1 ticket par ligne sur mobile */
        padding: 0 1rem;
    }
    
    .ticket.special {
        grid-column: 1 / -1;
    }
    
    .modal-content {
        width: 95%;
        padding: 1rem;
    }
    
    #scratch-container {
        height: 300px;
    }
}

/* Styles pour l'authentification Twitch */
.user-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0;
    min-width: 200px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.twitch-button {
    display: inline-flex;
    align-items: center;
    background-color: #9146FF;
    color: white;
    padding: 12px 24px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s;
}

.twitch-button:hover {
    background-color: #7D2EFF;
}

.twitch-logo {
    width: 24px;
    height: 24px;
    margin-right: 10px;
}

.admin-btn {
    background-color: #2ecc71;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    text-decoration: none;
    margin: 0 10px;
    font-size: 0.9em;
}

.admin-btn:hover {
    background-color: #27ae60;
}

.logout-btn {
    background-color: #e74c3c;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9em;
}

.logout-btn:hover {
    background-color: #c0392b;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.theme-toggle:hover {
    background-color: rgba(128, 128, 128, 0.2);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    fill: var(--text-color);
}

.hidden {
    display: none !important;
}

/* Styles pour la liste des cadeaux */
.prizes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.prize-item {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.prize-item.revealed {
    background-color: var(--btn-bg);
    color: var(--btn-text);
    transform: scale(1.02);
    box-shadow: var(--card-shadow);
}

.prize-item .prize-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.prize-item .prize-name {
    font-weight: bold;
}

.prize-item .prize-count {
    font-size: 0.8em;
    opacity: 0.8;
}

.prize-item .prize-status {
    font-size: 0.9em;
    padding: 4px 8px;
    border-radius: 4px;
}

.prize-item.revealed .prize-status {
    background-color: rgba(255, 255, 255, 0.2);
}

.prize-item .prize-status.not-revealed {
    background-color: rgba(128, 128, 128, 0.2);
    color: var(--text-color);
}

@media (max-width: 576px) {
    .prizes-list {
        grid-template-columns: 1fr;
    }
}

/* Styles pour la navigation principale */
.main-nav {
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
}

.nav-link {
    display: inline-block;
    padding: 8px 16px;
    color: #ecf0f1;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Styles pour les boutons de thème */
.theme-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    position: absolute;
    right: 20px;
    bottom: 50%;
    transform: translateY(50%);
}

.theme-toggle,
.colorblind-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin: 0 5px;
}

.theme-toggle:hover,
.colorblind-toggle:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.theme-toggle svg,
.colorblind-toggle svg {
    width: 24px;
    height: 24px;
    fill: #ffffff;
}

.colorblind-toggle.active {
    background-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Couleurs pour le mode daltonien */
[data-colorblind="true"] .case.clicked.first-opened .prize {
    background-color: #0077BB !important; /* Bleu */
    color: white;
}

[data-colorblind="true"] .case.clicked.second-opened .prize {
    background-color: #EE7733 !important; /* Orange foncé */
    color: white;
}

[data-colorblind="true"] .case.clicked.third-opened .prize {
    background-color: #009988 !important; /* Turquoise */
    color: white;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        height: auto;
        padding: 0.5rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .user-actions {
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }

    .main-nav {
        margin-top: 0.5rem;
    }
} 