/* Styles specifiques a resources/views/admin/media/index.blade.php */

.media-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.media-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: calc(16px * var(--radius-scale));
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.media-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: calc(12px * var(--radius-scale));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

.media-stat-info .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    display: block;
}

.media-stat-info .label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.media-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.filter-group {
    display: flex;
    gap: 1rem;
    flex: 1;
    max-width: 600px;
}

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

.search-wrapper i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    height: 45px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: calc(12px * var(--radius-scale));
    padding: 0 15px 0 45px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.filter-select {
    height: 45px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: calc(12px * var(--radius-scale));
    padding: 0 15px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    min-width: 150px;
    cursor: pointer;
    transition: var(--transition);
}

.filter-select:focus {
    border-color: var(--primary);
    outline: none;
}

.btn-group {
    display: flex;
    gap: 1rem;
}

.btn-media {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 45px;
    padding: 0 1.5rem;
    border-radius: calc(12px * var(--radius-scale));
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);
}

.btn-media:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.btn-media-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-media-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.25);
}

.btn-media-danger {
    background: var(--card-bg);
    color: var(--text-main);
    border-color: var(--border);
}

.btn-media-danger:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
    box-shadow: 0 4px 12px rgba(var(--danger-rgb), 0.25);
}

/* Upload area styling */
.upload-section {
    background: var(--card-bg);
    border: 2px dashed var(--border);
    border-radius: calc(16px * var(--radius-scale));
    padding: 3rem 2rem;
    text-align: center;
    margin-bottom: 2rem;
    cursor: pointer;
    transition: var(--transition);
    display: none; /* Toggleable */
}

.upload-section.show {
    display: block;
}

.upload-section:hover, .upload-section.dragover {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.03);
}

.upload-section i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    transition: var(--transition);
}

.upload-section:hover i {
    color: var(--primary);
    transform: translateY(-5px);
}

.progress-container {
    margin-top: 1.5rem;
    background: var(--border);
    border-radius: calc(20px * var(--radius-scale));
    height: 10px;
    overflow: hidden;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    display: none;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: var(--primary);
    transition: width 0.2s;
}

/* Media Items Grid */
.full-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

.grid-media-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: calc(14px * var(--radius-scale));
    aspect-ratio: 1;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    /* Chrome rasterises every grid cell, on screen or not, and these are
       full-size originals shown in a thumbnail box. content-visibility
       skips the rendering work for off-screen cells; the intrinsic size
       matches the square cell so the scrollbar stays stable. */
    content-visibility: auto;
    contain-intrinsic-size: 180px 180px;

    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.grid-media-item:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.grid-media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid-media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-icon-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.05);
    padding: 1rem;
}

.file-icon-wrapper i {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.file-icon-wrapper span {
    font-size: 0.8rem;
    text-align: center;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hover Overlay */
.media-hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.92);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: white;
    z-index: 10;
}

.grid-media-item:hover .media-hover-overlay {
    opacity: 1;
}

.media-name {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: auto;
}

.media-overlay-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: auto;
}

.action-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: calc(8px * var(--radius-scale));
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
}

.action-icon-btn:hover {
    background: white;
    color: #18181b;
    border-color: white;
    transform: scale(1.05);
}

.action-icon-btn-danger:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* Lightbox */
.media-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10001;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 3rem;
}

.media-lightbox.open {
    display: flex;
}

.media-lightbox-content {
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-lightbox-content img,
.media-lightbox-content video {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: calc(8px * var(--radius-scale));
}

.media-lightbox-file {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    color: white;
}

.media-lightbox-file i {
    font-size: 1rem;
    opacity: 0.7;
}

.media-lightbox-caption {
    margin-top: 1.5rem;
    color: white;
    font-size: 0.9rem;
    opacity: 0.8;
    max-width: 90vw;
    text-align: center;
    word-break: break-all;
}

.media-lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: calc(50% * var(--radius-scale));
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.media-lightbox-close:hover {
    background: white;
    color: #18181b;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: calc(12px * var(--radius-scale));
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
    animation: slideIn 0.3s ease forwards;
    font-weight: 500;
}

@keyframes slideIn {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Blocs statiques anciennement en style inline dans le blade */
.upload-heading { margin-bottom: 0.5rem; font-weight: 700; color: var(--text-main); }
.upload-subtext { color: var(--text-muted); margin-bottom: 1rem; }
.upload-hint { font-size: 0.8rem; color: var(--text-muted); }
.upload-status { margin-top: 1rem; font-weight: 600; }
.media-grid-message { grid-column: 1/-1; text-align: center; color: var(--text-muted); padding: 3rem; }
.media-grid-empty { grid-column: 1/-1; text-align: center; color: var(--text-muted); padding: 5rem 0; }
.video-thumb-wrapper { width: 100%; height: 100%; background: #09090b; position: relative; overflow: hidden; }
.video-thumb-wrapper video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.video-thumb-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.2); color: white; }
.video-thumb-overlay i { font-size: 2.5rem; opacity: 0.8; }
