/**
 * Preview CSS for Responsive Preview Bar
 *
 * @package ResponsivePreviewBar
 */

/* CSS Variables */
:root {
    --rpb-h: 64px;
    --rpb-bg: #1f2a37;
    --rpb-fg: #fff;
    --rpb-accent: #007cba;
    --rpb-border: #2c3e50;
    --rpb-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --rpb-transition: all 0.3s ease;
}

/* Reset and base styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #000;
    overflow: hidden;
}

/* Toolbar */
.rpb-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--rpb-h);
    background: var(--rpb-bg);
    color: var(--rpb-fg);
    z-index: 9999;
    box-shadow: var(--rpb-shadow);
    border-bottom: 1px solid var(--rpb-border);
}

.rpb-toolbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 20px;
    max-width: 100%;
}

/* Toolbar Left */
.rpb-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.rpb-logo img {
    height: 32px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}

.rpb-title {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

/* Toolbar Center */
.rpb-toolbar-center {
    display: flex;
    justify-content: center;
    flex: 1;
}

.rpb-device-buttons {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.rpb-device-btn {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: var(--rpb-fg);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--rpb-transition);
    font-size: 14px;
    font-weight: 500;
    min-width: 80px;
}

.rpb-device-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.rpb-device-btn.active,
.rpb-device-btn[aria-pressed="true"] {
    background: var(--rpb-accent);
    border-color: var(--rpb-accent);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

.rpb-device-btn:focus {
    outline: 2px solid var(--rpb-accent);
    outline-offset: 2px;
}

/* Toolbar Right */
.rpb-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.rpb-cta-btn {
    background: var(--rpb-accent);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--rpb-transition);
    white-space: nowrap;
}

.rpb-cta-btn:hover {
    color: #fff;
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.4);
}

.rpb-cta-btn:focus {
    outline: 2px solid var(--rpb-accent);
    outline-offset: 2px;
}

.rpb-cta-2 {
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #000;
}

.rpb-cta-2:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Cart Badge */
.rpb-cart-badge {
    position: relative;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Close Button */
.rpb-close-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--rpb-fg);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--rpb-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.rpb-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.rpb-close-btn:focus {
    outline: 2px solid var(--rpb-accent);
    outline-offset: 2px;
}

.rpb-close-icon {
    font-size: 18px;
    line-height: 1;
}

/* Spacer */
.rpb-spacer {
    width: 100%;
}

/* Canvas */
.rpb-canvas {
    position: fixed;
    top: var(--rpb-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Bound Container */
.rpb-bound {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transition: var(--rpb-transition);
    position: relative;
}

/* Device Width Classes */
.rpb-w-mobile {
    max-width: 430px;
}

.rpb-w-tablet {
    max-width: 834px;
}

.rpb-w-desktop {
    max-width: 1440px;
}

/* Iframe */
#rpb-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Keyboard Shortcuts Info */
.rpb-shortcuts-info {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px;
    border-radius: 8px;
    z-index: 10000;
    backdrop-filter: blur(10px);
}

.rpb-shortcuts-content h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
}

.rpb-shortcuts-content ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.rpb-shortcuts-content li {
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rpb-shortcuts-content kbd {
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    border: 1px solid #555;
}

/* Responsive Design */
@media (max-width: 768px) {
    .rpb-toolbar-content {
        padding: 0 10px;
    }
    
    .rpb-title {
        font-size: 14px;
    }
    
    .rpb-device-btn {
        padding: 6px 12px;
        font-size: 12px;
        min-width: 60px;
    }
    
    .rpb-cta-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .rpb-canvas {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .rpb-toolbar-left {
        gap: 8px;
    }
    
    .rpb-logo img {
        height: 24px;
        max-width: 80px;
    }
    
    .rpb-title {
        font-size: 12px;
    }
    
    .rpb-device-buttons {
        gap: 4px;
        padding: 4px;
    }
    
    .rpb-device-btn {
        padding: 4px 8px;
        font-size: 11px;
        min-width: 50px;
    }
    
    .rpb-cta-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .rpb-toolbar-right {
        gap: 8px;
    }
}

/* Loading State */
.rpb-bound.loading {
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rpb-bound.loading::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--rpb-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Focus Management */
.rpb-device-btn:focus-visible,
.rpb-cta-btn:focus-visible,
.rpb-close-btn:focus-visible {
    outline: 2px solid var(--rpb-accent);
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .rpb-toolbar {
        border-bottom: 2px solid var(--rpb-fg);
    }
    
    .rpb-device-btn {
        border-width: 2px;
    }
    
    .rpb-cta-btn {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .rpb-device-btn,
    .rpb-cta-btn,
    .rpb-close-btn,
    .rpb-bound {
        transition: none;
    }
    
    .rpb-cart-badge {
        animation: none;
    }
}
