/* ButterflyMe Avatar Creator Styles */

.avatar-creator {
    max-width: 900px;
    margin: 0 auto;
}

.step-card {
    background: white;
    padding: 3rem;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
    animation: fadeIn 0.5s ease;
}

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

.step-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.step-number {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.step-header h2 {
    color: var(--primary-color);
    margin: 0;
}

.step-description {
    color: #666;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* Upload Area */
.upload-area {
    border: 3px dashed var(--primary-color);
    border-radius: 15px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(139, 71, 137, 0.05);
}

.upload-area:hover {
    border-color: var(--secondary-color);
    background: rgba(139, 71, 137, 0.1);
}

.upload-area.dragover {
    border-color: var(--accent-color);
    background: rgba(255, 217, 61, 0.2);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-area p {
    margin: 0.5rem 0;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.upload-hint {
    font-size: 0.9rem !important;
    color: #999 !important;
}

.preview-container {
    position: relative;
}

.preview-container img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.camera-section {
    margin-top: 2rem;
    text-align: center;
}

.camera-section .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Fix button contrast on light backgrounds */
.avatar-creator .btn-secondary {
    background-color: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    margin-left: 0;
}

.avatar-creator .btn-secondary:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Style Grid */
.style-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.style-option {
    background: white;
    border: 3px solid #E0E0E0;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.style-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.style-option.selected {
    border-color: var(--secondary-color);
    background: linear-gradient(135deg, rgba(139, 71, 137, 0.1), rgba(255, 107, 157, 0.1));
    box-shadow: var(--shadow-lg);
}

.style-preview {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.style-option h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.style-option p {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

/* Customization Form */
.customization-form {
    margin-top: 2rem;
}

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

.form-section label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.species-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.species-btn {
    flex: 1;
    min-width: 140px;
    padding: 1rem;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.species-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.species-btn.selected {
    border-color: var(--secondary-color);
    background: linear-gradient(135deg, rgba(139, 71, 137, 0.1), rgba(255, 107, 157, 0.1));
    box-shadow: var(--shadow);
}

.species-emoji {
    font-size: 2rem;
}

.custom-select {
    width: 100%;
    padding: 1rem;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.custom-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-section input[type="checkbox"] {
    margin-right: 0.5rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Generation Area */
.generation-area {
    margin-top: 2rem;
}

.generation-content {
    text-align: center;
}

.preview-summary {
    display: flex;
    gap: 2rem;
    align-items: center;
    background: var(--bg-light);
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
}

.preview-summary img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.summary-details {
    text-align: left;
    flex: 1;
}

.summary-details p {
    margin: 0.75rem 0;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.btn-large {
    padding: 1.5rem 3rem;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.generation-note {
    color: #999;
    font-size: 0.9rem;
    font-style: italic;
}

/* Loading State */
.loading-spinner {
    width: 80px;
    height: 80px;
    border: 6px solid #E0E0E0;
    border-top: 6px solid var(--primary-color);
    border-radius: 50%;
    margin: 2rem auto;
    animation: spin 1s linear infinite;
}

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

.loading-message {
    color: #666;
    font-size: 1.1rem;
    margin: 1rem 0;
}

.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 12px;
    background: #E0E0E0;
    border-radius: 6px;
    margin: 2rem auto;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 6px;
    width: 0%;
    transition: width 0.5s ease;
    animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Result Display */
.result-avatar {
    margin: 2rem auto;
    max-width: 600px;
}

.result-avatar img {
    width: 100%;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
}

.avatar-info {
    margin: 2rem 0;
}

.avatar-info h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.avatar-id {
    font-family: monospace;
    color: #666;
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

.species-info {
    color: #666;
    font-style: italic;
    margin: 1rem 0;
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

/* Step Navigation */
.step-navigation {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.gallery-item {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.gallery-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
}

.gallery-item-info {
    padding: 1rem;
    text-align: center;
}

.gallery-item-species {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.gallery-item-date {
    color: #999;
    font-size: 0.85rem;
}

.gallery-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #999;
}

/* Camera Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-dark);
}

.camera-container {
    margin: 1rem 0;
}

.camera-container video {
    width: 100%;
    max-width: 640px;
    border-radius: 10px;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .step-card {
        padding: 2rem 1.5rem;
    }

    .style-grid {
        grid-template-columns: 1fr;
    }

    .preview-summary {
        flex-direction: column;
        text-align: center;
    }

    .summary-details {
        text-align: center;
    }

    .species-selector {
        flex-direction: column;
    }

    .species-btn {
        min-width: 100%;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-actions .btn {
        width: 100%;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }
}
