:root {
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --border-color: #e5e7eb;
    --border-upload: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
    background-image: radial-gradient(circle at top right, #e0e7ff 0%, #f3f4f6 100%);
}

.hidden {
    display: none !important;
}

.app-container {
    background-color: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    overflow: hidden;
    animation: slideUp 0.6s ease-out forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-header {
    text-align: center;
    padding: 2.5rem 2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: inline-block;
}

.app-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.app-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.app-content {
    padding: 2rem;
}

/* Upload Section */
.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    border: 2px dashed var(--border-upload);
    border-radius: var(--radius-lg);
    background-color: #f8fafc;
    cursor: pointer;
    transition: var(--transition);
}

.upload-label:hover {
    border-color: var(--primary-color);
    background-color: #eff6ff;
}

.upload-label i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    opacity: 0.8;
}

.upload-label span {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.upload-label small {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Preview Section */
.preview-section {
    margin-bottom: 1.5rem;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.image-wrapper {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    background-color: #f8fafc;
    display: flex;
    justify-content: center;
    max-height: 300px;
}

.image-wrapper img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    display: block;
}

.remove-img {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--danger-color);
    backdrop-filter: blur(4px);
    width: 28px;
    height: 28px;
}

.remove-img:hover {
    background-color: var(--danger-color);
    color: white;
}

/* Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
}

.btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.3);
}

.btn-primary:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.8;
}

.btn-secondary {
    background-color: #f1f5f9;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background-color: #f1f5f9;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.btn-icon:hover {
    background-color: #e2e8f0;
    color: var(--text-primary);
}

/* Result Section */
.result-section {
    animation: slideUp 0.4s ease-out;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.result-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.textarea-wrapper {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

textarea {
    width: 100%;
    height: 200px;
    padding: 1rem;
    border: none;
    resize: vertical;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: #fafafa;
    outline: none;
    transition: var(--transition);
}

textarea:focus {
    background-color: white;
    box-shadow: inset 0 0 0 2px var(--primary-color);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e7ff;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.progress-bar-container {
    width: 70%;
    height: 6px;
    background-color: #e0e7ff;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.2s ease;
}

/* Responsive */
@media (max-width: 480px) {
    .app-content {
        padding: 1.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .upload-label {
        padding: 2rem 1rem;
    }
}
