/* Template Detail V2 - Full Screen Layout Styles */
/* Inspired by HTML5 UP Paradigm Shift design */

/* =============================================================================
   LAYOUT FUNDAMENTALS
   ============================================================================= */

/* Override body for full-screen experience */
.fullscreen-layout {
    margin: 0;
    padding: 0;
    padding-top: 4rem;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-primary);
    box-sizing: border-box;
}

/* Minimal Header */
.header-minimal,
.header {
    height: 4rem;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}

.header-minimal .nav-container,
.header .nav-container {
    height: 100%;
    max-width: none;
    padding: 0 var(--space-lg);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
}

.breadcrumb-mini {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.breadcrumb-link {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
}

.breadcrumb-link:hover {
    color: var(--primary-dark);
}

.breadcrumb-separator {
    color: var(--text-light);
    margin: 0 var(--space-xs);
}

.header-controls {
    display: flex;
    gap: var(--space-sm);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.875rem;
}

/* =============================================================================
   FULL SCREEN CSS GRID LAYOUT
   ============================================================================= */

.fullscreen-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    height: calc(100vh - 4rem);
    overflow: hidden;
}

/* =============================================================================
   SIDEBAR (LEFT PANEL)
   ============================================================================= */

.template-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-content {
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
    min-height: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
}

/* Template Metadata Compact */
.template-meta-compact {
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-lg);
    padding-top: var(--space-sm);
    flex-shrink: 0;
    order: 1;
}

.template-title-compact {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
    line-height: 1.2;
}

.template-desc-compact {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-md);
}

.template-tags-compact {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.template-tags-compact .template-tag {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.625rem;
    font-weight: 500;
    border: 1px solid rgba(99, 102, 241, 0.3);
    transition: var(--transition);
}

/* Device Controls Vertical */
.device-controls-vertical {
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-lg);
    flex-shrink: 0;
    order: 2;
}

.control-label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.device-buttons-compact {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.device-btn-compact {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-sans);
    text-align: left;
    width: 100%;
}

.device-btn-compact:hover {
    border-color: var(--primary);
    background: var(--bg-tertiary);
    transform: translateX(2px);
}

.device-btn-compact.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.device-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.device-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.device-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.device-size {
    font-size: 0.625rem;
    opacity: 0.8;
    font-weight: 400;
}

/* Preview Tools Compact */
.preview-tools-compact {
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-lg);
}

.tool-group {
    margin-bottom: var(--space-md);
}

.tool-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.url-display {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

.url-text-compact {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-family: var(--font-mono, monospace);
    background: var(--bg-primary);
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-copy-btn-compact {
    background: var(--primary);
    color: white;
    border: none;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition);
    min-width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.url-copy-btn-compact:hover {
    background: var(--primary-dark);
}

.tool-actions {
    display: flex;
    gap: var(--space-xs);
}

.tool-btn-compact {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition);
    font-weight: 500;
    flex: 1;
}

.tool-btn-compact:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Sidebar CTA */
.sidebar-cta {
    margin-top: auto;
    padding-top: var(--space-lg);
    padding-bottom: var(--space-xl);
    flex-shrink: 0;
    order: 3;
}

.cta-content-compact {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.sidebar-cta h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.sidebar-cta p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    line-height: 1.4;
}

.btn-full {
    width: 100%;
    justify-content: center;
    margin-bottom: var(--space-md);
}

.link-subtle {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.link-subtle:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* =============================================================================
   MAIN PREVIEW AREA (RIGHT PANEL)
   ============================================================================= */

.preview-main {
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.preview-frame-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading State */
.preview-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-md);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Preview Frame */
.preview-frame-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.template-iframe-fullscreen {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: white;
    box-shadow: var(--shadow-xl);
    transition: var(--transition-slow);
}

/* Device-specific iframe sizing */
.template-iframe-fullscreen.desktop {
    width: 100%;
    height: 100%;
    max-width: none;
}

.template-iframe-fullscreen.tablet {
    width: 768px;
    height: 100%;
    max-height: 90%;
}

.template-iframe-fullscreen.mobile {
    width: 375px;
    height: 100%;
    max-height: 90%;
}

/* Error State */
.preview-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-secondary);
}

.error-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

/* Overlay Controls */
.preview-overlay-controls {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
}

.preview-main:hover .preview-overlay-controls {
    opacity: 1;
    pointer-events: auto;
}

.overlay-control-group {
    display: flex;
    gap: var(--space-xs);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    padding: var(--space-xs);
}

.overlay-btn {
    background: transparent;
    color: white;
    border: none;
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.overlay-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* =============================================================================
   MOBILE CTA SECTION
   ============================================================================= */

/* Hidden by default, shown only on mobile */
.mobile-cta-section {
    display: none;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: var(--space-lg);
}

.mobile-cta-content {
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}

.mobile-cta-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.mobile-cta-content p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    line-height: 1.4;
}

