/* Preview Grid */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Preview Cards */
.preview-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 10px;
    position: relative;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Text Position Styles */
.preview-card[data-text-position="above-image"] .text-overlay {
    position: static;
    order: -1;
    margin-bottom: 0;
    background: none;
}

.preview-card[data-text-position="below-image"] .text-overlay {
    position: static;
    order: 1;
    margin-top: 0;
    background: none;
}

.preview-card:hover {
    transform: translateY(-2px);
}

.preview-card canvas {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
}

/* Text Preview */
.text-preview {
    background: rgba(255,255,255,0.9);
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
}

.text-count {
    color: #2196F3;
    font-weight: bold;
    margin-bottom: 5px;
}

.text-sample {
    color: #666;
    font-size: 0.9em;
    max-height: 150px;
    overflow-y: auto;
}

.text-line {
    display: flex;
    align-items: center;
    padding: 2px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 4px;
}

.text-line-number {
    min-width: 24px;
    height: 24px;
    background: #2196F3;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    margin-right: 8px;
}

.text-line-content {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Image Preview */
.image-preview {
    position: relative;
    margin: 10px;
    display: inline-block;
}

.image-number {
    position: absolute;
    top: -8px;
    left: -8px;
    width: 24px;
    height: 24px;
    background: #2196F3;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    z-index: 1;
}

.image-preview img {
    max-width: 100px;
    max-height: 100px;
    border-radius: 4px;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.image-preview:hover img {
    border-color: #2196F3;
}

/* Delete Button */
.delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ff4444;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s;
}

.image-preview:hover .delete-btn {
    opacity: 1;
    transform: scale(1);
}

/* Progress Indicators */
.progress-container {
    margin-top: 10px;
    display: none;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-bar div {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #2196F3;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

/* Upload States */
.dropzone.dragover {
    transform: scale(1.02);
}

.dropzone.uploading {
    pointer-events: none;
    opacity: 0.7;
}

.dropzone.error {
    border-color: #ff4444;
    background: #fff5f5;
}

/* Loading State */
.dropzone-loading {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    align-items: center;
    justify-content: center;
}

.dropzone.uploading .dropzone-loading {
    display: flex;
}

/* Preview Controls */
.preview-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.preview-controls .control-group {
    margin-bottom: 0;
    min-width: 200px;
}

/* Preview Download Button */
.preview-download-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.preview-download-btn:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
}

.preview-download-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}

/* Generate Button */
.generate-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.generate-btn:hover:not(:disabled) {
    background: #1976D2;
    transform: translateY(-1px);
}

.generate-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}
