* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    padding-top: 60px; /* Space for auth header */
}

/* Auth Header */
.auth-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 20px;
}

.credits-display {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.credits-display i {
    color: #ffd700;
}

.auth-buttons {
    display: flex;
    gap: 10px;
}

.user-menu .dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-menu .dropdown-menu {
    margin-top: 10px;
}

.main-container {
    max-width: 900px;
    margin: 30px auto;
    padding: 40px;
    border-radius: 20px;
    background: white;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.app-header {
    text-align: center;
    margin-bottom: 30px;
}

.app-header h1 {
    color: #333;
    font-size: 2rem;
    margin-bottom: 10px;
}

.app-header p {
    color: #6c757d;
    font-size: 1rem;
}

/* View States */
.view {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Upload Button Style */
.upload-button-container {
    text-align: center;
    margin-bottom: 30px;
}

.upload-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.upload-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.upload-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.upload-button i {
    font-size: 24px;
}

.upload-hint {
    color: #6c757d;
    font-size: 14px;
    margin-top: 10px;
}

/* Enhanced Preview Container */
.preview-wrapper {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 2px dashed #dee2e6;
    transition: all 0.3s ease;
}

.preview-wrapper.has-image {
    border: none;
    background: linear-gradient(145deg, #f0f0f0, #ffffff);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

.preview-wrapper.dragover {
    border-color: #667eea;
    background: #f0f3ff;
}

.preview-placeholder {
    text-align: center;
    color: #adb5bd;
}

.preview-placeholder i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #dee2e6;
}

.preview-container {
    width: 100%;
    display: none;
}

.preview-container.active {
    display: block;
}

.preview-image-wrapper {
    text-align: center;
    margin-bottom: 20px;
}

.preview-image {
    max-width: 100%;
    max-height: 450px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    object-fit: contain;
}

.file-info {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Upload Progress Overlay */
.upload-progress-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    z-index: 10;
}

.upload-progress-overlay.active {
    display: flex;
}

.upload-progress-content {
    text-align: center;
    padding: 20px;
    width: 80%;
}

.upload-progress-content .progress {
    height: 8px;
    border-radius: 4px;
    margin-top: 15px;
}

/* Processing View */
.processing-view {
    text-align: center;
    padding: 40px 0;
}

.stage-indicator {
    display: flex;
    justify-content: space-between;
    margin: 40px 0;
    position: relative;
}

.stage-indicator::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 40px;
    right: 40px;
    height: 2px;
    background: #e9ecef;
    z-index: 1;
}

.stage {
    text-align: center;
    flex: 1;
    position: relative;
    z-index: 2;
}

.stage-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 18px;
    color: #6c757d;
    transition: all 0.3s ease;
}

.stage.active .stage-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: scale(1.2);
}

.stage.completed .stage-icon {
    background: #28a745;
    color: white;
}

.progress-circle {
    width: 120px;
    height: 120px;
    margin: 30px auto;
}

.status-text {
    font-size: 18px;
    font-weight: 500;
    color: #333;
    margin: 20px 0;
}

/* Cancel button style for processing view */
.processing-cancel-btn {
    margin-top: 30px;
    background: #dc3545;
    border: none;
    color: white;
    padding: 10px 30px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.processing-cancel-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.3);
}

.processing-cancel-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Result View Styles */
.result-view {
    text-align: center;
}

.result-content {
    margin: 30px 0;
}

/* Large video section */
.video-section {
    margin-bottom: 30px;
}

.video-section h5 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.25rem;
}

.large-video-container {
    position: relative;
    padding-bottom: 120.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 15px;
    background: #000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    max-width: 100%;
    margin: 0 auto;
}

.large-video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Small image section */
.image-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.image-section h5 {
    margin-bottom: 15px;
    color: #6c757d;
    font-size: 1rem;
}

.small-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.result-image-small {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.result-image-small:hover {
    transform: scale(1.05);
}

/* Modal for full-size image preview */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    cursor: pointer;
}

.image-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.image-modal-close:hover {
    color: #bbb;
}

