/**
 * FotoDigital Photobook - Collaboration & Sharing Styles
 */

/* -----------------------------------------------------------
 * Share button in topbar
 * --------------------------------------------------------- */

.mc-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.mc-share-btn:hover {
    background: #1d4ed8;
}

.mc-share-btn svg {
    flex-shrink: 0;
}

/* -----------------------------------------------------------
 * Modal overlay
 * --------------------------------------------------------- */

.mc-share-modal-overlay {
    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: 100000;
    padding: 20px;
}

.mc-share-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: mcShareFadeIn 0.2s ease-out;
}

@keyframes mcShareFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.mc-share-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.mc-share-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a202c;
}

.mc-share-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.mc-share-modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.mc-share-modal-body {
    padding: 20px 24px 24px;
}

/* -----------------------------------------------------------
 * Sections
 * --------------------------------------------------------- */

.mc-share-section {
    margin-bottom: 20px;
}

.mc-share-section:last-child {
    margin-bottom: 0;
}

.mc-share-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 8px;
}

/* -----------------------------------------------------------
 * Permissions toggle
 * --------------------------------------------------------- */

.mc-share-permissions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.mc-share-perm-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
}

.mc-share-perm-btn:hover {
    border-color: #d1d5db;
    color: #374151;
}

.mc-share-perm-btn.active {
    background: #eff6ff;
    border-color: #2563eb;
    color: #2563eb;
}

/* -----------------------------------------------------------
 * Link field + copy button
 * --------------------------------------------------------- */

.mc-share-link-field {
    display: flex;
    gap: 0;
    margin-bottom: 10px;
}

.mc-share-link-input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-right: none;
    border-radius: 6px 0 0 6px;
    font-size: 13px;
    color: #374151;
    background: #f9fafb;
    outline: none;
    min-width: 0;
}

.mc-share-link-input:focus {
    border-color: #2563eb;
    background: #fff;
}

.mc-share-link-copy {
    padding: 9px 16px;
    background: #2563eb;
    color: #fff;
    border: 1px solid #2563eb;
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.mc-share-link-copy:hover {
    background: #1d4ed8;
}

.mc-share-generate-btn {
    width: 100%;
    padding: 10px;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
}

.mc-share-generate-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.mc-share-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* -----------------------------------------------------------
 * Email invite
 * --------------------------------------------------------- */

.mc-share-email {
    display: flex;
    gap: 0;
}

.mc-share-email-input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-right: none;
    border-radius: 6px 0 0 6px;
    font-size: 13px;
    color: #374151;
    outline: none;
    min-width: 0;
}

.mc-share-email-input:focus {
    border-color: #2563eb;
}

.mc-share-email-btn {
    padding: 9px 20px;
    background: #059669;
    color: #fff;
    border: 1px solid #059669;
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.mc-share-email-btn:hover {
    background: #047857;
}

.mc-share-email-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* -----------------------------------------------------------
 * Quick share buttons
 * --------------------------------------------------------- */

.mc-share-quick-btns {
    display: flex;
    gap: 8px;
}

.mc-share-quick-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
    color: #374151;
}

.mc-share-quick-btn:hover {
    background: #f9fafb;
}

.mc-share-whatsapp {
    color: #25d366;
    border-color: #25d366;
}

.mc-share-whatsapp:hover {
    background: #f0fdf4;
}

.mc-share-email-quick {
    color: #2563eb;
    border-color: #2563eb;
}

.mc-share-email-quick:hover {
    background: #eff6ff;
}

.mc-share-copy-quick {
    color: #6b7280;
    border-color: #d1d5db;
}

.mc-share-copy-quick:hover {
    background: #f3f4f6;
}

/* -----------------------------------------------------------
 * Share list (collaborators)
 * --------------------------------------------------------- */

.mc-share-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.mc-share-list-loading,
.mc-share-list-empty {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: #9ca3af;
}

.mc-share-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.1s;
}

.mc-share-item:last-child {
    border-bottom: none;
}

.mc-share-item:hover {
    background: #f9fafb;
}

.mc-share-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mc-share-item-email {
    font-size: 13px;
    font-weight: 500;
    color: #1a202c;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mc-share-item-perm {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    width: fit-content;
}

.mc-perm-view {
    background: #f0fdf4;
    color: #15803d;
}

.mc-perm-edit {
    background: #eff6ff;
    color: #2563eb;
}

.mc-share-item-meta {
    flex-shrink: 0;
}

.mc-share-item-access {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
}

.mc-share-revoke {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.mc-share-revoke:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

/* -----------------------------------------------------------
 * View mode banner
 * --------------------------------------------------------- */

.mc-view-mode-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 99999;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.mc-view-banner-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mc-view-order-btn {
    padding: 4px 16px;
    background: #fff;
    color: #d97706;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.mc-view-order-btn:hover {
    background: #fef3c7;
}

/* Shift editor down when view banner is present */
body.mc-view-only .mc-editor-header,
body.mc-view-only .mc-topbar,
body.mc-view-only #mc-topbar {
    margin-top: 40px;
}

/* Disable interactions in view mode */
body.mc-view-only .mc-toolbar-btn:not(.mc-nav-btn),
body.mc-view-only .mc-sidebar-tab.mc-disabled {
    opacity: 0.4;
    pointer-events: none;
}

body.mc-view-only .canvas-container {
    pointer-events: none;
}

/* -----------------------------------------------------------
 * Responsive
 * --------------------------------------------------------- */

@media (max-width: 560px) {
    .mc-share-modal {
        max-width: 100%;
        border-radius: 12px 12px 0 0;
        max-height: 85vh;
    }

    .mc-share-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .mc-share-quick-btns {
        flex-wrap: wrap;
    }

    .mc-share-quick-btn {
        flex: 1 1 calc(50% - 4px);
    }

    .mc-share-permissions {
        flex-direction: column;
    }

    .mc-share-btn span {
        display: none;
    }

    .mc-share-btn {
        padding: 6px 10px;
    }
}
