/* QiGift Lite Frontend Styles */

:root {
    --primary-color: #2E7D32;
    --secondary-color: #F5F5DC;
    --text-color: #333333;
    --light-gray: #f5f5f5;
    --border-color: #ddd;
    --success-color: #46b450;
    --error-color: #dc3232;
}

* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
}

/* Container principal */
.qigift-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

/* Header */
.qigift-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--secondary-color);
}

.qigift-header h1 {
    color: var(--primary-color);
    font-size: 36px;
    margin: 0 0 10px 0;
    font-weight: 300;
}

.qigift-header .subtitle {
    color: #666;
    font-size: 18px;
    margin: 0;
}

/* Steps */
.qigift-step {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.qigift-step.active {
    display: block;
}

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

.qigift-step h2 {
    color: var(--primary-color);
    font-size: 24px;
    margin: 0 0 30px 0;
    font-weight: 400;
    text-align: center;
}

/* Form elements */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

.form-group {
    flex: 1;
}

.form-group.full-width {
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #999;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Templates grid */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.template-option {
    cursor: pointer;
    text-align: center;
    transition: transform 0.3s ease;
}

.template-option:hover {
    transform: translateY(-5px);
}

.template-option.selected .template-preview {
    border-color: var(--primary-color);
    box-shadow: 0 5px 20px rgba(46, 125, 50, 0.3);
}

.template-preview {
    height: 180px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.template-preview::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    transform: rotate(45deg);
    transition: all 0.5s ease;
    opacity: 0;
}

.template-option:hover .template-preview::before {
    animation: shine 0.5s ease;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); opacity: 0; }
}

.template-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.template-header p {
    margin: 5px 0 0 0;
    font-size: 12px;
    opacity: 0.8;
}

.template-body p {
    margin: 8px 0;
    font-size: 13px;
}

.template-name {
    margin-top: 12px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

/* Preview container */
.preview-container {
    background: var(--light-gray);
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#card-preview {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 500px;
}

/* Delivery options */
.delivery-options {
    margin-bottom: 30px;
}

.delivery-option {
    display: block;
    padding: 25px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.delivery-option:hover {
    border-color: var(--primary-color);
    background: rgba(46, 125, 50, 0.02);
}

.delivery-option.selected {
    border-color: var(--primary-color);
    background: rgba(46, 125, 50, 0.05);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.delivery-option input[type="radio"] {
    margin-right: 15px;
    transform: scale(1.2);
}

.option-content h3 {
    margin: 0 0 8px 0;
    display: inline;
    color: var(--primary-color);
    font-size: 18px;
}

.option-content p {
    margin: 5px 0 0 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

/* Email fields */
#email-fields {
    background: var(--light-gray);
    padding: 25px;
    border-radius: 8px;
    margin-top: 20px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 500px; }
}

/* Form actions */
.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.form-actions .button {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.form-actions .button-primary {
    background: var(--primary-color);
    color: white;
}

.form-actions .button-primary:hover {
    background: #1B5E20;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 125, 50, 0.3);
}

.form-actions .button-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.form-actions .button-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.form-actions .button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Payment notice */
.qigift-payment-notice {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 1px solid #ffc107;
    border-radius: 10px;
    padding: 20px;
    margin-top: 30px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(255, 193, 7, 0.2);
}

.qigift-payment-notice p {
    margin: 0;
    color: #856404;
    font-size: 14px;
}

.qigift-payment-notice strong {
    color: #664d03;
}

/* Modal */
.qigift-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    padding: 0;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), #1B5E20);
    color: white;
    padding: 30px;
    text-align: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 400;
}

.modal-body {
    padding: 30px;
    text-align: center;
}

.modal-body p {
    margin: 0 0 20px 0;
    font-size: 16px;
    line-height: 1.6;
}

#card-number {
    font-family: monospace;
    font-size: 18px;
    color: var(--primary-color);
    font-weight: bold;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

/* Loading spinner */
.qigift-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

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

/* Success animation */
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.success-checkmark svg {
    width: 100%;
    height: 100%;
}

.success-checkmark .checkmark {
    stroke: var(--success-color);
    stroke-width: 3;
    fill: none;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drawCheck 0.5s ease forwards;
}

@keyframes drawCheck {
    to { stroke-dashoffset: 0; }
}

/* Error styles */
.qigift-error {
    background: #ffebee;
    border: 1px solid var(--error-color);
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    color: var(--error-color);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .qigift-container {
        padding: 15px;
        margin: 10px;
    }
    
    .qigift-header h1 {
        font-size: 28px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .templates-grid {
        grid-template-columns: 1fr;
    }
    
    .delivery-option {
        padding: 20px;
    }
    
    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
}

@media (max-width: 480px) {
    .qigift-container {
        padding: 10px;
    }
    
    .qigift-header h1 {
        font-size: 24px;
    }
    
    .qigift-step h2 {
        font-size: 20px;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 10px 12px;
        font-size: 16px; /* Empêche le zoom sur iOS */
    }
    
    .form-actions .button {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Print styles */
@media print {
    .qigift-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .form-actions,
    .qigift-payment-notice {
        display: none;
    }
}