/* URL Expiry Warning */
.expiry-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 12px;
    margin-top: 15px;
    font-size: 14px;
}

.expiry-warning i {
    margin-right: 5px;
}

/* Common Elements */
.action-buttons {
    margin-top: 25px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-primary-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/*.btn-primary-gradient:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}*/

.btn-primary-gradient:disabled {
    background: #6c757d;
    transform: none;
    cursor: not-allowed;
}

.status-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    display: none;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.spinner {
    display: inline-block;
    width: 80px;
    height: 80px;
    margin: 20px;
}

.spinner:after {
    content: " ";
    display: block;
    width: 64px;
    height: 64px;
    margin: 8px;
    border-radius: 50%;
    border: 6px solid #667eea;
    border-color: #667eea transparent #667eea transparent;
    animation: spinner 1.2s linear infinite;
}

@keyframes spinner {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Recharge Modal Styles */
.recharge-packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.package-card {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.package-card:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.2);
}

.package-ribbon {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #28a745;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.package-header h4 {
    color: #333;
    margin-bottom: 10px;
}

.package-price {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
    margin: 10px 0;
}

.package-credits {
    font-size: 1.2rem;
    color: #333;
    margin: 10px 0;
}

.package-credits i {
    color: #ffd700;
}

.package-info {
    color: #6c757d;
    font-size: 0.9rem;
}

.payment-info {
    text-align: center;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-container {
        margin: 20px;
        padding: 20px;
    }
    
    .auth-container {
        padding: 0 10px;
    }
    
    .credits-display {
        font-size: 14px;
        padding: 6px 12px;
    }
    
    .stage-indicator {
        flex-wrap: wrap;
    }
    
    .recharge-packages {
        grid-template-columns: 1fr;
    }
}
.refresh-image-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 5;
    transition: all 0.3s ease;
}

.refresh-image-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.refresh-image-btn i {
    font-size: 20px;
    color: #667eea;
}

.preview-image-wrapper {
    position: relative;
    text-align: center;
    margin-bottom: 20px;
}

.upload-button-container {
    text-align: center;
    margin-bottom: 30px;
}

.upload-buttons-wrapper {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.upload-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
    min-width: 200px;
    justify-content: center;
}

.random-image-button {
    background: linear-gradient(135deg, #20c997 0%, #0f8a6d 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(32, 201, 151, 0.3);
    min-width: 200px;
    justify-content: center;
}

.upload-button:hover:not(:disabled),
.random-image-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.random-image-button:hover:not(:disabled) {
    box-shadow: 0 8px 25px rgba(32, 201, 151, 0.4);
}

.upload-button:disabled,
.random-image-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.upload-button i,
.random-image-button i {
    font-size: 24px;
}

.upload-hint {
    color: #6c757d;
    font-size: 14px;
    margin-top: 10px;
}

@media (max-width: 768px) {
    .upload-buttons-wrapper {
        flex-direction: column;
        align-items: center;
    }
    
    .upload-button,
    .random-image-button {
        width: 100%;
        max-width: 300px;
    }
}
.prompt-input-container {
    width: 100%;
    margin-bottom: 15px;
}

.prompt-input-container .form-label {
    text-align: left;
    font-weight: 500;
    color: #495057;
    margin-bottom: 5px;
}

.prompt-input-container .form-control {
    border-radius: 8px;
    border: 1px solid #ced4da;
    padding: 10px 15px;
    font-size: 16px;
}

.prompt-input-container .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.prompt-input-container .form-text {
    text-align: left;
    color: #6c757d;
    font-size: 12px;
    margin-top: 5px;
}
#paymentFrameContainer {
    min-height: 500px;
}

#paymentFrame {
    width: 100%;
    height: 500px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

/* 确保模态框足够大以容纳支付页面 */
.modal-dialog {
    max-width: 800px;
}

@media (max-width: 768px) {
    .modal-dialog {
        max-width: 95%;
        margin: 10px auto;
    }
    
    #paymentFrame {
        height: 400px;
    }
}