/**
 * Floopy APS — Shared Viewer (visor público de links compartidos)
 */

.floopy-shared-viewer {
    max-width: 1400px;
    margin: 1rem auto;
    padding: 0 1rem;
    font-family: inherit;
    color: var(--floopy-text, #2c3e50);
}

/* Estados del root */
#floopy-shared-root {
    min-height: 400px;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

/* ==========================================================================
   Loading state
   ========================================================================== */
.floopy-shared__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 2rem;
    color: #7f8c8d;
}

.floopy-shared__spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #ecf0f1;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: floopySharedSpin 0.8s linear infinite;
    margin-bottom: 1rem;
}

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

/* ==========================================================================
   Error state
   ========================================================================== */
.floopy-shared__error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 3rem 2rem;
    text-align: center;
}

.floopy-shared__error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.floopy-shared__error h2 {
    margin: 0 0 0.5rem;
    color: #2c3e50;
    font-size: 1.3rem;
}

.floopy-shared__error p {
    margin: 0 0 1.5rem;
    color: #7f8c8d;
    max-width: 500px;
}

/* ==========================================================================
   Loaded state
   ========================================================================== */
.floopy-shared__header {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e4e8;
}

.floopy-shared__header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.floopy-shared__viewer {
    width: 100%;
    height: 650px;
    position: relative;
    background: #e5e9ec;
}

/* ==========================================================================
   Footer (marca de agua + CTA)
   ========================================================================== */
.floopy-shared__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    background: #fafafa;
    border-radius: 6px;
    border: 1px solid #e1e4e8;
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.floopy-shared__watermark {
    color: #95a5a6;
}

.floopy-shared__cta {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

.floopy-shared__cta:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Share modal (se muestra desde Mis archivos)
   ========================================================================== */
.floopy-share-modal__backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: floopyShareFade 0.2s ease;
}

@keyframes floopyShareFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.floopy-share-modal {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.floopy-share-modal h3 {
    margin: 0 0 0.5rem;
    color: #2c3e50;
}

.floopy-share-modal__desc {
    color: #7f8c8d;
    margin: 0 0 1.5rem;
    font-size: 0.9rem;
}

.floopy-share-modal__link-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.floopy-share-modal__input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.85rem;
    background: #f8f9fa;
    color: #2c3e50;
    min-width: 0;
}

.floopy-share-modal__copy-btn {
    padding: 0.6rem 1rem;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s;
}

.floopy-share-modal__copy-btn:hover {
    background: #2980b9;
}

.floopy-share-modal__copy-btn.is-copied {
    background: #27ae60;
}

.floopy-share-modal__info {
    background: #e3f2fd;
    border-left: 3px solid #3498db;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.floopy-share-modal__info strong {
    display: block;
    margin-bottom: 0.25rem;
}

.floopy-share-modal__actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.floopy-share-modal__actions .floopy-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.floopy-share-modal__actions .floopy-btn--danger {
    background: #fff;
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.floopy-share-modal__actions .floopy-btn--danger:hover {
    background: #e74c3c;
    color: #fff;
}

/* Badge de compartido en cards */
.floopy-my-files__card.is-shared .floopy-my-files__card-head::after {
    content: '🔗';
    margin-left: auto;
    font-size: 14px;
    opacity: 0.7;
    flex-shrink: 0;
}

.floopy-my-files__actions .floopy-btn--share {
    background: #fff;
    color: #3498db;
    border: 1px solid #3498db;
}

.floopy-my-files__actions .floopy-btn--share:hover {
    background: #3498db;
    color: #fff;
}

/* Responsive del visor */
@media (max-width: 768px) {
    .floopy-shared__viewer {
        height: 450px;
    }

    .floopy-shared__footer {
        flex-direction: column;
        align-items: flex-start;
    }
}
