/**
 * Media Block Styles
 * 
 * Styling for simple media blocks (images, GIFs, videos) in the grid system.
 */

/* ============================================================================
   BASE CONTAINER
   ============================================================================ */

.media-block-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 0 !important;
    box-sizing: border-box;
}

/* ============================================================================
   PLACEHOLDER STATE
   ============================================================================ */

.media-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--color-text-muted, #64748b);
    text-align: center;
    padding: 16px;
    box-sizing: border-box;
}

.media-placeholder .placeholder-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    opacity: 0.6;
}

.media-placeholder .placeholder-text {
    font-size: 0.875rem;
    font-style: italic;
}

/* ============================================================================
   VIEW MODE
   ============================================================================ */

.media-view {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.media-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 0;
}

.media-element {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.media-image {
    width: auto;
    height: auto;
}

.media-video {
    width: 100%;
    height: auto;
    max-height: 100%;
}

.media-caption {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: var(--color-text-muted, #94a3b8);
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ============================================================================
   EDIT MODE
   ============================================================================ */

.media-editor {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 12px;
    padding-top: 48px; /* Account for floating edit controls in grid block */
    box-sizing: border-box;
    overflow-y: auto;
    gap: 12px;
}

/* Upload Section */
.media-upload-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.media-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 100%;
    min-height: 100px;
    padding: 16px;
    box-sizing: border-box;
    border: 2px dashed rgba(var(--color-primary-rgb, 99, 102, 241), 0.3);
    border-radius: 12px;
    background: rgba(var(--color-primary-rgb, 99, 102, 241), 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
}

.media-drop-zone:hover {
    border-color: rgba(var(--color-primary-rgb, 99, 102, 241), 0.5);
    background: rgba(var(--color-primary-rgb, 99, 102, 241), 0.1);
}

.media-drop-zone.drag-over {
    border-color: var(--color-primary, #6366f1);
    background: rgba(var(--color-primary-rgb, 99, 102, 241), 0.2);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 2rem;
    opacity: 0.7;
    line-height: 1;
}

.upload-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-primary, #f1f5f9);
    margin: 0;
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted, #94a3b8);
    margin: 0;
}

.upload-formats {
    font-size: 0.65rem;
    color: var(--color-text-muted, #64748b);
    margin: 4px 0 0 0;
}

.upload-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.upload-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(var(--color-primary-rgb, 99, 102, 241), 0.2);
    border-top-color: var(--color-primary, #6366f1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Preview Section */
.media-preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.media-preview {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
    min-height: 100px;
}

.media-preview-element {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.media-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-shrink: 0;
}

.media-btn {
    all: unset;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-primary, #f1f5f9);
    background: rgba(var(--color-primary-rgb, 99, 102, 241), 0.15);
    border: 1px solid rgba(var(--color-primary-rgb, 99, 102, 241), 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.media-btn:hover {
    background: rgba(var(--color-primary-rgb, 99, 102, 241), 0.25);
    border-color: rgba(var(--color-primary-rgb, 99, 102, 241), 0.5);
}

.media-btn-upload {
    background: var(--color-primary, #6366f1);
    border-color: transparent;
    color: white;
}

.media-btn-upload:hover {
    background: var(--color-primary-light, #818cf8);
}

.media-btn-remove {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.media-btn-remove:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
}

.btn-icon {
    font-size: 0.9rem;
}

/* Caption Section */
.media-caption-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.caption-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--color-text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.caption-input {
    all: unset;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 0.85rem;
    color: var(--color-text-primary, #f1f5f9);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    width: 100%;
}

.caption-input:focus {
    border-color: rgba(var(--color-primary-rgb, 99, 102, 241), 0.5);
}

.caption-input::placeholder {
    color: var(--color-text-muted, #64748b);
}

.caption-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================================
   SCROLLBAR
   ============================================================================ */

.media-editor::-webkit-scrollbar {
    width: 4px;
}

.media-editor::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

.media-editor::-webkit-scrollbar-thumb {
    background: rgba(var(--color-primary-rgb, 99, 102, 241), 0.3);
    border-radius: 2px;
}

