/**
 * Media Library CSS
 * Styles for the distributed media library system
 */

/* Modal Customizations */
#media-library-modal .modal-dialog {
    max-width: 90%;
    width: 1400px;
    height: 90vh;
}

#media-library-modal .modal-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#media-library-modal .modal-body {
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.media-library-sidebar {
    background-color: #f8f9fa;
    height: 100%;
}

/* Upload Area */
#upload-area {
    min-height: 400px;
}

.border-dashed {
    border: 2px dashed #dee2e6;
    background-color: #fafafa;
    transition: all 0.3s;
}

.border-dashed.drag-over {
    border-color: #0d6efd;
    background-color: #e7f3ff;
}

.icon-48 {
    width: 48px;
    height: 48px;
}

/* Media Grid */
#media-container {
    height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
}

.media-item {
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.media-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.media-item.selected {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

.media-item .media-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 3;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.media-item .media-type-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    font-size: 10px;
    padding: 2px 6px;
}

.media-item .media-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
    padding: 8px;
    opacity: 0;
    transition: opacity 0.3s;
}

.media-item:hover .media-info {
    opacity: 1;
}

.media-thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.media-thumbnail img {
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
}

.media-icon {
    background: #f8f9fa;
}

/* List View */
.list-view .media-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 0;
}

.list-view .media-item .media-thumbnail,
.list-view .media-item .media-icon {
    width: 60px;
    height: 60px;
    margin-right: 15px;
}

.list-view .media-item .card-body {
    flex: 1;
    display: flex;
    align-items: center;
}

/* Upload Queue */
.upload-item {
    border-left: 4px solid #0d6efd;
    margin-bottom: 10px;
    transition: all 0.3s;
}

.upload-item.success {
    border-left-color: #198754;
    background-color: #d1f2db;
}

.upload-item.error {
    border-left-color: #dc3545;
    background-color: #f8d7da;
}

.upload-item .progress {
    height: 3px;
    margin-top: 8px;
}

/* Video Player */
.video-preview {
    position: relative;
    background: #000;
}

.video-preview video {
    width: 100%;
    height: auto;
}

.video-duration {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

/* Server Management */
.server-card {
    border-left: 4px solid #0d6efd;
    transition: all 0.3s;
}

.server-card.active {
    border-left-color: #198754;
}

.server-card.error {
    border-left-color: #dc3545;
}

.server-status {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.server-status.online {
    background-color: #198754;
}

.server-status.offline {
    background-color: #dc3545;
}

.server-status.maintenance {
    background-color: #ffc107;
}

/* Storage Statistics */
.storage-chart {
    height: 200px;
}

.storage-progress {
    height: 30px;
    position: relative;
}

.storage-progress .progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Filters */
.media-type-filter .list-group-item {
    border: none;
    padding: 8px 15px;
    color: #6c757d;
}

.media-type-filter .list-group-item.active {
    background-color: #0d6efd;
    color: white;
}

.media-type-filter .list-group-item:hover {
    background-color: #e9ecef;
    color: #495057;
}

.media-type-filter .list-group-item.active:hover {
    background-color: #0b5ed7;
    color: white;
}

/* Responsive Design */
@media (max-width: 1200px) {
    #media-library-modal .modal-dialog {
        max-width: 95%;
        width: auto;
    }
}

@media (max-width: 768px) {
    #media-library-modal .modal-dialog {
        margin: 10px;
    }

    .media-item {
        margin-bottom: 10px;
    }

    #media-container {
        height: 400px;
    }
}

/* Loading States */
.media-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #6c757d;
}

.media-loading .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Empty State */
.media-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.media-empty i {
    opacity: 0.3;
    margin-bottom: 20px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.media-item {
    animation: fadeIn 0.3s ease;
}

/* Custom Scrollbar */
#media-container::-webkit-scrollbar {
    width: 8px;
}

#media-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#media-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#media-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Tooltips */
.media-tooltip {
    position: absolute;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

/* Bulk Actions */
.bulk-actions {
    background: #f8f9fa;
    padding: 10px;
    border-top: 1px solid #dee2e6;
    display: none;
}

.bulk-actions.show {
    display: block;
}

/* Search Highlight */
.search-highlight {
    background-color: #fff3cd;
    padding: 2px;
    border-radius: 2px;
}