/* OxiCloud Inline Viewer Styles */

.inline-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background-color: var(--color-overlay-heavy);
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.inline-viewer-modal.active {
    display: flex !important;
    opacity: 1;
    align-items: center;
    justify-content: center;
    pointer-events: all;
}

.inline-viewer-content {
    width: 90%;
    height: 90%;
    max-width: 1200px;
    background-color: var(--color-bg-surface);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px var(--color-shadow-3xl);
}

.inline-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--color-bg-subtle);
    border-bottom: 1px solid var(--color-border);
}

.inline-viewer-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inline-viewer-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--color-text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.inline-viewer-close:hover {
    background-color: var(--color-border);
    color: var(--color-text-secondary);
}

.inline-viewer-container {
    flex-grow: 1;
    overflow: auto;
    background-color: var(--color-bg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.inline-viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--color-bg-subtle);
    border-top: 1px solid var(--color-border);
}

.inline-viewer-download {
    background-color: var(--color-accent);
    color: var(--color-danger-text);
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.inline-viewer-download:hover {
    background-color: var(--color-danger-alt);
}

.inline-viewer-controls {
    display: flex;
    gap: 8px;
}

.inline-viewer-controls button {
    background-color: var(--color-border-light);
    border: 1px solid var(--color-border-medium);
    border-radius: 4px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-subtle);
    transition: all 0.2s;
}

.inline-viewer-controls button:hover {
    background-color: var(--color-border);
    color: var(--color-text-dark);
}

/* Image viewer */
.inline-viewer-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center;
    transition: transform 0.2s ease;
}

/* PDF viewer */
.inline-viewer-pdf,
.inline-viewer-pdf-fallback {
    width: 100%;
    height: 100%;
    border: none;
}

/* Only show fallback if object fails */
.inline-viewer-pdf + .inline-viewer-pdf-fallback {
    display: none;
}

.inline-viewer-pdf:not([data]),
.inline-viewer-pdf[data=""] + .inline-viewer-pdf-fallback {
    display: block;
}

/* Loading indicator */
.inline-viewer-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    color: var(--color-text-subtle);
}

/* Download progress container */
.inline-viewer-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: var(--color-progress-overlay);
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--color-shadow);
}

/* Progress bar track */
.inline-viewer-progress-bar {
    width: 200px;
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
}

/* Progress bar fill */
.inline-viewer-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-info-blue), var(--color-admin-blue));
    border-radius: 4px;
    transition: width 0.2s ease;
}

/* Progress percentage text */
.inline-viewer-progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Error and unsupported message */
.inline-viewer-message {
    padding: 32px;
    text-align: center;
    max-width: 400px;
}

.inline-viewer-icon {
    font-size: 64px;
    color: var(--color-text-dark);
    margin-bottom: 24px;
}

.inline-viewer-text {
    color: var(--color-text-subtle);
    line-height: 1.6;
}

.inline-viewer-text p {
    margin: 0 0 16px;
}

/* Text viewer */
.inline-viewer-text-content {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 16px 24px;
    font-family: "Courier New", Consolas, Monaco, monospace;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg-surface);
    overflow: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-sizing: border-box;
    text-align: left;
    tab-size: 4;
}

/* Video viewer */
.inline-viewer-video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    background-color: var(--color-black);
}

/* Audio viewer */
.inline-viewer-audio-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 48px 32px;
    max-width: 500px;
    width: 100%;
}

.inline-viewer-audio-icon {
    font-size: 80px;
    color: var(--color-text-faint);
    animation: audio-pulse 2s ease-in-out infinite;
}

@keyframes audio-pulse {
    0%,
    100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

.inline-viewer-audio-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-align: center;
    word-break: break-word;
    max-width: 100%;
}

.inline-viewer-audio {
    width: 100%;
    max-width: 460px;
    border-radius: 8px;
    outline: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .inline-viewer-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .inline-viewer-controls {
        display: none;
    }
}
