/* Base styles */
.atc-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    padding: 30px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.atc-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 25px;
    border-bottom: 2px solid #e9ecef;
}

.atc-header h2 {
    color: #2c3e50;
    font-size: 32px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.atc-subtitle {
    color: #6c757d;
    font-size: 16px;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

.atc-icon {
    font-size: 1.2em;
}

/* Upload Section */
.atc-upload-section {
    margin-bottom: 40px;
}

.atc-upload-area {
    border: 3px dashed #ced4da;
    border-radius: 12px;
    padding: 50px 30px;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.upload-icon {
    font-size: 60px;
    margin-bottom: 20px;
    opacity: 0.7;
}

.atc-upload-area h3 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 24px;
}

.upload-info {
    color: #6c757d;
    margin-bottom: 25px;
    font-size: 15px;
}

.atc-upload-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.atc-upload-btn:hover {
    background: #005a87;
    transform: translateY(-2px);
}

/* Image Previews */
.image-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
}

.atc-image-thumbnail {
    width: 150px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    position: relative;
    transition: transform 0.3s ease;
}

.atc-image-thumbnail:hover {
    transform: translateY(-5px);
    border-color: #0073aa;
}

.atc-image-thumbnail img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.atc-image-info {
    padding: 10px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.atc-image-name {
    display: block;
    font-size: 12px;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.atc-image-size {
    display: block;
    font-size: 11px;
    color: #6c757d;
    margin-top: 2px;
}

.atc-remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    cursor: pointer;
    line-height: 24px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.atc-remove-image:hover {
    opacity: 1;
}

/* Options Section */
.atc-options-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
    border-left: 4px solid #0073aa;
}

.atc-options-section h3 {
    color: #495057;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
}

.atc-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.atc-option-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.atc-option-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
}

.option-icon {
    font-size: 18px;
}

#atc_custom_instruction {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    border: 2px solid #ced4da;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.3s ease;
}

#atc_custom_instruction:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.option-hint {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

.atc-select {
    padding: 12px 15px;
    border: 2px solid #ced4da;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.atc-select:focus {
    border-color: #0073aa;
    outline: none;
}

/* Action Buttons */
.atc-action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.atc-convert-btn, .atc-clear-btn {
    padding: 16px 32px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    justify-content: center;
}

.atc-convert-btn {
    background: #28a745;
    color: white;
}

.atc-convert-btn:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.3);
}

.atc-convert-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.atc-clear-btn {
    background: #dc3545;
    color: white;
}

.atc-clear-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 18px;
}

/* Progress Section */
.atc-progress-section {
    margin-bottom: 30px;
}

.atc-progress-bar {
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.atc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa, #17a2b8);
    border-radius: 5px;
    width: 0%;
    transition: width 0.5s ease;
}

.atc-progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #495057;
}

/* Error Display */
.atc-error-display {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.error-icon {
    font-size: 20px;
    margin-right: 10px;
}

.atc-error-close {
    background: none;
    border: none;
    color: #721c24;
    font-size: 24px;
    cursor: pointer;
    line-height: 20px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.atc-error-close:hover {
    color: #491217;
}

/* Results Section */
.atc-results-section {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 30px;
}

.atc-results-header {
    background: #f8f9fa;
    padding: 20px 25px;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.atc-results-header h3 {
    color: #495057;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
}

.atc-results-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.atc-edit-btn, .atc-copy-btn, .atc-download-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.atc-edit-btn {
    background: #6f42c1;
    color: white;
}

.atc-edit-btn:hover {
    background: #59359d;
}

.atc-copy-btn {
    background: #0073aa;
    color: white;
}

.atc-copy-btn:hover {
    background: #005a87;
}

.atc-download-btn {
    background: #28a745;
    color: white;
}

.atc-download-btn:hover {
    background: #218838;
}

/* Text Container */
.atc-text-container {
    padding: 25px;
}

.atc-text-editor {
    position: relative;
}

#atc_output_text {
    width: 100%;
    min-height: 400px;
    padding: 20px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.3s ease;
}

#atc_output_text:focus {
    border-color: #0073aa;
    outline: none;
}

#atc_output_text[readonly] {
    background: #f8f9fa;
    cursor: default;
}

.atc-text-info {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 13px;
    color: #6c757d;
}

.atc-edit-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: flex-end;
}

.atc-save-btn, .atc-cancel-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.atc-save-btn {
    background: #28a745;
    color: white;
}

.atc-save-btn:hover {
    background: #218838;
}

.atc-cancel-btn {
    background: #6c757d;
    color: white;
}

.atc-cancel-btn:hover {
    background: #545b62;
}

/* Images Section */
.atc-images-section {
    margin-top: 40px;
    padding-top: 25px;
    border-top: 2px solid #e9ecef;
}

.atc-images-section h4 {
    color: #495057;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}

.atc-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.atc-grid-image {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.atc-grid-image img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.atc-grid-caption {
    padding: 10px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    font-size: 12px;
    color: #495057;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive Design */
@media (max-width: 768px) {
    .atc-wrapper {
        padding: 20px;
    }
    
    .atc-header h2 {
        font-size: 24px;
        flex-direction: column;
        gap: 10px;
    }
    
    .atc-options-grid {
        grid-template-columns: 1fr;
    }
    
    .atc-action-buttons {
        flex-direction: column;
    }
    
    .atc-convert-btn, .atc-clear-btn {
        width: 100%;
    }
    
    .atc-results-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .atc-results-actions {
        justify-content: center;
    }
    
    .atc-images-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}