:root {
    --primary-color: #3b82f6;
    --primary-color-dark: #2563eb;
    --card-background: #ffffff;
    --text-color-dark: #1f2937;
    --text-color-light: #4b5563;
    --border-color: #e5e7eb;
    --error-color: #ef4444;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #f0f4f8;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    position: relative;
    /* overflow: hidden; - Bu sətri sildik */
}



.messages {
    margin-bottom: 30px;
}
.message {
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}
.success-message {
    color: green;
    padding: 10px;
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    margin-bottom: 20px;
}
.error-message {
    background: #fee2e2;
    color: #991b1b;
}

/* New background animation */
.background-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #a78bfa, #818cf8, #3b82f6);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    z-index: -1;
    opacity: 0.1;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.card {
    background: var(--card-background);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
    max-width: 600px;
    animation: fadeIn 1s ease-in-out;
    position: relative;
    z-index: 1;
}

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

.card-header {
    margin-bottom: 30px;
}

.title {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-color-dark);
    margin: 0 0 10px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-color-light);
    margin: 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.input-container {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    align-items: center;           /* ← Alignement vertical parfait */
}

.custom-input {
    flex: 1;
    padding: 14px 20px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    color: var(--text-color-dark);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #f9fafb;
}

.custom-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.readonly-input {
    background-color: #f5f5f5 !important;
    color: #888 !important;
    cursor: not-allowed;
}

.generate-btn {
    /*padding: 14px 30px;*/
    height: 52px !important; /* Force la hauteur fixe */
    line-height: 52px;       /* Centre verticalement le texte */
    padding: 0 30px;         /* Ajuste les côtés */
    white-space: nowrap;     /* Empêche le retour à la ligne */

    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    box-sizing: border-box;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3);
}

.generate-btn,
.generate-btn.small-btn {
    display: inline-flex !important;          /* Flex pour centrer parfaitement */
    align-items: center;                      /* Centre verticalement */
    justify-content: center;                  /* Centre horizontalement */
    padding: 0 20px;                          /* Padding symétrique gauche/droite */
    height: 52px;                             /* Hauteur fixe → texte toujours centré */
    line-height: 1;                           /* Réinitialise line-height pour éviter décalage */
    text-align: center;
    box-sizing: border-box;
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none !important;   /* Supprime le soulignement */
}

.generate-btn i,
.generate-btn.small-btn i {
    margin-right: 8px;                        /* Espace icône/texte */
    line-height: 1;                           /* Icône alignée avec le texte */
}

.generate-btn:hover {
    background-color: var(--primary-color-dark);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.color-options-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 50px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;                   /* Centre le bloc entier */
}

.color-palette-group {
    text-align: center;
}

.color-label {
    font-size: 0.95rem;
    color: var(--text-color-light);
    font-weight: 600;
    margin-bottom: 10px;
    display: block;
}

.palette-options {
    display: flex;
    justify-content: center;          /* Centre les color-box horizontalement */
    gap: 10px;
    flex-wrap: wrap;
}

.color-box {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.color-box:hover {
    transform: scale(1.15);
}

.color-box.selected {
    transform: scale(1.05);
    box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--primary-color);
}

.qr-code-display {
    min-height: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.qr-code-image {
    width: 320px;
    height: 320px;
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    animation: scaleIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.27) forwards;
}

@keyframes scaleIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-top: 20px;
}

.download-link, .info-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    transition: color 0.3s ease, transform 0.2s ease;
    font-size: 1rem;
    color: var(--primary-color);
    text-decoration: none;
}

.download-link:hover, .info-btn:hover {
    color: var(--primary-color-dark);
    transform: translateY(-2px);
}

.info-btn {
    background: none;
    border: none;
    cursor: pointer;
}

.error-box {
    background-color: #fef2f2;
    color: var(--error-color);
    border: 1px solid var(--error-color);
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: left;
    font-size: 0.95rem;
    animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.27);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    animation: fadeInModal 0.3s ease-in-out forwards;
}

.modal-content {
    background-color: var(--card-background);
    margin: 15% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: slideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.27);
}

