/* ============================================
   CALCULATEUR PGCD - STYLES MODERNES
   ============================================ */

/* Container principal */
.calculator-container {
    max-width: 650px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Carte du calculateur */
.calculator-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.calculator-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    pointer-events: none;
}

/* Header */
.calculator-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.calculator-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.calculator-title {
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.calculator-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 400;
}

/* Formulaire */
.calculator-form {
    position: relative;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    padding: 0.875rem 1rem;
    font-size: 1.2rem;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    backdrop-filter: blur(10px);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
}

.form-input:focus {
    outline: none;
    border-color: white;
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Bouton */
.btn-calculate {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #667eea;
    background: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.btn-calculate::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-calculate:hover::before {
    width: 300px;
    height: 300px;
}

.btn-calculate:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.btn-calculate:active {
    transform: translateY(-1px);
}

.btn-icon {
    width: 24px;
    height: 24px;
    position: relative;
    z-index: 1;
}

/* ============================================
   ZONE DE RÉSULTAT
   ============================================ */

/* Zone de résultat - État initial (vide) */
#pgcdresult {
    max-width: 650px;
    margin: 2rem auto;
    padding: 0 1rem;
    min-height: 0;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Zone de résultat - Quand elle contient du contenu */
#pgcdresult:not(:empty) {
    opacity: 1;
    transform: translateY(0);
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    border: 2px solid #e5e7eb;
    animation: slideIn 0.5s ease-out;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* Animation d'apparition */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* En-tête du résultat */
#pgcdresult .result-header {
    text-align: center;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
}

#pgcdresult .result-title {
    font-size: 1.5rem;
    color: #667eea;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: #667eea;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

/* Conteneur des étapes - SANS TITRE */
#pgcdresult .steps-container {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
    position: relative;
    overflow: hidden;
}

/* Barre colorée latérale */
#pgcdresult .steps-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
}

/* Chaque étape - ESPACEMENT RÉDUIT */
#pgcdresult .step {
    padding: 0.3rem 0;
    font-size: 1.1rem;
    font-family: 'Courier New', Consolas, monospace;
    color: #374151;
    border-bottom: 1px dashed #d1d5db;
    line-height: 1.4;
    animation: fadeIn 0.3s ease-out backwards;
}

/* Animation décalée pour chaque étape */
#pgcdresult .step:nth-child(1) { animation-delay: 0.1s; }
#pgcdresult .step:nth-child(2) { animation-delay: 0.2s; }
#pgcdresult .step:nth-child(3) { animation-delay: 0.3s; }
#pgcdresult .step:nth-child(4) { animation-delay: 0.4s; }
#pgcdresult .step:nth-child(5) { animation-delay: 0.5s; }
#pgcdresult .step:nth-child(n+6) { animation-delay: 0.6s; }

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

#pgcdresult .step:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

#pgcdresult .step:hover {
    background: rgba(102, 126, 234, 0.05);
    padding-left: 0.5rem;
    margin-left: -0.5rem;
    padding-right: 0.5rem;
    margin-right: -0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

/* Mise en évidence du reste - SANS FLÈCHE */
#pgcdresult .step-highlight {
    color: #dc2626;
    font-weight: 700;
    background: #fee2e2;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
}

/* Résultat final */
#pgcdresult .result-final {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    box-shadow: 
        0 4px 15px rgba(102, 126, 234, 0.4),
        0 0 0 4px rgba(102, 126, 234, 0.1);
    animation: pulse 2s ease-in-out infinite;
    letter-spacing: 0.5px;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 
            0 4px 15px rgba(102, 126, 234, 0.4),
            0 0 0 4px rgba(102, 126, 234, 0.1);
    }
    50% {
        box-shadow: 
            0 6px 20px rgba(102, 126, 234, 0.6),
            0 0 0 8px rgba(102, 126, 234, 0.2);
    }
}

/* Note pour nombres premiers entre eux */
#pgcdresult .result-note {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid #f59e0b;
    padding: 1rem 1.5rem;
    margin-top: 1rem;
    border-radius: 8px;
    color: #92400e;
    font-style: italic;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
    animation: slideIn 0.5s ease-out 0.8s backwards;
}

/* État de chargement */
#pgcdresult.loading {
    opacity: 0.5;
    pointer-events: none;
}

#pgcdresult.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f4f6;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .calculator-card {
        padding: 1.5rem;
        border-radius: 20px;
    }
    
    .calculator-title {
        font-size: 1.6rem;
    }
    
    .calculator-icon {
        font-size: 2.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-input {
        font-size: 1.1rem;
    }
    
    .btn-calculate {
        font-size: 1rem;
        padding: 0.875rem 1rem;
    }
    
    #pgcdresult:not(:empty) {
        padding: 1.5rem;
        margin: 1.5rem auto;
        border-radius: 16px;
    }
    
    #pgcdresult .result-title {
        font-size: 1.3rem;
    }
    
    #pgcdresult .step {
        font-size: 1rem;
        padding: 0.25rem 0;
        line-height: 1.3;
    }
    
    #pgcdresult .result-final {
        font-size: 1.2rem;
        padding: 1.25rem;
    }
    
    #pgcdresult .steps-container {
        padding: 0.875rem 1.25rem;
    }
}

@media (max-width: 480px) {
    .calculator-container,
    #pgcdresult {
        padding: 0 0.5rem;
    }
    
    .calculator-card {
        padding: 1.25rem;
    }
    
    .calculator-title {
        font-size: 1.4rem;
    }
    
    #pgcdresult:not(:empty) {
        padding: 1.25rem;
        border-radius: 12px;
    }
    
    #pgcdresult .step {
        font-size: 0.9rem;
        padding: 0.2rem 0;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    #pgcdresult .result-final {
        font-size: 1.1rem;
        padding: 1rem;
    }
    
    #pgcdresult .result-note {
        font-size: 0.9rem;
        padding: 0.875rem 1rem;
    }
}
