/* Reset default styles for consistency */
.wpitc-wrapper * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Main wrapper with gradient background */
.wpitc-wrapper {
    min-height: 100vh !important;
    background: linear-gradient(135deg, #e0e7ff 0%, #d1d5db 100%) !important;
    background-color: #e0e7ff !important; /* Fallback */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
    color: #1e293b !important; /* Gray-800 */
    overflow-x: hidden !important;
}

/* Main section */
.wpitc-wrapper .wpitc-main {
    padding: 2rem 1rem !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

.wpitc-wrapper .wpitc-main .text-center h2 {
    font-size: 2rem !important;
    font-weight: 900 !important;
    line-height: 1.2 !important;
    margin-bottom: 1rem !important;
    color: #1e293b !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.wpitc-wrapper .wpitc-main .text-center p {
    font-size: 1rem !important;
    color: #64748b !important; /* Gray-600 */
    line-height: 1.5 !important;
    max-width: 20rem !important;
    text-align: center !important;
}

/* Converter card with glassmorphism */
.wpitc-wrapper .bg-white.rounded-2xl {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(209, 213, 219, 0.3) !important; /* Gray-300 */
    border-radius: 1.5rem !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1) !important;
    padding: 1.5rem !important;
    width: 100% !important;
    max-width: 48rem !important;
    margin: 0 auto !important;
    transition: box-shadow 0.3s ease, transform 0.3s ease !important;
}

.wpitc-wrapper .bg-white.rounded-2xl:hover {
    box-shadow: 0 25px 50px rgba(79, 70, 229, 0.2) !important;
    transform: translateY(-5px) !important;
}

/* Grid layout for converter */
.wpitc-wrapper .grid {
    display: grid !important;
    gap: 1.5rem !important;
    grid-template-columns: 1fr !important;
}

@media (min-width: 640px) {
    .wpitc-wrapper .grid {
        grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)) !important;
    }
}

/* Upload section */
.wpitc-wrapper .space-y-6 {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
}

.wpitc-wrapper h3 {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

/* Language selector with corrected positioning */
.wpitc-language-selector {
    position: relative !important;
}

.wpitc-language-selector button#wpitc-languageBtn {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: #64748b !important;
    background: #ffffff !important;
    border: 1px solid #e0e7ff !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.375rem !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05) !important;
}

.wpitc-language-selector button#wpitc-languageBtn:hover {
    background: #f1f5f9 !important;
    color: #4f46e5 !important;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.1) !important;
}

.wpitc-language-selector .wpitc-language-dropdown {
    position: absolute !important;
    right: 0 !important;
    top: 100% !important;
    margin-top: 0.25rem !important;
    width: 10rem !important;
    background: #ffffff !important;
    border-radius: 0.375rem !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
    z-index: 15 !important;
    transform-origin: top right !important;
    animation: slideDown 0.3s ease-out !important;
}

.wpitc-language-selector .wpitc-language-dropdown a {
    display: block !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.875rem !important;
    color: #374151 !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
}

.wpitc-language-selector .wpitc-language-dropdown a:hover {
    background: #f1f5f9 !important;
    color: #4f46e5 !important;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: scaleY(0);
    }
    to {
        opacity: 1;
        transform: scaleY(1);
    }
}

/* Dropzone with pulsing animation */
.wpitc-dropzone {
    border: 2px dashed #93c5fd !important;
    border-radius: 0.75rem !important;
    transition: all 0.3s ease !important;
    background: #ffffff !important;
    padding: 1.5rem !important;
    text-align: center !important;
    cursor: pointer !important;
    position: relative !important;
}

.wpitc-dropzone.active {
    border-color: #3b82f6 !important;
    background: rgba(235, 246, 255, 0.8) !important;
    animation: pulse 1.5s infinite !important;
}

.wpitc-dropzone:hover {
    transform: scale(1.02) !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1) !important;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.wpitc-dropzone p {
    color: #64748b !important;
    margin-bottom: 0.5rem !important;
    font-size: 1rem !important;
}

.wpitc-dropzone p.text-sm {
    font-size: 0.75rem !important;
    color: #9ca3af !important;
}

