/**
 * JCOGS Image Pro - Preset Edit Styles
 * ====================================
 * CSS styles for enhanced preset editing interface with live preview functionality
 * 
 * @category   ExpressionEngine Add-on
 * @package    JCOGS Image Pro
 * @author     JCOGS Design <contact@jcogs.net>
 * @copyright  Copyright (c) 2021 - 2025 JCOGS Design
 * @license    https://jcogs.net/add-ons/license/jcogs_img_pro
 * @version    2.0.6
 * @link       https://JCOGS.net/
 * @since      Enhanced Preset Editor Implementation
 */

/* Enhanced Preset Editor Styles */
.enhanced-preset-editor {
    max-width: 1400px;
    margin: 0 auto;
}

.preset-header {
    background: #fff;
    border: 1px solid #e1e7ed;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.preset-title h2 {
    margin: 0 0 0.5rem 0;
    color: #384551;
    font-weight: 600;
}

/* Inline Description Editor */
.preset-description-row {
    margin-bottom: 1.5rem;
}

.preset-description-editor {
    width: 100%;
}

.inline-description-form {
    width: 100%;
}

.description-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.description-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e1e7ed;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #5d6975;
    resize: vertical;
    min-height: 2.5rem;
    font-family: inherit;
    box-sizing: border-box;
}

.description-input:focus {
    outline: none;
    border-color: #1f7dc4;
    box-shadow: 0 0 0 2px rgba(31, 125, 196, 0.1);
}

.description-actions {
    align-self: flex-end;
}

/* Feature Badge */
.feature-badge {
    display: inline-block;
    background: #ffd700;
    color: #856404;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

/* Preview Placeholder Styles */
.preview-placeholder {
    text-align: center;
    color: #8892a4;
    padding: 3rem 2rem;
    max-width: 500px;
    margin: 0 auto;
}

.feature-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    color: #d4dae2;
}

.preview-placeholder h5 {
    margin: 0 0 1rem 0;
    color: #5d6975;
    font-size: 1.25rem;
    font-weight: 600;
}

