/* ============================================================
   RzutOka – style.css
   Modern, Monochromatic Minimalist Theme (Single Accent)
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
  --bg:               #f0f0f0;
  --bg-2:             #ffffff;
  --surface:          #ffffff;
  --surface-hover:    #f5f5f5;
  
  --border:           #e0e0e0;
  --border-strong:    #000000;

  --text:             #000000;
  --text-muted:       #666666;
  --text-dim:         #999999;

  --accent:           #0055ff;
  --accent-soft:      rgba(0, 85, 255, 0.1);

  --panel-w:          280px;
  --radius:           0px;
  --radius-sm:        0px;
  --radius-xs:        0px;

  --ease:             cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur:              0.25s;
}

/* ---- Reset ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input {
  font-family: inherit;
  border-radius: 0;
}
button {
  cursor: pointer;
}

/* Grayscale for all emojis to keep it monochromatic */
.panel-logo, .tool-icon, .method-icon, .upload-icon, .drop-icon, .action-btn span[aria-hidden="true"] {
  filter: grayscale(100%);
  opacity: 0.8;
}

/* ---- App Layout ---- */
#app {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* ============================================================
   PANEL
   ============================================================ */
#panel {
  width: var(--panel-w);
  min-width: var(--panel-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  z-index: 20;
  overflow-y: auto;
  overflow-x: hidden;
  transition: margin-left 0.3s var(--ease);
}

#panel.collapsed {
  margin-left: calc(-1 * var(--panel-w));
}

#panel::-webkit-scrollbar { width: 3px; }
#panel::-webkit-scrollbar-track { background: transparent; }
#panel::-webkit-scrollbar-thumb { background: var(--border-strong); }

/* ---- Panel Header ---- */
.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 2px solid var(--border-strong);
  flex-shrink: 0;
}
.panel-logo { font-size: 20px; opacity: 1; }
.panel-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}

/* ---- Panel Sections ---- */
.panel-section {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}
.panel-section--bottom {
  margin-top: auto;
  border-bottom: none;
  border-top: 1px solid var(--border);
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 4px;
}

/* ---- Reference block ---- */
.ref-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ref-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ref-input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 12px;
  transition: all var(--dur) var(--ease);
  -moz-appearance: textfield;
}
.ref-input:focus {
  outline: none;
  border-color: var(--text);
  background: var(--surface);
}
.ref-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ref-unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ---- Reference Status Badge ---- */
.ref-status {
  display: none !important;
}

.hidden {
  display: none !important;
}

.measure-count {
  padding: 12px 20px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.measure-count #measure-count-num {
  color: var(--text);
  font-weight: 700;
}

/* ============================================================
   BUTTONS (Modern / Monochromatic)
   ============================================================ */

.tool-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: all var(--dur) var(--ease);
  overflow: hidden;
}
.tool-btn > * { position: relative; z-index: 1; }
.tool-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

/* Aktywne narzędzie podświetlone jedynym kolorem w aplikacji */
.tool-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,85,255,0.25);
}
/* By ikona też była na biało w aktywnym przycisku */
.tool-btn.active .tool-icon {
  filter: brightness(0) invert(1); 
  opacity: 1;
}

.tool-btn.state-ref-dim,
.tool-btn.state-ref-area {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border-strong);
}

.tool-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.tool-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* ---- Label size A- / A+ row ---- */
.label-size-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}
.size-btn {
  flex: 1;
  position: relative;
  padding: 9px 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.5px;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  overflow: hidden;
}
.size-btn:hover {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}
.size-btn:active {
  transform: scale(0.96);
}
.size-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.label-size-val {
  flex: 0 0 30px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* ---- Action Buttons ---- */
.action-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: all var(--dur) var(--ease);
  overflow: hidden;
}
.action-btn > * { position: relative; z-index: 1; }
.action-btn:hover:not(:disabled) {
  background: var(--text);
  color: var(--surface);
}
.action-btn:hover:not(:disabled) span[aria-hidden="true"] {
  filter: brightness(0) invert(1);
}
.action-btn:disabled {
  opacity: 0.3;
  border-color: var(--border);
  cursor: not-allowed;
}

/* ============================================================
   CANVAS AREA
   ============================================================ */
#canvas-area {
  flex: 1;
  position: relative;
  background: var(--bg);
  background-image:
    linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
}

