/**
 * SOS Simulator - Style główne symulatora
 * 
 * @package SymulatorObwodowSterowania
 * @version 1.0.0
 */

/* ==========================================================================
   Zmienne CSS
   ========================================================================== */

:root {
    /* Kolory główne */
    --sos-primary: #3498db;
    --sos-primary-dark: #2980b9;
    --sos-secondary: #2ecc71;
    --sos-secondary-dark: #27ae60;
    --sos-accent: #e74c3c;
    --sos-accent-dark: #c0392b;
    
    /* Kolory tła */
    --sos-bg-dark: #1a1a2e;
    --sos-bg-medium: #16213e;
    --sos-bg-light: #0f3460;
    --sos-bg-panel: #1e2a3a;
    
    /* Kolory tekstu */
    --sos-text-primary: #ecf0f1;
    --sos-text-secondary: #bdc3c7;
    --sos-text-muted: #7f8c8d;
    
    /* Kolory stanu */
    --sos-success: #2ecc71;
    --sos-warning: #f39c12;
    --sos-error: #e74c3c;
    --sos-info: #3498db;
    
    /* Kolory przewodów */
    --sos-wire-brown: #8B4513;
    --sos-wire-black: #1a1a1a;
    --sos-wire-grey: #808080;
    --sos-wire-blue: #0000FF;
    --sos-wire-green-yellow: linear-gradient(90deg, #00FF00 50%, #FFFF00 50%);
    --sos-wire-red: #FF0000;
    --sos-wire-orange: #FFA500;
    
    /* Rozmiary */
    --sos-toolbar-height: 48px;
    --sos-statusbar-height: 30px;
    --sos-panel-width: 280px;
    --sos-panel-collapsed-width: 40px;
    --sos-panel-bottom-height: 150px;
    --sos-panel-bottom-collapsed: 30px;
    
    /* Cienie */
    --sos-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --sos-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --sos-shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.5);
    
    /* Przejścia */
    --sos-transition-fast: 0.15s ease;
    --sos-transition-normal: 0.3s ease;
    --sos-transition-slow: 0.5s ease;
    
    /* Border radius */
    --sos-radius-sm: 4px;
    --sos-radius-md: 8px;
    --sos-radius-lg: 12px;
    
    /* Z-index */
    --sos-z-canvas: 1;
    --sos-z-panel: 100;
    --sos-z-toolbar: 200;
    --sos-z-dialog: 500;
    --sos-z-overlay: 1000;
}

/* ==========================================================================
   Reset i podstawy kontenera
   ========================================================================== */

.sos-simulator-wrapper {
    position: relative;
    width: 100%;
    min-height: 600px;
    background-color: var(--sos-bg-dark);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    color: var(--sos-text-primary);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.sos-simulator-wrapper *,
.sos-simulator-wrapper *::before,
.sos-simulator-wrapper *::after {
    box-sizing: border-box;
}

/* Kontener główny symulatora */
#sos-simulator-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 600px;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Canvas 3D
   ========================================================================== */

.sos-canvas-container {
    position: relative;
    flex: 1;
    overflow: hidden;
    background-color: var(--sos-bg-dark);
}

.sos-canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
}

/* Kursory dla różnych trybów */
.mode-editor .sos-canvas {
    cursor: crosshair;
}

.mode-simulation .sos-canvas {
    cursor: pointer;
}

.mode-learning .sos-canvas {
    cursor: help;
}

/* Kursor podczas nawigacji */
.sos-canvas.navigating {
    cursor: grab;
}

.sos-canvas.navigating:active {
    cursor: grabbing;
}

/* Kursor podczas łączenia */
.sos-canvas.connecting {
    cursor: cell;
}

/* Kursor podczas przeciągania */
.sos-canvas.dragging {
    cursor: move;
}

/* ==========================================================================
   Ładowanie i błędy
   ========================================================================== */

.sos-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--sos-bg-dark);
    z-index: var(--sos-z-overlay);
}

.sos-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--sos-bg-light);
    border-top-color: var(--sos-primary);
    border-radius: 50%;
    animation: sos-spin 1s linear infinite;
}

@keyframes sos-spin {
    to {
        transform: rotate(360deg);
    }
}

.sos-loading-text {
    margin-top: 16px;
    color: var(--sos-text-secondary);
    font-size: 16px;
}

.sos-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--sos-bg-dark);
    padding: 40px;
    text-align: center;
    z-index: var(--sos-z-overlay);
}

.sos-error h3 {
    color: var(--sos-error);
    font-size: 24px;
    margin-bottom: 16px;
}

.sos-error p {
    color: var(--sos-text-secondary);
    margin-bottom: 12px;
    max-width: 400px;
}

.sos-error button {
    margin-top: 20px;
    padding: 12px 24px;
    background-color: var(--sos-primary);
    color: white;
    border: none;
    border-radius: var(--sos-radius-md);
    font-size: 16px;
    cursor: pointer;
    transition: background-color var(--sos-transition-fast);
}

.sos-error button:hover {
    background-color: var(--sos-primary-dark);
}

/* ==========================================================================
   Ostrzeżenie o orientacji (mobile)
   ========================================================================== */

.sos-orientation-warning {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: var(--sos-z-overlay);
}

.sos-orientation-content {
    text-align: center;
    padding: 40px;
}

.sos-orientation-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 20px;
    animation: sos-rotate-hint 2s ease-in-out infinite;
}

@keyframes sos-rotate-hint {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(-90deg);
    }
}

.sos-orientation-content p {
    font-size: 18px;
    color: var(--sos-text-primary);
    max-width: 300px;
}

/* ==========================================================================
   Tooltip globalny
   ========================================================================== */

.sos-tooltip {
    position: absolute;
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    font-size: 12px;
    border-radius: var(--sos-radius-sm);
    pointer-events: none;
    z-index: var(--sos-z-dialog);
    white-space: nowrap;
    box-shadow: var(--sos-shadow-md);
    opacity: 0;
    transition: opacity var(--sos-transition-fast);
}

.sos-tooltip.visible {
    opacity: 1;
}

.sos-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.85);
}

/* ==========================================================================
   Overlay dla operacji
   ========================================================================== */

.sos-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--sos-z-overlay);
}

.sos-overlay.active {
    display: flex;
}

/* ==========================================================================
   Scrollbar styling
   ========================================================================== */

.sos-simulator-wrapper ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.sos-simulator-wrapper ::-webkit-scrollbar-track {
    background: var(--sos-bg-dark);
}

.sos-simulator-wrapper ::-webkit-scrollbar-thumb {
    background: var(--sos-bg-light);
    border-radius: 4px;
}

.sos-simulator-wrapper ::-webkit-scrollbar-thumb:hover {
    background: var(--sos-primary);
}

/* ==========================================================================
   Animacje pomocnicze
   ========================================================================== */

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

@keyframes sos-shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

@keyframes sos-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes sos-slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes sos-slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes sos-slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ==========================================================================
   Klasy pomocnicze
   ========================================================================== */

.sos-hidden {
    display: none !important;
}

.sos-invisible {
    visibility: hidden !important;
}

.sos-disabled {
    pointer-events: none;
    opacity: 0.5;
}

.sos-no-select {
    user-select: none;
    -webkit-user-select: none;
}

.sos-flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sos-text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}