/* Wavespeed AI Modern Frontend Styles */

/* Reset and Base Styles */
.wavespeed-ai-container,
.wavespeed-ai-buy-credits-container,
.wavespeed-ai-credits-widget {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    max-width: 100%;
}

.wavespeed-ai-container *,
.wavespeed-ai-buy-credits-container *,
.wavespeed-ai-credits-widget * {
    box-sizing: border-box;
}

/* Container Layouts */
.wavespeed-ai-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 0 20px;
}

.wavespeed-ai-buy-credits-container {
    max-width: 600px;
    margin: 20px auto;
    padding: 0 20px;
}

/* Modern Credits Display */
.wavespeed-ai-credits {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    color: white;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.wavespeed-ai-credits::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>') repeat;
    opacity: 0.3;
    pointer-events: none;
}

.wavespeed-ai-credits * {
    position: relative;
    z-index: 1;
}

.credits-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.credits-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.low-credits-warning {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 193, 7, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.credits-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.credits-balance,
.credits-cost {
    text-align: center;
}

.credits-number,
.cost-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.credits-label,
.cost-label {
    display: block;
    font-size: 0.875rem;
    opacity: 0.9;
    font-weight: 400;
}

.credits-action {
    text-align: center;
}

.buy-credits-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.buy-credits-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    color: white;
    text-decoration: none;
}

/* Modern Form Styling */
.wavespeed-ai-form {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.wavespeed-ai-form h3 {
    margin: 0 0 24px 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    text-align: center;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group label .required {
    color: #ef4444;
    font-weight: bold;
    margin-left: 4px;
}

/* Modern Input Styling */
.form-group select,
.form-group input[type="number"],
.form-group input[type="url"],
.form-group textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f9fafb;
    font-family: inherit;
}

.form-group select:focus,
.form-group input[type="number"]:focus,
.form-group input[type="url"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* File Upload Styling */
.form-group input[type="file"] {
    width: 100%;
    padding: 20px;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    background: #f9fafb;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 1rem;
    text-align: center;
}

.form-group input[type="file"]:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.form-group input[type="file"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.file-preview {
    margin-top: 12px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    min-height: 20px;
}

.file-preview:empty {
    display: none;
}

.file-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    margin-top: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.audio-info {
    font-size: 0.875rem;
    color: #6b7280;
    padding: 8px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.form-group small {
    display: block;
    margin-top: 8px;
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Modern Button Styling */
.wavespeed-ai-submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.wavespeed-ai-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.wavespeed-ai-submit-btn:hover::before {
    left: 100%;
}

.wavespeed-ai-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.wavespeed-ai-submit-btn:active {
    transform: translateY(0);
}

.wavespeed-ai-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Results Section */
#wavespeed-ai-frontend-result {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-top: 24px;
}

#wavespeed-ai-frontend-result h4 {
    margin: 0 0 16px 0;
    color: #374151;
    font-weight: 600;
}

#frontend-status-container p {
    margin: 0;
    padding: 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.5;
}

#frontend-status-container p.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

#frontend-status-container p.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Error Messages */
.wavespeed-ai-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 16px;
    border-radius: 12px;
    margin: 20px 0;
    text-align: center;
    font-weight: 500;
}

/* Buy Credits Section */
.wavespeed-ai-credits-balance {
    margin-bottom: 32px;
}

.balance-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
}

.balance-icon svg {
    width: 32px;
    height: 32px;
    opacity: 0.9;
}

.balance-info {
    flex: 1;
}

.balance-label {
    display: block;
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 4px;
}

.balance-amount {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.wavespeed-ai-packages h3 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #374151;
}

.package-description {
    color: #6b7280;
    margin-bottom: 24px;
    font-size: 1rem;
}

.location-detection {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    text-align: center;
}

#location-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #6b7280;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.location-info {
    color: #059669;
    font-weight: 500;
}

.package-card {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 0;
    margin-bottom: 24px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
}

.package-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.2);
}

.package-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 24px;
    position: relative;
}

.package-header h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.package-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.package-content {
    padding: 24px;
}

.credits-amount {
    text-align: center;
    margin-bottom: 20px;
}

.credits-number {
    display: block;
    font-size: 3rem;
    font-weight: 700;
    color: #667eea;
    line-height: 1;
    margin-bottom: 4px;
}

.credits-label {
    font-size: 1rem;
    color: #6b7280;
    font-weight: 500;
}

.package-price {
    text-align: center;
    margin-bottom: 24px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
}

