/* Interactive Preview System Styles */

.preview-system {
    position: relative;
    background: var(--card-background, #ffffff);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

.preview-tabs {
    display: flex;
    background: var(--bg-light, #f8f9fa);
    border-radius: 12px;
    padding: 6px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.preview-tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
    min-width: 120px;
}

.preview-tab.active {
    background: var(--primary-color, #007bff);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.preview-tab:not(.active):hover {
    background: rgba(0, 123, 255, 0.1);
}

/* Live Preview Panel */
.live-preview-panel {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    min-height: 500px;
}

.qr-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--preview-bg, #fafafa);
    border-radius: 12px;
    padding: 40px;
    position: relative;
}

.qr-code-display {
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
    background: white;
    padding: 20px;
}

.qr-code-display:hover {
    transform: scale(1.05);
}

.qr-info-display {
    margin-top: 20px;
    text-align: center;
    color: var(--text-muted, #666);
}

.preview-controls {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color, #e0e0e0);
}

/* Device Mockups */
.device-mockup-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 40px 20px;
    flex-wrap: wrap;
}

.device-mockup {
    position: relative;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.device-mockup:hover {
    transform: translateY(-5px);
}

.device-mockup.active {
    transform: scale(1.1);
}

/* Phone Mockup */
.phone-mockup {
    width: 200px;
    height: 400px;
    background: #2c3e50;
    border-radius: 25px;
    padding: 20px 15px;
    position: relative;
}

.phone-screen {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.phone-qr {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}

/* Tablet Mockup */
.tablet-mockup {
    width: 280px;
    height: 200px;
    background: #34495e;
    border-radius: 20px;
    padding: 15px 20px;
}

.tablet-screen {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tablet-qr {
    max-width: 60%;
    max-height: 60%;
    object-fit: contain;
}

/* Desktop Mockup */
.desktop-mockup {
    width: 320px;
    height: 200px;
    position: relative;
}

.desktop-screen {
    width: 100%;
    height: 160px;
    background: #2c3e50;
    border-radius: 8px 8px 0 0;
    padding: 10px;
}

.desktop-display {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.desktop-qr {
    max-width: 40%;
    max-height: 40%;
    object-fit: contain;
}

.desktop-stand {
    width: 60px;
    height: 40px;
    background: #34495e;
    margin: 0 auto;
    border-radius: 0 0 10px 10px;
}

/* Size Calculator */
.size-calculator {
    background: var(--card-background, #ffffff);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color, #e0e0e0);
}

.size-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.size-option {
    padding: 15px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.size-option:hover,
.size-option.active {
    border-color: var(--primary-color, #007bff);
    background: rgba(0, 123, 255, 0.1);
}

.size-label {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-color, #333);
}

.size-dimensions {
    font-size: 0.9rem;
    color: var(--text-muted, #666);
}

.size-use-case {
    font-size: 0.8rem;
    color: var(--text-muted, #666);
    margin-top: 5px;
}

.custom-size {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 15px;
}

.custom-size input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    text-align: center;
}

/* Print Preview */
.print-preview-panel {
    background: #f5f5f5;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    max-height: 500px;
    overflow-y: auto;
}

.print-paper {
    background: white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    margin: 0 auto;
    position: relative;
    border-radius: 4px;
}

.print-paper.a4 {
    width: 250px;
    height: 350px; /* Compact A4 */
}

.print-paper.letter {
    width: 260px;
    height: 336px; /* Compact US Letter */
}

.print-qr-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.print-measurements {
    position: absolute;
    color: var(--primary-color, #007bff);
    font-size: 0.8rem;
    font-weight: 500;
}

.measurement-width {
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
}

.measurement-height {
    right: -60px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
}

.print-controls {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.dpi-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dpi-selector select {
    padding: 8px 12px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
}

/* Scan Simulation */
.scan-simulation {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 40px 20px;
    color: white;
    text-align: center;
}

.phone-simulator {
    width: 250px;
    height: 500px;
    background: #1a1a1a;
    border-radius: 30px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

.phone-simulator-screen {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

.camera-viewfinder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 40%, rgba(0, 255, 0, 0.3) 50%, transparent 60%);
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.qr-target-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 160px;
    height: 160px;
    border: 3px solid #00ff00;
    border-radius: 12px;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.scan-result-popup {
    position: absolute;
    bottom: 50px;
    left: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px;
    border-radius: 12px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.5s ease;
}

.scan-result-popup.show {
    transform: translateY(0);
    opacity: 1;
}

.simulation-controls {
    margin-top: 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.simulate-btn {
    padding: 12px 24px;
    background: #007bff;
    border: 1px solid #007bff;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 14px;
    min-width: 120px;
}

.simulate-btn:hover {
    background: #0056b3;
    border-color: #0056b3;
    transform: translateY(-1px);
}

.simulate-btn:active {
    transform: translateY(0);
}

.btn-success.simulate-btn {
    background: #28a745;
    border-color: #28a745;
}

.btn-success.simulate-btn:hover {
    background: #1e7e34;
    border-color: #1e7e34;
}

.btn-secondary.simulate-btn {
    background: #6c757d;
    border-color: #6c757d;
}

.btn-secondary.simulate-btn:hover {
    background: #545b62;
    border-color: #545b62;
}

/* Animations */
@keyframes scanLine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes pulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(0, 255, 0, 0.7);
        transform: translate(-50%, -50%) scale(1);
    }
    50% { 
        box-shadow: 0 0 0 20px rgba(0, 255, 0, 0);
        transform: translate(-50%, -50%) scale(1.05);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .live-preview-panel {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .device-mockup-container {
        gap: 20px;
    }
    
    .phone-mockup {
        width: 150px;
        height: 300px;
    }
    
    .tablet-mockup {
        width: 220px;
        height: 160px;
    }
    
    .desktop-mockup {
        width: 250px;
        height: 160px;
    }
}

@media (max-width: 768px) {
    .preview-system {
        padding: 16px;
    }
    
    .preview-tabs {
        flex-direction: column;
        gap: 8px;
    }
    
    .preview-tab {
        text-align: center;
    }
    
    .device-mockup-container {
        flex-direction: column;
        align-items: center;
    }
    
    .print-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .phone-simulator {
        width: 200px;
        height: 400px;
    }
    
    .simulated-qr {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 5;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .simulated-qr img {
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
    
    .simulation-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .simulate-btn {
        min-width: 100px;
        font-size: 13px;
        padding: 10px 20px;
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .preview-system {
        background: var(--dark-card-background, #2d3748);
        color: var(--dark-text-color, #e2e8f0);
    }
    
    .preview-controls,
    .size-calculator {
        background: var(--dark-card-background, #2d3748);
        border-color: var(--dark-border-color, #4a5568);
    }
    
    .print-paper {
        background: var(--dark-card-background, #2d3748);
    }
}