.mobile-cta-content .btn-full {
    width: 100%;
    justify-content: center;
    margin-bottom: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    font-size: 1rem;
    font-weight: 600;
}

.mobile-cta-content .link-subtle {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.mobile-cta-content .link-subtle:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 1200px) {
    .fullscreen-grid {
        grid-template-columns: 320px 1fr;
    }

    .sidebar-content {
        padding: var(--space-lg);
        gap: var(--space-lg);
    }
}

@media (max-width: 1024px) {
    .fullscreen-grid {
        grid-template-columns: 280px 1fr;
    }

    .sidebar-content {
        padding: var(--space-md) var(--space-lg);
        gap: var(--space-md);
    }

    .template-title-compact {
        font-size: 1.25rem;
    }

    .device-btn-compact {
        padding: var(--space-xs) var(--space-sm);
    }

    .device-name {
        font-size: 0.8rem;
    }

    .device-size {
        font-size: 0.6rem;
    }

    .device-btn-compact[data-device="desktop"] {
        display: none;
    }
}

@media (max-width: 768px) {
    .fullscreen-grid {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
        height: calc(100vh - 4rem);
    }

    .mobile-cta-section {
        display: block;
        grid-row: 2;
    }

    .template-sidebar {
        display: none;
    }

    .sidebar-content {
        flex-direction: column;
        overflow-x: visible;
        overflow-y: visible;
        padding: var(--space-md);
        gap: var(--space-sm);
        height: auto;
        min-height: auto;
    }

    .template-meta-compact,
    .preview-tools-compact {
        display: none;
    }

    .device-controls-vertical {
        display: none;
    }

    .sidebar-cta {
        display: none;
    }

    .nav-actions {
        gap: var(--space-md);
    }

    .breadcrumb-mini {
        display: none;
    }

    .header-controls {
        gap: var(--space-xs);
    }

    .preview-main {
        margin-top: 0;
        grid-row: 1;
    }

    .header-minimal .nav-logo img,
    .header .nav-logo img {
        height: 3.8rem !important;
        max-width: 140px !important;
    }
}

@media (max-width: 480px) {
    .header-minimal,
    .header {
        height: 3.5rem;
    }

    .fullscreen-layout {
        padding-top: 3.5rem;
    }

    .fullscreen-grid {
        height: calc(100vh - 3.5rem);
        grid-template-rows: 1fr auto;
    }

    .header-minimal .nav-logo img,
    .header .nav-logo img {
        height: 3.5rem !important;
        max-width: 120px !important;
    }

    .sidebar-content {
        padding: var(--space-sm);
        gap: var(--space-md);
    }

    .template-meta-compact,
    .device-controls-vertical,
    .preview-tools-compact {
        min-width: 150px;
        padding-right: var(--space-md);
    }

    .sidebar-cta {
        min-width: 140px;
    }

    .preview-frame-wrapper {
        padding: 0;
    }

    .template-iframe-fullscreen {
        width: 100% !important;
        height: 100% !important;
        max-width: none !important;
        max-height: none !important;
        border-radius: 0;
        border: none;
    }

    .template-iframe-fullscreen.tablet,
    .template-iframe-fullscreen.mobile,
    .template-iframe-fullscreen.desktop {
        width: 100% !important;
        height: 100% !important;
        max-width: none !important;
        max-height: none !important;
    }

    .mobile-cta-section {
        padding: var(--space-md);
    }

    .mobile-cta-content h3 {
        font-size: 1.125rem;
    }

    .mobile-cta-content .btn-full {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.875rem;
    }
}

/* =============================================================================
   CUSTOM SCROLLBAR STYLING
   ============================================================================= */

.template-sidebar::-webkit-scrollbar {
    width: 6px;
}

.template-sidebar::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.template-sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.template-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* =============================================================================
   FOCUS AND ACCESSIBILITY
   ============================================================================= */

.device-btn-compact:focus,
.tool-btn-compact:focus,
.overlay-btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.template-iframe-fullscreen:focus {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
}

/* =============================================================================
   LOADING AND TRANSITION STATES
   ============================================================================= */

.template-iframe-fullscreen {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.template-iframe-fullscreen.loaded {
    opacity: 1;
}

.preview-frame-wrapper.loading .template-iframe-fullscreen {
    pointer-events: none;
}

/* =============================================================================
   PRINT STYLES
   ============================================================================= */

@media print {
    .fullscreen-layout {
        height: auto;
        overflow: visible;
    }

    .header-minimal,
    .template-sidebar,
    .preview-overlay-controls {
        display: none;
    }

    .fullscreen-grid {
        grid-template-columns: 1fr;
        height: auto;
    }

    .preview-main {
        height: 100vh;
    }
}
