@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #4a6cf7;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    text-align: center;
    flex: 1;
    width: 100%;
}

/* Header Styles */
.app-header {
    margin-bottom: 2.5rem;
    animation: fadeInDown 0.8s ease;
}

.app-header h1 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.app-header h1 i {
    color: var(--primary-color);
}

.subtitle {
    color: #6c757d;
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto 1.5rem;
    line-height: 1.6;
}

/* Tutorial Steps */
.tutorial {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 2rem 0 3rem;
    position: relative;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    min-width: 100px;
    position: relative;
    z-index: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.3);
    transition: var(--transition);
}

.step p {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin: 0;
    font-weight: 500;
}

.step-connector {
    color: #ced4da;
    font-size: 1.2rem;
    margin: 0 -0.5rem;
    position: relative;
    top: -10px;
}

@media (max-width: 768px) {
    .tutorial {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .step-connector {
        transform: rotate(90deg);
        margin: 0.5rem 0;
    }
}

/* Upload Container */
.upload-container {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
    border: 1px solid #e9ecef;
    transition: var(--transition);
}

.upload-container:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.upload-area {
    border: 2px dashed #bdc3c7;
    border-radius: var(--border-radius);
    padding: 2.5rem 1.5rem;
    margin-bottom: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #f8f9fa;
    text-align: center;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(74, 108, 247, 0.03);
}

.upload-area i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    opacity: 0.8;
}

.upload-area p {
    color: #6c757d;
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
}

.upload-area input[type="file"] {
    display: none;
}

#uploadPrompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
}

#uploadPrompt span {
    font-size: 1.1rem;
    color: #495057;
    font-weight: 500;
}

#preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    transition: var(--transition);
}

#preview:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.upload-area:hover {
    border-color: #3498db;
}

#preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 4px;
}

/* Style Selection */
.style-selection {
    margin: 2rem 0 1.5rem;
}

.style-selection h3 {
    color: #495057;
    margin-bottom: 1.2rem;
    font-size: 1.25rem;
    font-weight: 600;
    position: relative;
    display: inline-block;
    padding-bottom: 0.5rem;
}

.style-selection h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
}

.style-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.2rem;
    margin-top: 1.5rem;
    justify-content: center;
}