.close-btn {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover,
.close-btn:focus {
    color: var(--text-color-dark);
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-color-dark);
    margin-bottom: 25px;
    text-align: center;
}

.tutorial-steps-text {
    text-align: left;
}
.tutorial-step {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.step-number {
    width: 30px;
    height: 30px;
    min-width: 30px;
    background-color: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
}

.step-text {
    font-size: 1rem;
    color: var(--text-color-light);
    margin: 0;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@media (max-width: 600px) {
    .card {
        padding: 25px;
    }
    .input-container {
        flex-direction: column;
        align-items: stretch;
    }
    .generate-btn {
        width: 100%;
        height: 52px;
    }
    .modal-content {
        margin: 10% auto;
    }
    .color-options-container {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }
    .color-palette-group {
        width: 100%;
        max-width: 400px;
    }
    .palette-options {
        justify-content: center;
    }
}

@keyframes bounceIn {
    from, 60%, 75%, 90%, to {
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    }
    0% {
        opacity: 0;
        transform: scale3d(0.3, 0.3, 0.3);
    }
    20% {
        transform: scale3d(1.1, 1.1, 1.1);
    }
    40% {
        transform: scale3d(0.9, 0.9, 0.9);
    }
    60% {
        opacity: 1;
        transform: scale3d(1.03, 1.03, 1.03);
    }
    80% {
        transform: scale3d(0.97, 0.97, 0.97);
    }
    to {
        opacity: 1;
        transform: scale3d(1, 1, 1);
    }
}

/* Wrapper principal */
.main-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px; /* Espace entre les deux cards */
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
}

/* Card d'authentification (en haut) */
.auth-card {
    padding: 20px;
    text-align: center;
    max-width: 600px;
}

.auth-card .welcome-message {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: #1f2937;
}

.auth-buttons {
    display: flex;
    flex-wrap: wrap;           /* Permet le retour à la ligne */
    gap: 12px;                 /* Espacement uniforme entre les boutons */
    justify-content: center;   /* Centre les boutons horizontalement */
    margin-top: 15px;
}

.auth-buttons .generate-btn,
.auth-buttons form {
    flex: 1 1 200px;           /* Chaque bouton prend au moins 200px, mais peut rétrécir */
    min-width: 180px;          /* Largeur minimale pour éviter qu'ils deviennent trop petits */
    text-align: center;
}

/* Pour le bouton Log out (inline dans form) */
.auth-buttons .generate-btn {
    height: 52px;
    padding: 0 24px;
}

.auth-buttons form {
    margin: 0;                 /* Supprime les marges par défaut du form */
}

/* Optionnel : un peu plus de style pour le bouton dans le form */
.auth-buttons button.generate-btn {
    width: 100%;
    padding: 14px 20px;
    box-sizing: border-box;
}

.quota-counter {
    text-align: center;
    margin: 20px 0;
    padding: 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    color: #166534;
    font-size: 1.1rem;
    font-weight: 500;
}

.quota-counter strong {
    color: #059669;
    font-size: 1.3rem;
}

.qr-scan-count {
    font-style: italic;
    color: #4b5563;
    margin: 8px 0 12px;
}

.qr-scan-count strong {
    color: #059669;
    font-weight: 600;
}

/*Pour la sélection du type de qr*/

.qr-type-selector {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 16px;
    background: rgba(255,255,255,0.8);
    border: 1px solid #ddd;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 80px;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
}

.type-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

.type-btn.active {
    background: #4285F4;
    color: white;
    border-color: #4285F4;
    box-shadow: 0 4px 15px rgba(66,133,244,0.3);
}

.type-btn i {
    font-size: 1.6rem;
    margin-bottom: 6px;
}

.logo-option, .corner-option, .gradient-box {
    cursor: pointer;
    padding: 8px;
    border: 2px solid transparent;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.logo-option:hover, .corner-option:hover, .gradient-box:hover {
    border-color: #3b82f6;
    transform: scale(1.08);
}

.logo-option.selected, .corner-option.selected, .gradient-box.selected {
    border-color: #3b82f6 !important;
    background: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3);
}

