/* Checkout Styles */

/* Notifications pour Checkout */
.checkout-notification {
    padding: 1rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    font-weight: 500;
    animation: slideInDown 0.3s ease-out;
    z-index: 1000;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.checkout-notification.success {
    background: #f0fff4;
    color: #38a169;
    border: 1px solid #9ae6b4;
}

.checkout-notification.error {
    background: #fed7d7;
    color: #e53e3e;
    border: 1px solid #feb2b2;
}

.checkout-notification.warning {
    background: #fefcbf;
    color: #d69e2e;
    border: 1px solid #faf089;
}

.checkout-notification.info {
    background: #ebf8ff;
    color: #3182ce;
    border: 1px solid #90cdf4;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification-content i {
    flex-shrink: 0;
    font-size: 1.1rem;
}

.notification-content span {
    flex: 1;
    line-height: 1.5;
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s;
    color: inherit;
    opacity: 0.7;
    flex-shrink: 0;
}

.close-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
    opacity: 1;
}

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

.checkout-section {
    padding: 6rem 0 4rem;
    background: var(--background-light);
    min-height: 100vh;
}

.checkout-header {
    text-align: center;
    margin-bottom: 3rem;
}

.checkout-header h1 {
    color: var(--text-dark);
    margin-bottom: 2rem;
}

.checkout-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    margin-bottom: 3rem;
    padding: 0 2rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
    position: relative;
    min-width: 150px;
    justify-content: center;
}

.step:first-child {
    border-radius: 25px 0 0 25px;
}

.step:last-child {
    border-radius: 0 25px 25px 0;
}

.step.completed {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.step.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: 600;
}

.step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.step.completed .step-number {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.step.active .step-number {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.step:not(.completed):not(.active) .step-number {
    background: #e9ecef;
    color: #6c757d;
    border-color: #ced4da;
}

.step-text {
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
}

.checkout-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
}

/* Order Summary */
.order-summary {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.order-summary h2 {
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.order-item {
    padding: 1.5rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.order-item h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.order-item p {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.order-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.order-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 2px solid var(--border-light);
    margin-top: 1rem;
}

.total-label {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-dark);
}

.total-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Checkout Form */
.checkout-form {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.form-section {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-light);
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-subsection {
    margin-bottom: 2rem;
}

.form-subsection h4 {
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group small {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: block;
}

/* File Upload Styling */
.file-upload {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-upload .file-button {
    background: var(--primary-color);
    color: var(--white);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.08s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.file-upload .file-button:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

.file-upload .file-name {
    font-size: 0.95rem;
    color: var(--text-dark);
    background: var(--background-light);
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    min-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Keep native input accessible but invisible and covering the button */
.file-upload input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Fallback simple styling for browsers without JS or when not using wrapper */
input[type="file"] {
    padding: 0.5rem;
    border: 2px dashed var(--border-light);
    background: var(--background-light);
    cursor: pointer;
    border-radius: 6px;
}

input[type="file"]:hover {
    border-color: var(--primary-color);
}

/* Checkbox and Radio Styling */
.checkbox-group,
.radio-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.checkbox-label,
.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.checkbox-label:hover,
.radio-label:hover {
    background: var(--background-light);
}

.checkbox-label input[type="checkbox"],
.radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark,
.radiomark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-light);
    border-radius: 3px;
    position: relative;
    transition: all 0.3s ease;
}

.radiomark {
    border-radius: 50%;
}

input[type="checkbox"]:checked + .checkmark,
input[type="radio"]:checked + .radiomark {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: -2px;
    left: 2px;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

input[type="radio"]:checked + .radiomark::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.btn-primary,
.btn-secondary {
    padding: 1rem 2rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
    flex: 1;
    justify-content: center;
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--border-light);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: #cbd5e0;
}

/* Required field indicator */
label::after {
    content: "";
}

label:has(+ input[required])::after,
label:has(+ textarea[required])::after,
label:has(+ select[required])::after {
    content: " *";
    color: #e53e3e;
}

/* Error states */
.form-group.error input,
.form-group.error textarea,
.form-group.error select {
    border-color: #e53e3e;
}

.error-message {
    color: #e53e3e;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: none;
}

.form-group.error .error-message {
    display: block;
}

/* Success states */
.form-group.success input,
.form-group.success textarea,
.form-group.success select {
    border-color: #16a085;
}

/* Loading state */
.btn-primary.loading {
    position: relative;
    color: transparent;
}

.btn-primary.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid transparent;
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .checkout-content {
        grid-template-columns: 1fr;
    }
    
    .order-summary {
        position: relative;
        top: 0;
        order: 2;
    }
}

@media (max-width: 768px) {
    .checkout-steps {
        flex-direction: column;
        gap: 0;
        padding: 0 1rem;
    }
    
    .step {
        min-width: 250px;
        border-radius: 0;
        border-bottom: none;
    }
    
    .step:first-child {
        border-radius: 15px 15px 0 0;
        border-bottom: none;
    }
    
    .step:last-child {
        border-radius: 0 0 15px 15px;
        border-bottom: 1px solid #dee2e6;
    }
    
    .step.completed:last-child {
        border-bottom: 1px solid #28a745;
    }
    
    .step.active:last-child {
        border-bottom: 1px solid #007bff;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .checkbox-group,
    .radio-group {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .checkout-section {
        padding: 4rem 0 2rem;
    }
    
    .checkout-form,
    .order-summary {
        padding: 1rem;
    }
    
    .step {
        padding: 0.75rem 1rem;
        min-width: 200px;
    }
}

/* Address Autocomplete Styles */
.address-autocomplete-container {
    position: relative;
}

.address-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.address-suggestions.show {
    display: block;
}

.address-suggestion {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s ease;
}

.address-suggestion:hover,
.address-suggestion.highlighted {
    background-color: var(--background-light);
}

.address-suggestion:last-child {
    border-bottom: none;
}

.address-suggestion .main-text {
    font-weight: 500;
    color: var(--text-dark);
    line-height: 1.4;
}

.address-loading {
    padding: 12px 16px;
    text-align: center;
    color: var(--text-light);
    font-style: italic;
}

/* Styles pour les aides visuelles */
.help-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s ease;
}

.help-btn:hover {
    background: #0056b3;
}

.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.help-content {
    background: white;
    border-radius: 10px;
    padding: 20px;
    max-width: 90%;
    max-height: 90%;
    position: relative;
    overflow: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

.help-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    z-index: 1001;
}

.help-close:hover {
    color: #000;
}

.help-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 10px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.help-content h4 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 18px;
}

.help-content p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 0;
}

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

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

/* Responsive design pour les modales */
@media (max-width: 768px) {
    .help-content {
        margin: 20px;
        max-width: calc(100% - 40px);
        max-height: calc(100% - 40px);
    }
    
    .help-image {
        max-width: 100%;
    }
}

/* Style pour les inputs de fichiers multiples */
input[type="file"][multiple] {
    padding: 12px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: #f9f9f9;
    transition: border-color 0.3s ease;
}

input[type="file"][multiple]:hover {
    border-color: #007bff;
    background: #f0f8ff;
}

input[type="file"][multiple]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Indicateur de fichiers sélectionnés */
.file-count {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 8px;
    animation: fadeIn 0.3s ease-out;
}