#upload-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--bg);
}
.upload-hint-inner {
  text-align: center;
  padding: 50px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(0,0,0,0.03);
  max-width: 440px;
  width: 100%;
  transition: all 0.3s var(--ease);
}
#upload-hint:hover .upload-hint-inner {
  border-color: var(--text);
}
.upload-icon {
  font-size: 42px;
  margin-bottom: 20px;
}
.upload-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 8px;
}
.upload-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 30px;
}
.upload-methods {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 30px;
}
.upload-method {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.upload-formats { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }

#main-canvas { position: absolute; top: 0; left: 0; display: block; }
#main-canvas.hidden { display: none; }
#main-canvas.cur-default    { cursor: default; }
#main-canvas.cur-crosshair  { cursor: crosshair; }
#main-canvas.cur-grab       { cursor: grab; }
#main-canvas.cur-grabbing   { cursor: grabbing; }
#main-canvas.cur-pointer    { cursor: pointer; }
#main-canvas.cur-move       { cursor: move; }
#main-canvas.cur-cell       { cursor: cell; }
#main-canvas.cur-eraser     { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M20 20H7L3 16C2.2 15.2 2.2 13.8 3 13L13 3L21 11L11 21Z M17 17H21' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M20 20H7L3 16C2.2 15.2 2.2 13.8 3 13L13 3L21 11L11 21Z' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M17 17H21' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 3 16, auto; }
#main-canvas.cur-eraser-hover { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M20 20H7L3 16C2.2 15.2 2.2 13.8 3 13L13 3L21 11L11 21Z M17 17H21' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M20 20H7L3 16C2.2 15.2 2.2 13.8 3 13L13 3L21 11L11 21Z' fill='%23ff4d4d' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M17 17H21' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 3 16, auto; }

#drop-overlay {
  position: fixed; inset: 0; background: rgba(255, 255, 255, 0.95);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  border: 4px solid var(--accent);
}
#drop-overlay.hidden { display: none; }
.drop-overlay-inner { text-align: center; color: var(--text); }
.drop-icon { font-size: 64px; margin-bottom: 20px; }
.drop-overlay-inner p { font-size: 24px; font-weight: 700; text-transform: uppercase; }

.tool-tip {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--surface);
  padding: 10px 20px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px;
  pointer-events: none; z-index: 100; transition: opacity 0.2s var(--ease);
}
.tool-tip.hidden { display: none; }

.zoom-indicator {
  position: fixed; bottom: 30px; right: 30px;
  background: var(--surface); border: 1px solid var(--border-strong);
  padding: 8px 12px; font-size: 12px; font-weight: 700;
  color: var(--text); pointer-events: none; z-index: 100; transition: opacity 0.3s ease;
}
.zoom-indicator.hidden { display: none; }

.ctx-menu {
  position: fixed; z-index: 500;
  background: var(--surface); border: 1px solid var(--border-strong);
  padding: 0; min-width: 180px;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
}
.ctx-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px 16px; font-size: 13px; font-weight: 600;
  color: var(--text); cursor: pointer; border: none; background: transparent; text-align: left;
}
.ctx-menu-item:hover { background: var(--text); color: var(--surface); }

#file-input { display: none; }

/* ---- Ripple animation ---- */
@keyframes ripple-burst {
  0%   { transform: scale(0); opacity: 0.2; }
  100% { transform: scale(4.5); opacity: 0; }
}
.ripple {
  position: absolute; border-radius: 50%;
  background: currentColor;
  pointer-events: none; animation: ripple-burst 0.5s var(--ease) forwards; z-index: 0;
  width: 40px; height: 40px; margin-left: -20px; margin-top: -20px;
}

#floating-ref-input {
  position: absolute;
  z-index: 150;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 10px;
  border: 1.5px solid #e07000;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(224, 112, 0, 0.15);
  outline: none;
  width: 90px;
  text-align: center;
}
#floating-ref-input::-webkit-outer-spin-button,
#floating-ref-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
#floating-ref-input[type=number] {
  -moz-appearance: textfield;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}
.modal.hidden {
  display: none !important;
}
.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
}
.modal-content {
  position: relative;
  background: #ffffff;
  color: #000000;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  color: #666666;
  cursor: pointer;
  z-index: 10;
}
.modal-close:hover {
  color: #000000;
}
.modal-tabs {
  display: flex;
  border-bottom: 1px solid #eeeeee;
  background: #f8f9fa;
}
.tab-btn {
  flex: 1;
  padding: 15px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-weight: 600;
  color: #666666;
  transition: all 0.2s;
  font-family: inherit;
  font-size: 14px;
}
.tab-btn:hover {
  color: #000000;
  background: rgba(0,0,0,0.02);
}
.tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  background: #ffffff;
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  color: #333333;
  line-height: 1.6;
}
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}
.tab-pane h3 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #000000;
}
.tab-pane ol, .tab-pane ul {
  padding-left: 20px;
  margin-bottom: 0;
}
.tab-pane li {
  margin-bottom: 10px;
}
.tab-pane p {
  margin-bottom: 15px;
}
.tab-pane a {
  color: #2563eb;
  text-decoration: none;
}
.tab-pane a:hover {
  text-decoration: underline;
}

/* Splash Screen */
#splash-screen {
  position: fixed;
  inset: 0;
  background-color: #ffffff;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#splash-screen.hidden-splash {
  opacity: 0;
  visibility: hidden;
}

.splash-title {
  font-family: 'Outfit', sans-serif;
  font-size: 4rem;
  font-weight: 800;
  color: #000000;
  margin: 0 0 10px 0;
  letter-spacing: -0.02em;
}

.splash-subtitle {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 400;
  color: #666666;
  margin: 0;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
