/**
 * Image Browser Modal Styles (Global Version)
 * Responsive CSS for global image browser with input field filling capability
 *
 * This is a global version located in assets/css/ for use across all modules.
 *
 * @author MOYOLITE Development
 * @version 1.0.0
 */

/* ========================================
   Base Modal Styles
   ======================================== */

/* Modal container - Bootstrap-free implementation */
.modal {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    outline: 0;
}

.modal.in {
    display: block;
}

/* Modal backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 990;
    background-color: #000;
    opacity: 0;
    display: none;
    transition: opacity 0.15s linear;
}

.modal-backdrop.in {
    opacity: 0.5;
    display: block;
}

/* ========================================
   Base Modal Dialog Styles
   ======================================== */

/* Base modal dialog - ensures consistent centering across all modals */
.modal-dialog {
    position: relative;
    width: auto;
    margin: 30px auto;
    pointer-events: auto;
}

/* Vertically centered modal dialog */
.modal-dialog-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    margin: 30px auto;
}

/* Modal container */
#globalImageBrowserModal,
#globalImagePreviewModal,
#globalDeleteConfirmModal {
    z-index: 5000 !important;
}

/* Specific backdrop for global modals */
#globalImageBrowserBackdrop {
    z-index: 4990 !important;
}

#globalImageBrowserModal {
    z-index: 5001 !important;
}

#globalImageBrowserModal .modal-dialog {
    max-width: 950px;
    width: 95%;
    margin: 30px auto;
}

#globalImageBrowserModal .modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

#globalImageBrowserModal .modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

#globalImageBrowserModal .modal-header .modal-title {
    font-weight: 600;
    color: #333;
}

#globalImageBrowserModal .modal-header .close {
    padding: 10px;
    margin: -10px -10px -10px auto;
}

#globalImageBrowserModal .modal-body {
    padding: 20px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    background: #fff;
}

#globalImageBrowserModal .modal-footer {
    border-top: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

/* ========================================
   Upload Area Styles
   ======================================== */

/* File input - hidden but clickable for programmatic triggers */
#globalImageFileInput {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
}

.image-upload-area {
    border: 2px dashed #d0d0d0;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #fafafa 0%, #f0f0f0 100%);
    cursor: pointer;
}

.image-upload-area:hover,
.image-upload-area.dragover {
    border-color: #4a90d9;
    background: linear-gradient(135deg, #e8f4fd 0%, #d0e8f8 100%);
    transform: scale(1.01);
}

.image-upload-area .upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
    opacity: 0.7;
}

.image-upload-area.dragover .upload-icon {
    opacity: 1;
    transform: scale(1.1);
}

.image-upload-area p {
    margin: 10px 0;
    color: #666;
    font-size: 14px;
}

.image-upload-area .upload-hint {
    font-size: 12px;
    color: #999;
    margin-top: 10px;
}

/* Upload Options */
.image-upload-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 12px 15px;
    background: #f5f7fa;
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.image-upload-options .option-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.image-upload-options .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
}

.image-upload-options .checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Quality Slider Styles */
.image-upload-options .quality-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
    margin-left: 10px;
    transition: opacity 0.2s ease;
}

.image-upload-options .quality-label.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.image-upload-options .quality-label span:first-child {
    font-weight: 500;
}

.image-upload-options .quality-slider {
    width: 100px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.image-upload-options .quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4a90d9;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
}

.image-upload-options .quality-slider::-webkit-slider-thumb:hover {
    background: #357abd;
}

.image-upload-options .quality-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4a90d9;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease;
}

.image-upload-options .quality-slider::-moz-range-thumb:hover {
    background: #357abd;
}

.image-upload-options .quality-slider:disabled {
    background: #e0e0e0;
    cursor: not-allowed;
}

.image-upload-options .quality-slider:disabled::-webkit-slider-thumb {
    background: #aaa;
    cursor: not-allowed;
}

.image-upload-options .quality-value {
    font-weight: 600;
    color: #4a90d9;
    min-width: 35px;
    text-align: right;
}

.image-upload-options .refresh-btn {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 5px;
}

/* Upload Progress */
.upload-progress-container {
    margin: 15px 0;
    display: none;
}

.upload-progress-container.active {
    display: block;
}

.upload-progress-container .progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
}

.upload-progress-container .progress-bar {
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.upload-progress-container .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a90d9 0%, #67a8e8 50%, #4a90d9 100%);
    background-size: 200% 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
    animation: progressAnimation 2s linear infinite;
}

@keyframes progressAnimation {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.upload-progress-container .progress-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* ========================================
   Search & Filter Toolbar
   ======================================== */

.image-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    align-items: center;
}