.price-amount {
    font-size: 2rem;
    font-weight: 700;
    color: #374151;
    margin-right: 8px;
}

.price-currency {
    font-size: 1rem;
    color: #6b7280;
    font-weight: 500;
}

.package-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
}

.package-features li {
    padding: 8px 0;
    color: #374151;
    font-size: 0.875rem;
    line-height: 1.5;
}

.buy-credits-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.buy-credits-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.buy-credits-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.custom-package {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.custom-package h4 {
    margin: 0 0 8px 0;
    color: #374151;
    font-weight: 600;
}

.custom-package p {
    margin: 0 0 16px 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.contact-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.contact-link:hover {
    border-bottom-color: #667eea;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wavespeed-ai-container,
    .wavespeed-ai-buy-credits-container {
        padding: 0 16px;
        margin: 16px auto;
    }
    
    .wavespeed-ai-form {
        padding: 24px 20px;
    }
    
    .credits-info {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .credits-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .balance-card {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .credits-number,
    .cost-number {
        font-size: 1.75rem;
    }
    
    .wavespeed-ai-form h3 {
        font-size: 1.25rem;
    }
    
    .form-group input[type="file"] {
        padding: 16px;
    }
    
    .package-content {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .wavespeed-ai-container,
    .wavespeed-ai-buy-credits-container {
        padding: 0 12px;
        margin: 12px auto;
    }
    
    .wavespeed-ai-credits {
        padding: 20px 16px;
    }
    
    .wavespeed-ai-form {
        padding: 20px 16px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .credits-number,
    .cost-number {
        font-size: 1.5rem;
    }
    
    .price-amount {
        font-size: 1.75rem;
    }
    
    .credits-amount .credits-number {
        font-size: 2.5rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .wavespeed-ai-form {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .wavespeed-ai-form h3 {
        color: #f9fafb;
    }
    
    .form-group label {
        color: #d1d5db;
    }
    
    .form-group select,
    .form-group input[type="number"],
    .form-group input[type="url"],
    .form-group textarea {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .form-group input[type="file"] {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .file-preview {
        background: #374151;
        border-color: #4b5563;
    }
    
    .audio-info {
        background: #4b5563;
        border-color: #6b7280;
        color: #d1d5db;
    }
    
    .package-card {
        background: #1f2937;
        border-color: #374151;
    }
    
    .custom-package {
        background: #374151;
        border-color: #4b5563;
    }
    
    .location-detection {
        background: #374151;
        border-color: #4b5563;
    }
}

/* Accessibility improvements */
.wavespeed-ai-submit-btn:focus,
.buy-credits-btn:focus,
.buy-credits-link:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .wavespeed-ai-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .buy-credits-btn,
    .buy-credits-link {
        display: none;
    }
}

/* Notification System */
.wavespeed-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-content {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
}

.notification-message {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    opacity: 1;
}

.wavespeed-notification.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.wavespeed-notification.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.wavespeed-notification.warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.wavespeed-notification.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Tooltip */
.wavespeed-tooltip {
    position: absolute;
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    z-index: 10001;
    pointer-events: none;
    max-width: 200px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wavespeed-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border: 5px solid;
    border-color: #1f2937 transparent transparent transparent;
}

/* Result Card */
.result-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.result-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 16px 20px;
}

.result-header h4 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.result-content {
    padding: 20px;
}

.result-content p {
    margin: 0 0 16px 0;
    color: #6b7280;
    line-height: 1.5;
}

.result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.result-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.result-button.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.result-button.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    color: white;
    text-decoration: none;
}

.result-button.secondary {
    background: #f8fafc;
    color: #374151;
    border: 1px solid #e2e8f0;
}

.result-button.secondary:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.result-button svg {
    width: 16px;
    height: 16px;
}

/* Credits Upsell */
.credits-upsell {
    margin-top: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.credits-upsell p {
    margin: 0 0 12px 0;
    font-size: 0.875rem;
    opacity: 0.9;
}

.buy-credits-inline-btn {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.buy-credits-inline-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    text-decoration: none;
}

/* Drag and Drop States */
.form-group input[type="file"].drag-over {
    border-color: #667eea;
    background: #f0f4ff;
    border-style: solid;
}

/* Loading States */
.btn-loader {
    display: inline-block;
    opacity: 0.8;
}

/* File Info */
.file-info {
    margin-top: 8px;
    font-size: 0.75rem;
    color: #6b7280;
    background: #f8fafc;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

/* Responsive adjustments for notifications */
@media (max-width: 480px) {
    .wavespeed-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .result-button {
        justify-content: center;
    }
}