.preview-placeholder p {
    margin: 0 0 1.5rem 0;
    line-height: 1.5;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.feature-list li {
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.feature-list i {
    color: #28a745;
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

.preset-stats {
    display: flex;
    gap: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f0f2f5;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: #8892a4;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.25rem;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: #384551;
}

/* Content Grid */
.preset-content-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    /* max-width: 1200px; */
    margin: 0 auto;
}

/* Parameter Panel */
.parameters-panel .panel {
    height: fit-content;
    min-height: 400px;
}

.parameter-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.search-box {
    position: relative;
    flex: 1;
}

.search-box input {
    padding-right: 2.5rem;
}

.search-box i {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #8892a4;
}

.filter-controls {
    flex-shrink: 0;
    width: 200px;
}

/* Parameter List */
.parameter-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.parameter-item {
    background: #f7f9fc;
    border: 1px solid #e1e7ed;
    border-radius: 6px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.parameter-item:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.parameter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.parameter-info h5 {
    margin: 0 0 0.25rem 0;
    color: #384551;
    font-weight: 600;
}

.parameter-category {
    display: inline-block;
    background: #e8f4ff;
    color: #1f7dc4;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.parameter-actions {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.parameter-actions .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.2;
    min-width: auto;
}

.parameter-content {
    font-size: 0.875rem;
}

.parameter-value {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.parameter-value-display {
    background: #fff;
    color: #1f7dc4;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8125rem;
    max-width: 300px;
    min-width: 60px;
    min-height: 1.5rem;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.parameter-value-display:empty::before {
    content: "(not set)";
    color: #8892a4;
    font-style: italic;
}

.parameter-description p {
    margin: 0;
    color: #5d6975;
    font-style: italic;
}

/* Quick Edit Form */
.quick-edit-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e1e7ed;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #8892a4;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #d4dae2;
}

.empty-state h5 {
    margin: 0 0 0.5rem 0;
    color: #5d6975;
}

.empty-state p {
    margin: 0 0 1.5rem 0;
}

/* Preview Panel */
.preview-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0; /* Prevents flex item from growing beyond container */
}

.preview-panel .panel {
    height: fit-content;
    min-height: auto;
}

/* Preview Image Styles */
.preview-image-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.preview-image {
    max-width: 100%;
    max-height: 280px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.preview-image-container:hover .preview-overlay {
    opacity: 1;
}

.preview-info p {
    margin: 0;
    font-size: 0.875rem;
}

.preview-info p:first-child {
    font-weight: 600;
}

.preview-actions {
    flex-shrink: 0;
}

/* Hide original table completely - REMOVED: Now properly not generating instead of hiding */

.preview-image-area {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafbfc;
    border: 2px dashed #e1e7ed;
    border-radius: 6px;
}

.preview-controls {
    margin-top: 1rem;
}

.preview-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #5d6975;
}

/* Tool Grid */
.tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.tool-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    background: #f7f9fc;
    border: 1px solid #e1e7ed;
    border-radius: 6px;
    color: #5d6975;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    text-align: center;
}

.tool-button:hover {
    background: #fff;
    border-color: #1f7dc4;
    color: #1f7dc4;
    box-shadow: 0 2px 8px rgba(31, 125, 196, 0.15);
    transform: translateY(-1px);
}

.tool-button i {
    font-size: 1.5rem;
}

.tool-button span {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.tool-button small {
    font-size: 0.75rem;
    color: #8892a4;
    font-weight: normal;
    line-height: 1.2;
}

.tool-button:hover small {
    color: #1f7dc4;
}

/* Modal Styles */
.jip_modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jip_modal-dialog {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.jip_modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e1e7ed;
}

.jip_modal-header h4 {
    margin: 0;
    color: #384551;
}

.jip_modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #8892a4;
    cursor: pointer;
    padding: 0.25rem;
}

.jip_modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.jip_modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid #e1e7ed;
    background: #f7f9fc;
}

/* Section Styles */
.section-divider {
    margin: 2rem 0;
    border: none;
    border-top: 1px solid #e1e7ed;
}

.preset-info-section,
.parameters-section {
    margin-bottom: 1.5rem;
}

.preset-info-section h4,
.parameters-section h4 {
    margin-bottom: 1rem;
    color: #5d6975;
    font-weight: 600;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h4 {
    margin-bottom: 0;
}

.add-parameter-form {
    display: flex;
    align-items: center;
}

.no-parameters {
    text-align: center;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 4px;
    color: #8892a4;
}

.no-parameters p:last-child {
    margin-bottom: 0;
}

.parameter-table-wrapper {
    background: white;
    border-radius: 4px;
    overflow: hidden;
}

/* Live Preview Styles */
.preview-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.preview-section h6 {
    margin: 0.75rem 0 0.75rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #5d6975;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.preview-image-container {
    position: relative;
    background: #f8fafc;
    border: 2px dashed #e1e7ed;
    border-radius: 8px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-image-container img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 4px;
}

.preview-placeholder.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.preview-placeholder i {
    font-size: 2rem;
    color: #c1c9d2;
    margin-bottom: 0.5rem;
}

.preview-placeholder p {
    margin: 0;
    font-size: 0.875rem;
}

.preview-loading {
    text-align: center;
    color: #1f7dc4;
    padding: 2rem 1rem;
}

.preview-loading i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.preview-loading p {
    margin: 0;
    font-size: 0.875rem;
}

.status-indicator {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    background: #e8f4f8;
    color: #1f7dc4;
}

.status-indicator.processing {
    background: #fff3cd;
    color: #856404;
}

.status-indicator.complete {
    background: #d4edda;
    color: #155724;
}

.status-indicator.error {
    background: #f8d7da;
    color: #721c24;
}

.preview-metadata {
    background: #f8fafc;
    border: 1px solid #e1e7ed;
    border-radius: 6px;
    padding: 1.25rem;
    margin-top: 1rem;
}

.preview-summary-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e1e7ed;
}

.preview-summary-header h6 {
    margin: 0.75rem 0 0 0;
    color: #384551;
    font-weight: 600;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-summary-header i {
    color: #007bff;
    font-size: 1rem;
}

.metadata-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.metadata-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.metadata-row:hover {
    background: #f1f3f5;
}

.metadata-label {
    font-size: 0.8125rem;
    color: #6c757d;
    font-weight: 500;
    flex-shrink: 0;
}

.metadata-value {
    font-size: 0.8125rem;
    color: #384551;
    font-weight: 600;
    text-align: right;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metadata-value a {
    color: #007bff;
    text-decoration: none;
    font-size: 0.75rem;
}

.metadata-value a:hover {
    text-decoration: underline;
}

/* Responsive adjustments for metadata */
@media (max-width: 768px) {
    .metadata-grid {
        grid-template-columns: 1fr;
    }
    
    .metadata-value {
        max-width: none;
    }
}

/* Size Warning Message */
.preview-size-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    display: none;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: #856404;
}

.preview-size-warning i {
    color: #f39c12;
    font-size: 0.875rem;
}

.preview-size-warning a {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.preview-size-warning a:hover {
    text-decoration: underline;
}

.preview-size-warning.show {
    display: flex;
}

/* Preview File Management */
.preview-file-form .form-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.preview-file-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.preview-source-info {
    margin-top: 0.5rem;
    text-align: center;
}

.preview-source-info small {
    font-size: 0.75rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .preset-header {
        padding: 1.5rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .preset-stats {
        justify-content: center;
        gap: 1rem;
    }
    
    .parameter-controls {
        flex-direction: column;
    }
    
    .filter-controls {
        width: 100%;
    }
    
    .parameter-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .parameter-actions {
        align-self: stretch;
        justify-content: space-between;
    }
    
    .tool-grid {
        grid-template-columns: 1fr;
    }
    
    .enhanced-preset-editor {
        margin: 0 -1rem;
    }
    
    .preview-comparison {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .preview-image-container {
        min-height: 150px;
    }
}
