/**
 * Portfolio Preview Modal Styles
 * Base modal styles migrated to modal-system.css
 */

/* Preview Modal Specific Styles */
.modal-container--full {
    width: min(1400px, 96vw);
    height: min(900px, 92dvh);
    max-width: min(1400px, 96vw);
    max-height: min(900px, 92dvh);
    margin: 0;
    box-sizing: border-box;
}

.portfolio-preview-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 64px;
    padding: 0.75rem 1rem;
    color: var(--theme-text-primary, #0f172a);
    background: var(--theme-bg-secondary, #f7f9fc);
    border-bottom: 1px solid var(--theme-border-primary, #e2e8f0);
}

.portfolio-preview-title {
    min-width: 0;
    margin-right: auto;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portfolio-preview-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem;
    background: var(--theme-bg-tertiary, #f0f4f8);
    border: 1px solid var(--theme-border-primary, #e2e8f0);
    border-radius: 0.65rem;
}

.portfolio-preview-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    padding: 0.45rem 0.65rem;
    color: var(--theme-text-secondary, #475569);
    background: transparent;
    border: 0;
    border-radius: 0.45rem;
    cursor: pointer;
}

.portfolio-preview-button[hidden] {
    display: none;
}

.portfolio-preview-button:hover,
.portfolio-preview-button[aria-pressed="true"] {
    color: var(--theme-text-primary, #0f172a);
    background: var(--theme-bg-card, #ffffff);
    box-shadow: var(--theme-shadow-sm, 0 1px 2px rgba(0,0,0,.08));
}

.portfolio-preview-button svg {
    width: 18px;
    height: 18px;
}

.portfolio-preview-close {
    color: var(--theme-text-secondary, #475569);
}

.portfolio-preview-stage {
    position: relative;
    display: grid;
    place-items: center;
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 1rem;
    background: #111827;
}

.portfolio-preview-frame-wrap {
    width: 100%;
    height: 100%;
    min-width: 320px;
    background: #ffffff;
    transition: width 180ms ease;
}

.portfolio-preview-frame-wrap[data-device="tablet"] {
    width: min(768px, 100%);
}

.portfolio-preview-frame-wrap[data-device="mobile"] {
    width: min(390px, 100%);
}

.portfolio-preview-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #ffffff;
}

.portfolio-preview-loading:not([hidden]),
.portfolio-preview-error:not([hidden]) {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 2rem;
    color: var(--text-secondary);
    text-align: center;
    pointer-events: none;
}

.portfolio-preview-error {
    color: var(--error);
}

@media (max-width: 640px) {
    .modal-overlay.modal--preview {
        padding: 0;
    }

    .modal-overlay.modal--preview .modal-container--full {
        width: 100vw;
        height: 100dvh;
        max-width: none;
        max-height: none;
        margin: 0;
        border: 0;
        border-radius: 0;
    }

    .portfolio-preview-toolbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto auto;
        grid-template-areas:
            "title title title close"
            "devices devices refresh external";
        align-items: center;
        justify-content: initial;
        padding: 0.65rem;
        gap: 0.5rem;
    }

    .portfolio-preview-title {
        grid-area: title;
        margin: 0;
    }

    .portfolio-preview-controls {
        grid-area: devices;
        width: max-content;
        justify-content: flex-start;
    }

    .portfolio-preview-toolbar [data-preview-action="refresh"] {
        grid-area: refresh;
    }

    .portfolio-preview-toolbar [data-preview-action="external"] {
        grid-area: external;
    }

    .portfolio-preview-close {
        grid-area: close;
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }
}

.portfolio-preview-branding {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgb(255, 255, 255);
    color: rgb(51, 51, 51);
    border-radius: 50px;
    box-shadow: rgba(0, 0, 0, 0.15) 0px 4px 12px;
    font-family: sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    z-index: 10;
    border: 1px solid rgb(238, 238, 238);
    transition: transform 0.2s;
}

.portfolio-preview-branding:hover {
    transform: translateY(-2px);
}

.portfolio-preview-branding img {
    width: 16px;
    height: 16px;
}