/* Upload icon fallback */
#wpitc-upload-icon,
.wpitc-icon-fallback {
    display: inline-block !important;
    margin-bottom: 1rem !important;
    color: #4f46e5 !important;
    min-width: 1.5rem !important;
    text-align: center !important;
}

.wpitc-dropzone:hover #wpitc-upload-icon {
    transform: scale(1.1) !important;
}

/* Progress bar */
.wpitc-progress-bar {
    transition: width 0.3s ease !important;
    background: linear-gradient(90deg, #4f46e5, #7c3aed) !important;
    border-radius: 9999px !important;
    height: 0.5rem !important;
}

.wpitc-wrapper #wpitc-uploadProgress .bg-gray-200 {
    background: #e0e7ff !important;
    border-radius: 9999px !important;
    height: 0.5rem !important;
    overflow: hidden !important;
}

.wpitc-wrapper #wpitc-uploadProgress .flex {
    display: flex !important;
    justify-content: space-between !important;
    margin-bottom: 0.5rem !important;
}

.wpitc-wrapper #wpitc-uploadProgress .text-sm {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: #4f46e5 !important;
}

.wpitc-wrapper #wpitc-previewImage {
    max-height: 12rem !important;
    margin: 0 auto 1rem !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
    transition: transform 0.3s ease !important;
}

.wpitc-wrapper #wpitc-previewImage:hover {
    transform: scale(1.02) !important;
}

/* Buttons with glow effect */
.wpitc-button {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.625rem 1.25rem !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    border-radius: 0.5rem !important;
    transition: all 0.3s ease !important;
    border: 2px solid transparent !important;
    cursor: pointer !important;
    position: relative !important;
    overflow: hidden !important;
}

.wpitc-button::after {
    content: '' !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    background: rgba(79, 70, 229, 0.2) !important;
    border-radius: 50% !important;
    transition: width 0.6s ease, height 0.6s ease !important;
    z-index: 0 !important;
}

.wpitc-button:hover::after {
    width: 200% !important;
    height: 200% !important;
}

.wpitc-button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2) !important;
}

.wpitc-button:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.wpitc-button.bg-indigo-600 {
    background: linear-gradient(90deg, #4f46e5, #7c3aed) !important;
    color: #ffffff !important;
    z-index: 1 !important;
}

.wpitc-button.bg-indigo-600:hover {
    background: linear-gradient(90deg, #4338ca, #6d28d9) !important;
}

.wpitc-button.bg-gray-200 {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    border: 2px solid #e0e7ff !important;
}

.wpitc-button.bg-gray-200:hover {
    background: #dbeafe !important;
    border-color: #bfdbfe !important;
}

.wpitc-button.bg-green-100 {
    background: #dcfce7 !important;
    color: #166534 !important;
    border: 2px solid #bbf7d0 !important;
}

.wpitc-button.bg-green-100:hover {
    background: #bbf7d0 !important;
    border-color: #86efac !important;
}

/* Loading state for extract button */
.wpitc-button.loading::after {
    background: rgba(255, 255, 255, 0.3) !important;
    animation: spin 1s linear infinite !important;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Action buttons (copy, download, speak) */
.wpitc-wrapper .flex.space-x-2 button {
    padding: 0.5rem !important;
    background: #f1f5f9 !important;
    border-radius: 0.5rem !important;
    transition: all 0.3s ease !important;
    border: 1px solid #e0e7ff !important;
}

.wpitc-wrapper .flex.space-x-2 button:hover {
    background: #dbeafe !important;
    color: #4f46e5 !important;
    transform: scale(1.1) !important;
    box-shadow: 0 0 8px rgba(79, 70, 229, 0.2) !important;
}

.wpitc-wrapper .flex.space-x-2 button:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.4) !important;
}

/* Textarea with placeholder animation */
#wpitc-resultText {
    min-height: 180px !important;
    white-space: pre-wrap !important;
    border-radius: 0.5rem !important;
    transition: all 0.3s ease !important;
    border: 1px solid #d1d5db !important;
    padding: 1rem !important;
    font-size: 0.875rem !important;
    color: #1e293b !important;
    background: #f9fafb !important;
    resize: vertical !important;
    position: relative !important;
}

