/**
 * Live Preview Styles
 * 
 * @package Faraz
 * @since 1.0.0
 */

/* Live Preview Container */
.portfolio__card.live-preview-mode {
	position: relative;
	overflow: hidden !important; /* Force content containment */
	height: 100%;
}

.portfolio__card.live-preview-mode .live-preview-container {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	overflow: hidden !important;
	border-radius: inherit;
	background-color: #f0f2f5; /* Light gray for loading */
	z-index: 5;
	box-shadow: inset 0 0 15px rgba(0,0,0,0.05);
}

/* Dark mode / Dark theme support */
body.dark-mode .portfolio__card.live-preview-mode .live-preview-container,
.dark-mode .portfolio__card.live-preview-mode .live-preview-container {
    background-color: #121212;
}

.portfolio__card.live-preview-mode .image {
	position: relative;
	width: 100%;
	height: 450px;
	overflow: hidden !important;
    background-color: transparent;
}

/* Iframe Styling */
.portfolio__card.live-preview-mode .live-preview-iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 400%; /* Represents 1600px width */
	height: 1000%;  /* Increased height */
	border: none;
	pointer-events: none;
	transform-origin: top left;
	transition: transform 12s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease; /* Faster scroll (12s) */
	/* Scale down to 25% */
	transform: scale(0.25) translateY(0);
	will-change: transform;
	opacity: 0.4; /* Visible during load */
}

/* Show iframe once loaded */
.portfolio__card.live-preview-mode .live-preview-container.loaded .live-preview-iframe,
.portfolio__card.live-preview-mode .live-preview-container.iframe-ready .live-preview-iframe,
.portfolio__card.live-preview-mode:hover .live-preview-iframe {
    opacity: 1;
}

/* Hover Effect - Scroll Down */
.portfolio__card.live-preview-mode:hover .live-preview-iframe {
	transform: scale(0.25) translateY(-2500px); 
}

/* Loading Spinner */
.portfolio__card.live-preview-mode .live-preview-container::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(0, 69, 126, 0.1);
    border-top-color: #00457E;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 10;
    transition: opacity 0.4s ease;
}

body.dark-mode .portfolio__card.live-preview-mode .live-preview-container::before {
    border-color: rgba(255,255,255,0.05);
    border-top-color: #AAD8FF;
}

/* Hide spinner when loaded */
.portfolio__card.live-preview-mode .live-preview-container.loaded::before {
    opacity: 0 !important;
    visibility: hidden !important;
}

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

/* Load Failed / Blocked Message */
.portfolio__card.live-preview-mode .live-preview-container .load-notice {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 3;
    opacity: 0;
    background: inherit;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.portfolio__card.live-preview-mode .live-preview-container.load-failed:not(.iframe-ready) .load-notice {
    opacity: 1;
}

.portfolio__card.live-preview-mode .live-preview-container .load-notice p {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.portfolio__card.live-preview-mode .live-preview-container .load-notice small {
    font-size: 12px;
    color: #888;
}

body.dark-mode .portfolio__card.live-preview-mode .live-preview-container .load-notice p { color: #eee; }
body.dark-mode .portfolio__card.live-preview-mode .live-preview-container .load-notice small { color: #777; }

/* Content Overlay Styling */
.portfolio__card.live-preview-mode .content {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	z-index: 20;
	background-color: rgba(0, 69, 126, 0.95); /* Fixed Navy Blue color with high opacity */
	padding: 15px 25px;
	pointer-events: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

.portfolio__card.live-preview-mode .content span {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    order: 2; /* Move title to the right for RTL */
    text-align: right;
}

.portfolio__card.live-preview-mode .content div {
    display: flex;
    align-items: center;
    order: 1; /* Move "View Project" to the left */
}

.portfolio__card.live-preview-mode .content h3,
.portfolio__card.live-preview-mode .content h4,
.portfolio__card.live-preview-mode .content h5 {
	color: #ffffff !important;
	margin: 0;
}

.portfolio__card.live-preview-mode .content h3 {
    font-size: 1.1rem;
    font-weight: bold;
}

.portfolio__card.live-preview-mode .content h4 {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 2px;
}

.portfolio__card.live-preview-mode .content h5 {
    font-size: 0.9rem;
    margin-left: 10px;
}

.portfolio__card.live-preview-mode .content svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}



/* Reset colors for non-live mode if needed, but here we only target live-preview-mode */


/* Separation from cards below */
.portfolio__card.live-preview-mode::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(255,255,255,0.1);
    z-index: 30;
}

/* Responsive adjustments */
@media (max-width: 992px) {
	.portfolio__card.live-preview-mode .image {
		height: 380px;
	}
	.portfolio__card.live-preview-mode:hover .live-preview-iframe {
		transform: scale(0.25) translateY(-2000px);
	}
}

@media (max-width: 768px) {
    .portfolio__card.live-preview-mode .image {
		height: 320px;
	}
	.portfolio__card.live-preview-mode:hover .live-preview-iframe {
		transform: scale(0.25) translateY(-1500px);
	}
}
