/**
 * EZWP Image Manager Styles
 */

/* Modal Base */
.ezwp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.ezwp-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.ezwp-modal-content {
    position: relative;
    background: white;
    margin: 2% auto;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.ezwp-image-manager-content {
    height: 85vh;
}

/* Modal Header */
.ezwp-modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ezwp-modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.ezwp-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    line-height: 32px;
    transition: color 0.2s;
}

.ezwp-modal-close:hover {
    color: #333;
}

/* Modal Body (full height, no footer) */
.ezwp-modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Main Container (Content left, Sidebar right) */
.ezwp-img-main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

/* Left Content Area */
.ezwp-img-left-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    overflow-y: auto;
}

/* Upload Toggle Button */
.ezwp-upload-toggle-container {
    text-align: left;
}

#ezwp-upload-toggle-btn {
    padding: 8px 16px;
    font-size: 14px;
}

/* Upload Section */
.ezwp-img-upload-section {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: #f9f9f9;
}

.ezwp-img-upload-area {
    cursor: pointer;
    transition: all 0.3s;
}

.ezwp-img-upload-area:hover {
    background: #f0f0f0;
    border-color: #007bff;
}

.ezwp-img-upload-area.dragover {
    background: #e3f2fd;
    border-color: #007bff;
}

.ezwp-img-upload-area p {
    margin: 15px 0;
    color: #666;
    font-size: 16px;
}

.ezwp-img-upload-progress {
    margin-top: 15px;
}

.ezwp-img-upload-progress .progress {
    height: 25px;
    margin-bottom: 10px;
}

.ezwp-img-upload-progress .upload-status {
    color: #666;
    margin: 0;
}

/* Toolbar */
.ezwp-img-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 6px;
}

.ezwp-img-view-options {
    display: flex;
    gap: 5px;
}

.ezwp-img-view-options .btn.active {
    background: #007bff;
    color: white;
}

.ezwp-img-search {
    flex: 1;
    min-width: 200px;
}

.ezwp-img-search input {
    width: 100%;
}

.ezwp-img-filter select {
    min-width: 150px;
}

/* Image Grid Container */
.ezwp-img-grid-container {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    min-height: 300px;
}

.ezwp-img-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    padding: 15px;
}

.ezwp-img-grid.list-view {
    grid-template-columns: 1fr;
}

/* Image Item */
.ezwp-img-item {
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.ezwp-img-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.ezwp-img-item.selected {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.ezwp-img-thumbnail {
    width: 100%;
    height: 80px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ezwp-img-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ezwp-img-name {
    padding: 6px;
    font-size: 11px;
    color: #666;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-top: 1px solid #eee;
}

/* List View */
.ezwp-img-grid.list-view .ezwp-img-item {
    display: flex;
    align-items: center;
}

.ezwp-img-grid.list-view .ezwp-img-thumbnail {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.ezwp-img-grid.list-view .ezwp-img-name {
    flex: 1;
    font-size: 13px;
    text-align: left;
    border-top: none;
    border-left: 1px solid #eee;
}

/* Loading/Empty States */
.ezwp-img-loading,
.ezwp-img-empty,
.ezwp-img-error {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    grid-column: 1 / -1;
}

.ezwp-img-loading i {
    font-size: 48px;
    margin-bottom: 15px;
}

/* Image Details Sidebar (Right side, always visible, full height) */
.ezwp-img-details {
    width: 320px;
    flex-shrink: 0;
    background: #f9f9f9;
    border-left: 2px solid #ddd;
    display: none; /* Initially hidden, shown when image selected */
    flex-direction: column;
    overflow: hidden;
}

.ezwp-img-details-header {
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    background: white;
}

.ezwp-img-details-header h4 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.ezwp-img-details-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ezwp-img-preview {
    width: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
}

.ezwp-img-preview img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}

/* Detail items as text */
.ezwp-detail-item {
    margin-bottom: 12px;
    line-height: 1.6;
}

.ezwp-detail-label {
    display: inline-block;
    font-weight: 600;
    color: #555;
    font-size: 13px;
    margin-right: 6px;
}

.ezwp-detail-value {
    color: #333;
    font-size: 13px;
    word-break: break-word;
}

.ezwp-img-actions {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ezwp-img-actions .btn-block {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
}

.ezwp-delete-link {
    display: block;
    text-align: center;
    color: #dc3545;
    font-size: 13px;
    text-decoration: none;
    padding: 5px;
}

.ezwp-delete-link:hover {
    color: #c82333;
    text-decoration: underline;
}

.ezwp-delete-link i {
    margin-right: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .ezwp-modal-content {
        width: 95%;
        margin: 5% auto;
    }

    .ezwp-img-main-container {
        flex-direction: column;
    }

    .ezwp-img-details {
        width: 100%;
        max-height: 400px;
    }

    .ezwp-img-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .ezwp-img-toolbar {
        flex-wrap: wrap;
    }

    .ezwp-img-search {
        width: 100%;
        order: 3;
    }
}