#wpitc-resultText:focus {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3) !important;
    border-color: #4f46e5 !important;
}

#wpitc-resultText::placeholder {
    color: #9ca3af !important;
    transition: opacity 0.3s ease !important;
}

#wpitc-resultText:focus::placeholder {
    opacity: 0 !important;
}

#wpitc-charCount {
    font-size: 0.625rem !important;
    color: #9ca3af !important;
    position: absolute !important;
    bottom: 0.5rem !important;
    right: 0.75rem !important;
    background: rgba(249, 250, 251, 0.8) !important;
    padding: 0.125rem 0.25rem !important;
    border-radius: 0.25rem !important;
}

/* Toast notifications with progress bar */
.wpitc-wrapper .fixed.bottom-4.right-4 {
    z-index: 50 !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    border-radius: 0.5rem !important;
    padding: 0.625rem 1rem !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
    animation: fadeInOut 3s ease-out forwards !important;
    position: relative !important;
}

.wpitc-wrapper .fixed.bottom-4.right-4::after {
    content: '' !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    height: 3px !important;
    background: rgba(255, 255, 255, 0.3) !important;
    animation: progress 2.7s linear forwards !important;
    border-radius: 0 0 0.5rem 0.5rem !important;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(20px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(20px); }
}

@keyframes progress {
    from { width: 0; }
    to { width: 100%; }
}

.wpitc-wrapper .bg-green-500 {
    background: #22c55e !important;
    color: #ffffff !important;
}

.wpitc-wrapper .bg-red-500 {
    background: #ef4444 !important;
    color: #ffffff !important;
}

.wpitc-wrapper .bg-blue-500 {
    background: #3b82f6 !important;
    color: #ffffff !important;
}

/* Loading overlay */
.wpitc-wrapper #wpitc-loading-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 100 !important;
    display: none !important;
    justify-content: center !important;
    align-items: center !important;
}

.wpitc-wrapper #wpitc-loading-overlay.active {
    display: flex !important;
}

.wpitc-wrapper #wpitc-loading-overlay .spinner {
    width: 2.5rem !important;
    height: 2.5rem !important;
    border: 3px solid #f3f4f6 !important;
    border-top: 3px solid #4f46e5 !important;
    border-radius: 50% !important;
    animation: spin 1s linear infinite !important;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .wpitc-wrapper .wpitc-main {
        padding: 3rem 2rem !important;
    }

    .wpitc-wrapper .wpitc-main .text-center h2 {
        font-size: 2.5rem !important;
    }

    .wpitc-wrapper .wpitc-main .text-center p {
        font-size: 1.125rem !important;
        max-width: 24rem !important;
    }

    .wpitc-wrapper .bg-white.rounded-2xl {
        padding: 2rem !important;
    }

    .wpitc-dropzone {
        padding: 2rem !important;
    }

    .wpitc-button {
        padding: 0.75rem 1.5rem !important;
        font-size: 1rem !important;
    }

    #wpitc-resultText {
        min-height: 200px !important;
        font-size: 1rem !important;
    }

    #wpitc-charCount {
        font-size: 0.75rem !important;
    }
}

@media (min-width: 1024px) {
    .wpitc-wrapper .grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .wpitc-wrapper .wpitc-main .text-center h2 {
        font-size: 3rem !important;
    }

    .wpitc-wrapper .wpitc-main .text-center p {
        max-width: 30rem !important;
    }

    .wpitc-wrapper .bg-white.rounded-2xl {
        padding: 2.5rem !important;
        max-width: 60rem !important;
    }

    .wpitc-dropzone {
        padding: 2.5rem !important;
    }

    .wpitc-button {
        padding: 0.875rem 1.75rem !important;
        font-size: 1.125rem !important;
    }

    #wpitc-resultText {
        min-height: 220px !important;
    }

    #wpitc-charCount {
        bottom: 0.75rem !important;
        right: 1rem !important;
    }
}

/* General animations */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}