/* Custom Preview Modal */
.preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    /* Changed from flex */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.preview-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.preview-window {
    width: 90%;
    height: 85%;
    background: white;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: none;
    /* Removed white border */
}

.preview-overlay.active .preview-window {
    transform: scale(1);
}

/* Mac-style Header */
.preview-header-bar {
    height: 44px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    position: relative;
    /* For absolute close button */
}

.preview-controls {
    display: flex;
    gap: 8px;
    width: 60px;
}

.preview-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot-red {
    background: #ef4444;
    border: 1px solid #dc2626;
}

.dot-yellow {
    background: #f59e0b;
    border: 1px solid #d97706;
}

.dot-green {
    background: #22c55e;
    border: 1px solid #16a34a;
}

.preview-address-bar {
    flex: 1;
    height: 28px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 13px;
    color: #64748b;
    gap: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.preview-lock-icon {
    font-size: 10px;
    color: #64748b;
}

.preview-url {
    flex: 1;
    text-align: center;
}

.preview-refresh-icon {
    font-size: 10px;
    cursor: pointer;
    transition: transform 0.3s;
}

.preview-refresh-icon:hover {
    transform: rotate(180deg);
    color: #6366f1;
}

.preview-actions {
    width: 60px;
    /* Balance left side */
    display: flex;
    justify-content: flex-end;
}

.preview-close-btn {
    position: absolute;
    right: 0;
    top: 0;
    width: 48px;
    height: 100%;
    /* Fill title bar height */
    background: transparent;
    border: none;
    color: #334155;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 12px 0 0;
    /* Top right corner match */
    transition: all 0.15s;
    z-index: 10;
}

.preview-close-btn:hover {
    background: #e81123;
    color: white;
}

.preview-content-wrapper {
    flex: 1;
    position: relative;
    background: white;
}

.preview-frame {
    width: 100%;
    height: 100%;
    border: none;
}

/* Export Button */
.preview-export-btn {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 14px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    margin-right: 50px;
    /* Space for Close Button */
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-export-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Orientation Button Styles */
.active-orientation {
    background-color: #e0e7ff !important;
    color: #4f46e5 !important;
    border-color: #c7d2fe !important;
}

.toolbar-btn i {
    pointer-events: none;
}