.image-toolbar .search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.image-toolbar .search-box input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.image-toolbar .search-box input:focus {
    border-color: #4a90d9;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
    outline: none;
}

.image-toolbar .search-box::before {
    content: "\1F50D";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 0.5;
}

.image-toolbar .filter-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.image-toolbar .filter-controls select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    cursor: pointer;
    min-width: 130px;
    transition: all 0.2s ease;
    color: #000;
}

.image-toolbar .filter-controls select:focus {
    border-color: #4a90d9;
    outline: none;
}

.image-toolbar .view-toggle {
    display: flex;
    gap: 5px;
    background: #fff;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.image-toolbar .view-toggle button {
    padding: 6px 10px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-toolbar .view-toggle button:hover {
    background: #f0f0f0;
}

.image-toolbar .view-toggle button.active {
    background: #4a90d9;
    color: white;
}

/* ========================================
   Image Grid/List Views
   ======================================== */

.image-browser-container {
    position: relative;
    min-height: 300px;
}

.image-grid {
    display: grid;
    gap: 15px;
}

.image-grid.grid-view {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.image-grid.list-view {
    grid-template-columns: 1fr;
}

/* Image Card */
.image-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
}

.image-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-3px);
    border-color: #4a90d9;
}

.image-card.selected {
    border-color: #4a90d9;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.3);
}

.image-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.image-card.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Thumbnail */
.image-card .image-thumbnail {
    position: relative;
    padding-top: 100%;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    overflow: hidden;
}

.image-card .image-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.image-card:hover .image-thumbnail img {
    transform: scale(1.08);
}

/* Usage Badge */
.image-card .usage-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #28a745;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4);
}

