* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Helvetica Neue', Arial, sans-serif; background-color: #f4f6f8; color: #333; height: 100vh; overflow: hidden; }

.hidden { display: none !important; }

/* ==========================================
   1. LOGOWANIE
   ========================================== */
#login-screen { display: flex; justify-content: center; align-items: center; height: 100vh; }
.login-box { background: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); width: 100%; max-width: 400px; }
.login-box h2 { margin-bottom: 20px; text-align: center; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; font-size: 14px; }
.form-group input { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; }
button { background-color: #007bff; color: white; border: none; padding: 12px; width: 100%; border-radius: 4px; cursor: pointer; font-weight: bold; }
.btn-secondary { background-color: #6c757d; width: auto; padding: 8px 16px; }

/* ==========================================
   2. UKŁAD DASHBOARDU I NAWIGACJA
   ========================================== */
.dashboard-container { display: flex; flex-direction: column; height: 100vh; }
.dashboard-container.active { display: flex; }
.workspace { display: flex; flex: 1; overflow: hidden; }
.workspace-view { display: none; flex: 1; height: 100%; }
.workspace-view.active { display: flex; }

.topbar { background: #fff; padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #ddd; }
.main-nav { display: flex; gap: 10px; }
.nav-btn { background: #e9ecef; color: #333; padding: 8px 16px; width: auto; font-size: 14px; }
.nav-btn.active { background: #007bff; color: white; }

/* ==========================================
   3. LEWY PANEL (Drzewko)
   ========================================== */
.sidebar { width: 350px; background: #fff; border-right: 1px solid #ddd; padding: 20px; overflow-y: auto; }
.sidebar h3 { margin-bottom: 15px; padding-bottom: 10px; border-bottom: 2px solid #f4f6f8; }

.tree-node { margin-left: 15px; margin-top: 5px; }
.tree-item { cursor: pointer; padding: 5px; border-radius: 4px; transition: background 0.2s; font-size: 14px; display: flex; align-items: center; gap: 5px; width: 100%; }
.tree-item:hover { background: #e9ecef; }
.tree-item.active-node { background: #007bff; color: white; }
.tree-children { display: none; border-left: 1px dashed #ccc; padding-left: 10px; }
.tree-children.open { display: block; }

.compare-btn { background: none; border: none; cursor: pointer; font-size: 14px; margin-left: auto; padding: 2px 6px; border-radius: 4px; transition: background 0.2s; width: auto; }
.compare-btn:hover { background: #007bff; color: white; }

/* ==========================================
   4. PRAWY PANEL (Wizualizacja i Wyniki)
   ========================================== */
.viewer { flex: 1; padding: 30px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.details-card, .canvas-card { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.details-card h2, .canvas-card h2 { margin-bottom: 15px; font-size: 18px; color: #555; }
.details-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; font-size: 14px; }
.detail-item strong { display: block; color: #888; font-size: 12px; margin-bottom: 2px; }
.empty-state { text-align: center; color: #888; margin-top: 50px; font-size: 18px; }

/* --- Symulacja Ekranu Badania i Płótno --- */
.canvas-wrapper {
    position: relative;
    background: #000;
    width: 100%;
    max-width: 800px; /* <--- Ograniczenie maksymalnego rozmiaru */
    margin: 0 auto;   /* <--- Wyśrodkowanie okna w panelu */
    aspect-ratio: 4/3; 
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); /* Dodaje lekki, estetyczny cień */
}

.canvas-target {
    position: absolute;
    top: 5%;
    padding: 10px 20px;
    border: 2px solid #ffffff;
    color: #ffffff;
    font-size: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 2;
}
#canvas-target-left { left: 5%; }
#canvas-target-right { right: 5%; }

#canvas-stimulus-image { 
    max-width: 60%; 
    max-height: 60%; 
    object-fit: contain; 
    z-index: 2; 
    margin: auto;
}
#canvas-stimulus-text { 
    color: #fff; 
    font-size: 24px; 
    z-index: 2; 
    text-align: center; 
    max-width: 80%; 
}

/* KLUCZOWA ZMIANA: Płótno jest całkowicie przezroczyste */
canvas, #trajectory-canvas {
    position: absolute;
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100%;
    z-index: 10;
    pointer-events: none;
    background: transparent !important;
    border: none !important;
}

/* ==========================================
   5. KREATOR BADANIA
   ========================================== */
/* --- Zmiany dla wiersza bodźca (aby pomieścił okienka indywidualne) --- */
.stimulus-row { 
    display: flex; flex-direction: column; background: #fdfdfd; padding: 15px; 
    border: 1px solid #ddd; border-radius: 4px; margin-bottom: 10px; 
}
.row-main { 
    display: flex; gap: 15px; align-items: center; width: 100%; 
}
.row-main select { flex: 1; padding: 8px; border: 1px solid #ccc; border-radius: 4px; }

/* Okienka dla indywidualnych opcji pod obrazkiem */
.local-options-container {
    display: grid; grid-template-columns: 1fr 1fr; gap: 15px;
    margin-top: 15px; padding-top: 15px; border-top: 1px dashed #ccc;
}
.local-col { display: flex; flex-direction: column; gap: 5px; }
.local-col input { padding: 6px; border: 1px solid #ccc; border-radius: 4px; font-size: 12px; }.stimulus-row input[type="file"] { flex: 2; }
.stimulus-row select { flex: 1; padding: 8px; border: 1px solid #ccc; border-radius: 4px; }
.remove-row-btn { background: #dc3545; color: white; padding: 8px 12px; width: auto; cursor: pointer; }

/* --- Checkboxy w drzewku --- */
.tree-checkbox {
    margin-right: 8px;
    transform: scale(1.2);
    cursor: pointer;
}

/* Zapobiega zaznaczaniu tekstu przy szybkim klikaniu */
.tree-item {
    user-select: none;
}

/* ==========================================
   6. BIBLIOTEKA OBRAZKÓW (MODAL I WIERSZE)
   ========================================== */
.modal {
    position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center;
}
.modal-content {
    background-color: #fff; padding: 25px; border-radius: 8px;
    width: 90%; max-width: 800px; max-height: 80vh; overflow-y: auto;
    position: relative; box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.close-modal {
    position: absolute; right: 20px; top: 15px; font-size: 28px; cursor: pointer; color: #888;
}
.close-modal:hover { color: #333; }

.image-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 15px;
}
.library-item {
    cursor: pointer; border: 2px solid transparent; border-radius: 4px; overflow: hidden;
    transition: border-color 0.2s, transform 0.2s; background: #f8f9fa;
}
.library-item:hover { border-color: #007bff; transform: scale(1.05); }
.library-item img { width: 100%; height: 120px; object-fit: contain; display: block; }

/* Nowy układ wiersza kreatora */
.row-preview { width: 60px; height: 60px; object-fit: contain; background: #eee; border-radius: 4px; border: 1px solid #ddd; }
.row-actions { display: flex; flex-direction: column; gap: 8px; flex: 2; }
.file-input { font-size: 12px; }

/* --- SUROWY / SYSTEMOWY INTERFEJS --- */
* {
    border-radius: 0 !important; /* Usuwamy wszystkie zaokrąglenia */
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
    color: #111;
    background-color: #f4f4f4;
}

/* Surowe przyciski systemowe */
.system-btn {
    background: transparent;
    color: #111;
    border: 1px solid #111;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 11px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.1s;
}

.system-btn:hover:not(:disabled) {
    background: #111;
    color: #fff;
}

.system-btn:disabled {
    border-color: #ccc;
    color: #aaa;
    cursor: not-allowed;
}

/* Surowe bloki danych */
.raw-panel {
    background: #fff;
    border: 1px solid #ccc;
    padding: 15px;
    margin-bottom: 15px;
}

.raw-header {
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    border-bottom: 1px solid #111;
    padding-bottom: 5px;
    margin-bottom: 15px;
}