@media (max-width: 768px) {
    .style-options {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .style-options {
        grid-template-columns: 1fr;
    }
}

.style-option {
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.style-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.style-preview {
    width: 100%;
    min-height: 160px;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    transition: var(--transition);
    border: 2px solid #e9ecef;
    background: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.style-icon {
    font-size: 2rem;
    margin-bottom: 0.8rem;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.style-preview span {
    font-weight: 600;
    color: white;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.style-desc {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    padding: 0 0.5rem;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.style-option input[type="radio"]:checked + .style-preview {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    border-width: 2px;
}

/* Style preview specific colors */
.style-option:nth-child(1) .style-preview {
    background: linear-gradient(135deg, #ffd700, #ffa500);
}

.style-option:nth-child(2) .style-preview {
    background: linear-gradient(135deg, #d8bfd8, #9370db);
}

.style-option:nth-child(3) .style-preview {
    background: linear-gradient(135deg, #ffa07a, #ff6b6b);
}

/* Hover effects */
.style-option:hover .style-preview {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.style-option input[type="radio"]:checked + .style-preview {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.15);
}

/* Add a subtle pulse animation to the selected style */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(74, 108, 247, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(74, 108, 247, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 108, 247, 0); }
}

.style-option input[type="radio"]:checked + .style-preview {
    animation: pulse 1.5s infinite;
}

/* Buttons */
.generate-btn, .action-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.9rem 2.2rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.3);
    position: relative;
    overflow: hidden;
    margin-top: 1rem;
}

.generate-btn:hover, .action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 108, 247, 0.4);
}

.generate-btn:active, .action-btn:active {
    transform: translateY(0);
}

.generate-btn i, .action-btn i {
    font-size: 1rem;
}

/* Specific button styles */
.download-btn {
    background-color: var(--success-color);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.download-btn:hover {
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
}

.share-btn {
    background-color: #17a2b8;
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

.share-btn:hover {
    box-shadow: 0 6px 16px rgba(23, 162, 184, 0.4);
}

.new-btn {
    background-color: #6c757d;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.new-btn:hover {
    box-shadow: 0 6px 16px rgba(108, 117, 125, 0.4);
}

.generate-btn:disabled, .action-btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.generate-btn:hover, .download-btn:hover {
    background-color: #2980b9;
}

.generate-btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* Result Container */
.result-container {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
    margin-top: 2rem;
    border: 1px solid #e9ecef;
    animation: fadeIn 0.5s ease-out;
}

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

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

.result-container h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#selectedStyleBadge {
    background: var(--primary-color);
    color: white;
    font-size: 0.8rem;
    padding: 0.2rem 0.8rem;
    border-radius: 50px;
    margin-left: 0.5rem;
    font-weight: 500;
    text-transform: capitalize;
    display: inline-flex;
    align-items: center;
    height: 1.8rem;
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.result-image {
    margin: 0 auto;
    max-width: 100%;
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-image img {
    max-width: 100%;
    max-height: 500px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.result-image img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.generation-tip {
    font-size: 0.9rem;
    color: #6c757d;
    margin-top: 1rem;
    font-style: italic;
}

/* Progress Bar */
.generation-progress {
    margin-bottom: 1.5rem;
    text-align: left;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), #6c5ce7);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: #6c757d;
    text-align: center;
}

/* Result Actions */
.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.action-btn {
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    color: white;
}

.action-btn i {
    font-size: 0.9rem;
}

/* Advanced Options */
.advanced-options {
    margin-top: 1.5rem;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.advanced-toggle {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
    background: #f1f3f5;
    transition: var(--transition);
}

.advanced-toggle:hover {
    background: #e9ecef;
}

.advanced-toggle i {
    transition: transform 0.3s ease;
}

.advanced-content {
    padding: 1.5rem;
    border-top: 1px solid #e9ecef;
}

.option-group {
    margin-bottom: 1.2rem;
}

.option-group:last-child {
    margin-bottom: 0;
}

.option-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #495057;
    font-weight: 500;
}

.option-group input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    background: #e9ecef;
    border-radius: 3px;
    outline: none;
    margin: 0.8rem 0;
}

.option-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.option-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.option-group span {
    display: inline-block;
    margin-left: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
    min-width: 30px;
    text-align: right;
}

/* History Section */
.history {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid #e9ecef;
}

.history h3 {
    color: #495057;
    margin-bottom: 1.2rem;
    font-size: 1.25rem;
    text-align: left;
    position: relative;
    padding-left: 1rem;
}

.history h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 1.2em;
    background: var(--primary-color);
    border-radius: 2px;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.history-item {
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    aspect-ratio: 1;
    transition: var(--transition);
    border: 1px solid #e9ecef;
}

.history-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.history-item:hover img {
    transform: scale(1.05);
}

.history-item .style-badge {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 50px;
    text-transform: capitalize;
}

.result-image {
    margin: 1.5rem 0;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.loading {
    text-align: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.download-btn {
    background-color: #2ecc71;
}

.download-btn:hover {
    background-color: #27ae60;
}

/* Footer */
.app-footer {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 2rem 1rem;
    text-align: center;
    margin-top: 3rem;
}

.app-footer p {
    margin: 0 0 1rem;
    font-size: 0.95rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.footer-link {
    color: #bdc3c7;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: white;
    text-decoration: underline;
}

.divider {
    color: #7f8c8d;
    font-size: 0.8rem;
    margin: 0 0.3rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #2c3e50;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast i {
    font-size: 1.1rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-overlay .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

#loadingMessage {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-top: 1rem;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .app-header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .upload-container {
        padding: 1.5rem 1rem;
    }
    
    .style-options {
        grid-template-columns: 1fr 1fr;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .action-btn {
        width: 100%;
    }
    
    .history-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .style-options {
        grid-template-columns: 1fr;
    }
    
    .history-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .app-footer {
        padding: 1.5rem 1rem;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .divider {
        display: none;
    }
}

/* Animation for the generate button when enabled */
@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(74, 108, 247, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(74, 108, 247, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 108, 247, 0); }
}

.generate-btn:not(:disabled) {
    animation: pulseGlow 2s infinite;
}

/* Hover effect for history items */
.history-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0) 50%);
    opacity: 0;
    transition: var(--transition);
}

.history-item:hover::after {
    opacity: 1;
}

/* Add a subtle scale effect to the upload area when dragging a file over it */
.upload-area.drag-over {
    transform: scale(1.01);
    border-color: var(--primary-color);
    background-color: rgba(74, 108, 247, 0.05);
}

/* Add a subtle animation to the upload prompt */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.upload-area:not(.has-image) #uploadPrompt {
    animation: bounce 2s infinite;
}

/* Add a subtle gradient overlay to the style previews */
.style-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
    z-index: 0;
}

/* Ensure all text and icons are above the gradient */
.style-icon,
.style-preview span,
.style-desc {
    position: relative;
    z-index: 1;
}