/* Selection Checkbox Container */
.image-card .selection-checkbox-container {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #ddd;
    border-radius: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.image-card:hover .selection-checkbox-container,
.image-card.selected .selection-checkbox-container {
    border-color: #4a90d9;
}

.image-card.selected .selection-checkbox-container {
    background: #4a90d9;
    border-color: #4a90d9;
}

/* Actual checkbox input */
.image-card .selection-checkbox {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #4a90d9;
}

/* Clickable Thumbnail */
.image-card .image-thumbnail-clickable {
    position: relative;
    padding-top: 100%;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    overflow: hidden;
    cursor: pointer;
    transition: background 0.2s ease;
}

.image-card:not(.disabled) .image-thumbnail-clickable:hover {
    background: linear-gradient(135deg, #e8f4fd 0%, #d0e8f8 100%);
}

.image-card .image-thumbnail-clickable img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.image-card:hover .image-thumbnail-clickable img {
    transform: scale(1.08);
}

.image-card .image-info {
    padding: 12px;
}

.image-card .image-name {
    font-weight: 500;
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.image-card .image-meta {
    font-size: 11px;
    color: #888;
    display: flex;
    justify-content: space-between;
}

/* Image Actions */
.image-card .image-actions {
    display: flex;
    justify-content: space-around;
    padding: 10px;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-card:hover .image-actions {
    opacity: 1;
}

.image-card .image-actions button {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.image-card .image-actions button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.image-card .image-actions .btn-preview:hover {
    background: #6c757d;
    border-color: #6c757d;
}

.image-card .image-actions .btn-insert:hover {
    background: #4a90d9;
    border-color: #4a90d9;
}

.image-card .image-actions .btn-delete:hover:not(:disabled) {
    background: #dc3545;
    border-color: #dc3545;
}

/* List View Specific */
.image-grid.list-view .image-card {
    display: flex;
    align-items: center;
}

.image-grid.list-view .image-card .image-thumbnail-clickable {
    width: 100px;
    height: 100px;
    padding-top: 0;
    flex-shrink: 0;
}

.image-grid.list-view .image-card .image-info {
    flex: 1;
    padding: 15px 20px;
}

.image-grid.list-view .image-card .image-name {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-grid.list-view .image-card .image-meta {
    font-size: 12px;
}

.image-grid.list-view .image-card .image-actions {
    border-top: none;
    background: transparent;
    width: 180px;
    flex-shrink: 0;
    opacity: 1;
}

/* Empty State */
.no-images {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: #999;
}

.no-images .no-images-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-images .no-images-text {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 10px;
}

.no-images .no-images-hint {
    font-size: 14px;
    color: #bbb;
}

/* Loading State */
.image-grid.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.loading-spinner .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4a90d9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ========================================
   Infinite Scroll Loader
   ======================================== */

.infinite-scroll-loader {
    text-align: center;
    padding: 30px;
    color: #888;
    font-size: 14px;
}

.infinite-scroll-loader .spinner {
    width: 30px;
    height: 30px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4a90d9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

.infinite-scroll-loader.end-of-list {
    color: #aaa;
    font-style: italic;
}

/* ========================================
   Bulk Actions Bar
   ======================================== */

.bulk-actions-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    border-radius: 10px;
    margin-bottom: 15px;
    color: white;
}

.bulk-actions-bar.active {
    display: flex;
}

.bulk-actions-bar .selected-count {
    font-size: 14px;
    font-weight: 500;
}

.bulk-actions-bar .bulk-actions-buttons {
    display: flex;
    gap: 10px;
}

.bulk-actions-bar .bulk-btn {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bulk-actions-bar .bulk-btn-delete {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.bulk-actions-bar .bulk-btn-delete:hover {
    background: #dc3545;
}

.bulk-actions-bar .bulk-btn-clear {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.bulk-actions-bar .bulk-btn-clear:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ========================================
   Preview Modal
   ======================================== */

#globalImagePreviewModal {
    z-index: 100060;
}

#globalImagePreviewModal .modal-dialog {
    max-width: 800px;
    width: 95%;
}

#globalImagePreviewModal .modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}

#globalImagePreviewModal .modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

#globalImagePreviewModal .modal-body {
    padding: 25px;
    text-align: center;
}

.preview-image-container {
    max-width: 100%;
    max-height: 450px;
    overflow: hidden;
    margin-bottom: 20px;
    background: #f5f5f5;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-image-container img {
    max-width: 100%;
    max-height: 450px;
    object-fit: contain;
}

.preview-info {
    text-align: left;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.preview-info .info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.preview-info .info-row:last-child {
    border-bottom: none;
}

.preview-info .info-label {
    color: #666;
    font-weight: 500;
}

.preview-info .info-value {
    color: #333;
    font-weight: 400;
}

.preview-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.preview-actions .btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.preview-actions .btn-copy {
    background: #6c757d;
    border-color: #6c757d;
    color: white;
}

.preview-actions .btn-copy:hover {
    background: #5a6268;
    border-color: #545b62;
}

.preview-actions .btn-insert {
    background: #4a90d9;
    border-color: #4a90d9;
    color: white;
}

.preview-actions .btn-insert:hover {
    background: #357abd;
    border-color: #357abd;
}

.preview-actions .btn-delete {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

.preview-actions .btn-delete:hover {
    background: #c82333;
    border-color: #bd2130;
}

.preview-actions .btn-delete:disabled {
    background: #ccc;
    border-color: #ccc;
    cursor: not-allowed;
}

/* ========================================
   Delete Confirmation Modal
   ======================================== */

/* Delete modal - higher z-index to appear above image browser (1050) */
.delete-confirm-modal {
    z-index: 100070;
}

/* Delete modal container - uses flexbox for perfect centering when visible */
/* Must override base .modal.in display:block - use !important for display property */
.modal.delete-confirm-modal.in {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.delete-confirm-modal .modal-dialog {
    max-width: 450px;
    width: 100%;
    margin: 0;
    transform: translateY(0);
    transition: transform 0.3s ease-out;
}

/* Animation for modal appearance */
.delete-confirm-modal.in .modal-dialog {
    transform: translateY(0);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.delete-confirm-modal .modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    background: #fff;
    overflow: hidden;
}

.delete-confirm-modal .modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.delete-confirm-modal .modal-header.danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border-bottom: none;
}

.delete-confirm-modal .modal-header.danger .modal-title {
    color: white;
    font-weight: 600;
    font-size: 18px;
}

.delete-confirm-modal .modal-title {
    font-weight: 600;
    font-size: 18px;
    color: #333;
    margin: 0;
    line-height: 1.4;
}

.delete-confirm-modal .modal-body {
    padding: 32px 24px;
    text-align: center;
}

.delete-confirm-modal .delete-icon {
    font-size: 56px;
    margin-bottom: 20px;
    display: block;
    line-height: 1;
}

.delete-confirm-modal .delete-message {
    font-size: 16px;
    color: #555;
    margin-bottom: 12px;
    line-height: 1.5;
}

.delete-confirm-modal .delete-filename {
    font-weight: 600;
    color: #333;
    word-break: break-all;
    font-size: 14px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 12px 0;
    border: 1px solid #e9ecef;
}

.delete-confirm-modal .delete-warning {
    font-size: 14px;
    color: #dc3545;
    margin-top: 16px;
    padding: 12px 16px;
    background: #fff5f5;
    border-radius: 8px;
    border: 1px solid #ffcdd2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.delete-confirm-modal .modal-footer {
    border-top: 1px solid #eee;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

.delete-confirm-modal .btn {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.delete-confirm-modal .btn-cancel {
    background: #6c757d;
    color: white;
}

.delete-confirm-modal .btn-cancel:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.delete-confirm-modal .btn-delete {
    background: #dc3545;
    color: white;
}

.delete-confirm-modal .btn-delete:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.delete-confirm-modal .btn:active {
    transform: translateY(0);
}

/* ========================================
   Toast Notifications
   ======================================== */

.image-browser-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 25px;
    background: #333;
    color: white;
    border-radius: 10px;
    z-index: 10000;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    animation: toastSlideIn 0.3s ease;
    max-width: 350px;
}

.image-browser-toast.success {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
}

.image-browser-toast.error {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.image-browser-toast.warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #333;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.image-browser-toast .toast-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.image-browser-toast .toast-message {
    font-size: 13px;
    opacity: 0.9;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    #globalImageBrowserModal .modal-dialog {
        max-width: 100%;
        width: 100%;
        margin: 0;
        border-radius: 0;
    }

    #globalImageBrowserModal .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    #globalImageBrowserModal .modal-body {
        max-height: none;
        padding: 15px;
    }

    /* Delete confirmation modal responsive styles */
    .modal.delete-confirm-modal.in {
        padding: 15px;
        align-items: flex-start;
    }

    .delete-confirm-modal .modal-dialog {
        max-width: 100%;
        width: 100%;
        margin: 20px auto;
    }

    .delete-confirm-modal .modal-dialog-centered {
        min-height: calc(100vh - 40px);
        align-items: center;
    }

    .delete-confirm-modal .modal-content {
        border-radius: 12px;
    }

    .delete-confirm-modal .modal-header {
        padding: 16px 20px;
    }

    .delete-confirm-modal .modal-title {
        font-size: 16px;
    }

    .delete-confirm-modal .modal-body {
        padding: 24px 20px;
    }

    .delete-confirm-modal .delete-icon {
        font-size: 48px;
        margin-bottom: 16px;
    }

    .delete-confirm-modal .delete-message {
        font-size: 15px;
    }

    .delete-confirm-modal .delete-filename {
        font-size: 13px;
        padding: 10px 12px;
    }

    .delete-confirm-modal .modal-footer {
        padding: 14px 20px;
        flex-direction: row;
        gap: 10px;
    }

    .delete-confirm-modal .btn {
        padding: 12px 20px;
        font-size: 14px;
        flex: 1;
        min-width: auto;
    }

    .image-upload-area {
        padding: 30px 15px;
    }

    .image-upload-options {
        flex-direction: column;
        align-items: flex-start;
    }

    .image-toolbar {
        flex-direction: column;
    }

    .image-toolbar .search-box {
        width: 100%;
        min-width: auto;
    }

    .image-toolbar .filter-controls {
        width: 100%;
        justify-content: space-between;
    }

    .image-grid.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .image-card .image-actions {
        opacity: 1;
        padding: 8px;
    }

    .image-card .image-actions button {
        padding: 5px 8px;
        font-size: 11px;
    }

    .bulk-actions-bar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .bulk-actions-bar .bulk-actions-buttons {
        width: 100%;
        justify-content: center;
    }

    .preview-actions {
        flex-direction: column;
    }

    .preview-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .image-grid.grid-view {
        grid-template-columns: repeat(2, 1fr);
    }

    .image-toolbar .filter-controls select {
        min-width: auto;
        flex: 1;
    }

    /* Delete confirmation modal small screen adjustments */
    .modal.delete-confirm-modal.in {
        padding: 10px;
    }

    .delete-confirm-modal .modal-dialog {
        margin: 10px auto;
    }

    .delete-confirm-modal .modal-header {
        padding: 14px 16px;
    }

    .delete-confirm-modal .modal-title {
        font-size: 15px;
    }

    .delete-confirm-modal .modal-body {
        padding: 20px 16px;
    }

    .delete-confirm-modal .delete-icon {
        font-size: 40px;
        margin-bottom: 12px;
    }

    .delete-confirm-modal .delete-message {
        font-size: 14px;
    }

    .delete-confirm-modal .modal-footer {
        flex-direction: column;
        padding: 12px 16px;
        gap: 8px;
    }

    .delete-confirm-modal .btn {
        width: 100%;
        padding: 12px 16px;
    }
}

/* ========================================
   Keyboard Focus Styles
   ======================================== */

.image-card:focus,
.image-card:focus-within,
button:focus,
input:focus,
select:focus {
    outline: 2px solid #4a90d9;
    outline-offset: 2px;
}

.image-card:focus .image-thumbnail-clickable img,
.image-card:focus-within .image-thumbnail-clickable img {
    outline: none;
}

/* ========================================
   Utility Classes
   ======================================== */

.hidden {
    display: none !important;
}

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

.mt-10 {
    margin-top: 10px;
}

.mb-10 {
    margin-bottom: 10px;
}

/* Scrollbar Styling */
.image-browser-container::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.image-browser-container::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.image-browser-container::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.image-browser-container::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}