/**
 * RoseRock Development Bar Styles
 * Unified development bar with breakpoint indicators, BrowserSync status, and cache information
 */

/* Development Bar Container */
.rr-dev-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

/* Only show dev bar when not inside iframe (main window only) */
.rr-dev-bar.rr-main-window {
    opacity: 1;
}

.rr-dev-bar-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    align-items: center;
    padding: 8px 16px;
    max-width: 100%;
    gap: 16px;
}

/* Bar Sections */
.rr-dev-bar-section {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

/* Column Layout */
.rr-dev-bar-section.rr-browsersync-status {
    justify-self: start;
}

.rr-dev-bar-section.rr-dev-notice.rr-dev-center {
    justify-self: center;
    text-align: center;
}

.rr-dev-bar-section.rr-breakpoint-indicator {
    justify-self: end;
}

.rr-dev-bar-section.rr-dev-controls {
    justify-self: end;
    gap: 8px;
}

/* Icons and Labels */
.rr-dev-icon {
    margin-right: 6px;
    font-size: 14px;
}

.rr-dev-label {
    margin-right: 6px;
    font-weight: 600;
    opacity: 0.9;
}

.rr-dev-message {
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Breakpoint Indicator */
.rr-breakpoint-display {
    display: flex;
    gap: 4px;
}

.rr-bp {
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 11px;
    background-color: rgba(255, 255, 255, 0.2);
    color: inherit;
    opacity: 1;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rr-bp:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.rr-bp.active {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.rr-bp.simulated {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.2);
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

@keyframes simulatedPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.7), 0 0 0 2px rgba(59, 130, 246, 0.2);
    }
}

/* Responsive Breakpoint Visibility */
.rr-bp-xs.active { display: block; }
.rr-bp-sm.active { display: none; }
.rr-bp-md.active { display: none; }
.rr-bp-lg.active { display: none; }
.rr-bp-xl.active { display: none; }
.rr-bp-2xl.active { display: none; }

@media (min-width: 640px) {
    .rr-bp-xs.active { display: none; }
    .rr-bp-sm.active { display: block; }
}

@media (min-width: 768px) {
    .rr-bp-sm.active { display: none; }
    .rr-bp-md.active { display: block; }
}

@media (min-width: 1024px) {
    .rr-bp-md.active { display: none; }
    .rr-bp-lg.active { display: block; }
}

@media (min-width: 1280px) {
    .rr-bp-lg.active { display: none; }
    .rr-bp-xl.active { display: block; }
}

@media (min-width: 1536px) {
    .rr-bp-xl.active { display: none; }
    .rr-bp-2xl.active { display: block; }
}

/* Status Indicators */
.rr-status-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
}

.rr-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #6b7280;
    transition: background-color 0.3s ease;
}

/* Status Colors */
.rr-status-indicator[data-status="active"] .rr-status-dot,
.rr-status-indicator[data-status="busted"] .rr-status-dot {
    background-color: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.rr-status-indicator[data-status="available"] .rr-status-dot {
    background-color: #3b82f6;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
}

.rr-status-indicator[data-status="inactive"] .rr-status-dot,
.rr-status-indicator[data-status="enabled"] .rr-status-dot {
    background-color: #f59e0b;
}

.rr-status-indicator[data-status="error"] .rr-status-dot {
    background-color: #ef4444;
}

.rr-status-indicator[data-status="unknown"] .rr-status-dot {
    background-color: #6b7280;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Reset and Cycle Buttons */
.rr-breakpoint-reset,
.rr-breakpoint-cycle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: inherit;
    padding: 2px 6px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 6px;
    transition: all 0.2s ease;
}

.rr-breakpoint-reset:hover,
.rr-breakpoint-cycle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.rr-breakpoint-reset:hover {
    transform: scale(1.1);
}

.rr-breakpoint-cycle:hover {
    transform: scale(1.1);
}

/* Buttons */
.rr-copy-button,
.rr-close-button,
.rr-dev-bar-toggle button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: inherit;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s ease;
}

.rr-copy-button:hover,
.rr-close-button:hover,
.rr-dev-bar-toggle button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.rr-copy-button:active,
.rr-close-button:active,
.rr-dev-bar-toggle button:active {
    background: rgba(255, 255, 255, 0.4);
}

/* Settings Link */
.rr-settings-link {
    color: inherit;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.rr-settings-link:hover {
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
    text-decoration: none;
}

/* Toggle Button (when bar is hidden) */
.rr-dev-bar-toggle {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 999998;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

/* Only show toggle when not inside iframe (main window only) */
.rr-dev-bar-toggle.rr-main-window {
    opacity: 1;
}

.rr-dev-bar-toggle button {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .rr-dev-bar-content {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto auto;
        padding: 8px 12px;
        font-size: 12px;
        gap: 8px;
        align-items: center;
    }
    
    /* Row 1: BrowserSync Status */
    .rr-dev-bar-section.rr-browsersync-status {
        grid-column: 1 / -1;
        grid-row: 1;
        justify-self: center;
    }
    
    /* Row 2: Development Server Notice */
    .rr-dev-bar-section.rr-dev-notice.rr-dev-center {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: center;
    }
    
    /* Row 3: Breakpoint Indicators and Controls */
    .rr-dev-bar-section.rr-breakpoint-indicator {
        grid-column: 1;
        grid-row: 3;
        justify-self: center;
    }
    
    .rr-dev-bar-section.rr-dev-controls {
        grid-column: 2;
        grid-row: 3;
        justify-self: end;
    }
    
    .rr-dev-label {
        display: none;
    }
    
    .rr-status-text {
        display: none;
    }
    
    .rr-dev-message {
        font-size: 11px;
    }
    
    .rr-bp {
        padding: 1px 4px;
        font-size: 10px;
    }
}

/* Hide on very small screens */
@media (max-width: 480px) {
    .rr-dev-bar {
        font-size: 11px;
    }
    
    .rr-breakpoint-indicator,
    .rr-cache-status {
        display: none;
    }
}

/* Print Styles */
@media print {
    .rr-dev-bar,
    .rr-dev-bar-toggle {
        display: none !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .rr-dev-bar {
        border-top: 2px solid currentColor;
    }
    
    .rr-status-dot {
        border: 1px solid currentColor;
    }
}

/* Viewport Simulation */
.rr-viewport-simulation-active {
    background: #2d3748 !important;
}

.rr-viewport-simulation-active body {
    transition: all 0.3s ease;
}

.rr-viewport-simulation-active .rr-dev-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000001;
    max-width: none;
    margin: 0;
}

#rr-viewport-wrapper {
    position: relative;
    z-index: 1;
}

/* Simulation width indicator */
.rr-viewport-indicator {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(59, 130, 246, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    font-weight: 600;
    z-index: 1000000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.rr-viewport-indicator.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Add bottom margin to body when dev bar is active */
body:has(.rr-dev-bar.rr-main-window) {
    margin-bottom: 46px;
}

/* Mobile responsive margin */
@media (max-width: 768px) {
    body:has(.rr-dev-bar.rr-main-window) {
        margin-bottom: 76px; /* More space for mobile stacked layout */
    }
}

/* Fallback for browsers that don't support :has() */
body.rr-dev-bar-active {
    margin-bottom: 46px;
}

@media (max-width: 768px) {
    body.rr-dev-bar-active {
        margin-bottom: 76px;
    }
}