* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body, html {
  height: 100%;
  min-height: 100vh;
  overflow-y: auto;
}

body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  background-color: #f5f5f5;
  color: #333;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0;
  margin: 0;
}

/* Modernizirani header */
.header {
  padding: 1.5rem;
  background: linear-gradient(135deg, #1976d2, #0d47a1);
  color: white;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  position: relative;
}

.header h1 {
  margin: 0;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.header h1 i {
  font-size: 2rem;
}

.header .copyright {
  display: none;
}

.toolbar {
  padding: 5px 10px;
  background-color: #f5f5f5;
  border-bottom: 1px solid #ddd;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Poboljšani raspored za bolji prikaz crteža */
.content-area {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
}

/* Poboljšani kontejner za crtež */
.drawing-container {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
  padding: 10px;
}

/* Optimizirano područje za crtež */
.drawing-area {
  width: 100%;
  height: 100%;
  position: relative;
  background-color: #fff;
  border-radius: 8px;
}

/* Poboljšani prikaz canvasa */
#drawingCanvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  max-height: 100%;
}

/* Smanjenje panela za dimenzije */
.dimensions-panel {
  width: 260px;
  background-color: white;
  padding: 0.8rem;
  border-left: 1px solid #ddd;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.dimensions-list {
  flex: 1;
  overflow-y: auto;
}

.main-content {
  margin-top: 18px !important;
  margin-bottom: 0 !important;
  padding: 0 0 0 0 !important;
}

canvas {
  cursor: crosshair;
  max-width: 100%;
  display: block;
}

.dimension-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  border-bottom: 1px solid #eee;
}

.dimension-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background-color: #e53935;
  color: white;
  border-radius: 50%;
  margin-right: 0.5rem;
  font-size: 12px;
}

/* Modernizacija gumba */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.btn i {
  font-size: 0.9em;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn-primary {
  background-color: #1976d2;
  color: white;
}

.btn-danger {
  background-color: #e53935;
  color: white;
}

.btn-info {
  background-color: #0288d1;
  color: white;
}

.btn-success {
  background-color: #388e3c;
  color: white;
}

.btn-secondary {
  background-color: #757575;
  color: white;
}

.btn-warning {
  background-color: #f0ad4e;
  color: white;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

/* Modernizirani dijalog */
.dialog-content {
  background-color: white;
  padding: 1.5rem;
  border-radius: 8px;
  width: 400px;
  max-width: 90%;
  box-shadow: 0 5px 20px rgba(0,0,0,0.2);
  overflow: hidden;
}

.dialog-content h3 {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-group {
  margin-bottom: 1rem;
}

.input-group label {
  display: block;
  margin-bottom: 0.5rem;
}

.input-group input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* NOVO: Stilizacija select elementa identično kao input polje */
.input-group select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  appearance: auto; /* Omogućava prikaz strelice za padajući izbornik */
  background-color: #fff; /* Bijela pozadina */
  cursor: pointer; /* Promjena pokazivača u pokazivač */
  height: auto; /* Automatska visina */
}

/* Omogućavanje skrolanja točkićem miša preko padajućeg izbornika */
.input-group select:hover {
  overflow-y: auto;
}

/* Fokus stil za select element kao i za input polje */
.input-group select:focus {
  outline: none;
  border-color: #1976d2;
}

.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

#instructionOverlay {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: white;
  padding: 0.5rem;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-size: 14px;
  opacity: 0.8;
  display: none;
}

.no-dimensions {
  color: #757575;
  font-style: italic;
}

.symbols-container {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
  max-width: 100%;
}

.symbol-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 18px;
  cursor: pointer;
  position: relative;
}

.symbol-btn:hover {
  background-color: #e0e0e0;
}

/* Stilizacija tooltip-ova */
.symbol-btn[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 10px;
  background-color: #333;
  color: white;
  font-size: 12px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  margin-bottom: 5px;
}

/* Trokutić ispod tooltip-a */
.symbol-btn[title]:hover::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
  margin-bottom: 0;
  z-index: 100;
  pointer-events: none;
}

/* Za simbole koji su zapravo tekst (Ra, Rt, Rz) */
.symbol-btn[data-symbol="Ra"],
.symbol-btn[data-symbol="Rt"],
.symbol-btn[data-symbol="Rz"] {
  font-size: 14px;
  font-weight: bold;
}

.symbols-heading {
  margin-top: 15px;
  margin-bottom: 8px;
  font-weight: bold;
  color: #555;
  font-size: 14px;
}

/* Modernizacija gumba za uređivanje */
.btn-edit, .btn-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 3px 6px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.btn-edit {
  color: #1976d2;
}

.btn-edit:hover {
  background-color: #e3f2fd;
}

.btn-remove {
  color: #e53935;
}

.btn-remove:hover {
  background-color: #ffebee;
}

.footer {
  background-color: #f5f5f5;
  border-top: 1px solid #ddd;
  padding: 0.8rem;
  text-align: center;
  font-size: 0.85rem;
  color: #777;
}

.footer a {
  color: inherit;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Stilovi za vlastite tolerancije */
.custom-tolerances-section {
  margin-top: 20px;
  border-top: 1px solid #ddd;
  padding-top: 15px;
}

.custom-tolerances-section h4 {
  margin-bottom: 10px;
  color: #555;
}

.add-tolerance-btn {
  background-color: #e8f5e9;
  border: 1px solid #a5d6a7;
  color: #2e7d32;
}

.add-tolerance-btn:hover {
  background-color: #c8e6c9;
}

.custom-tolerance-btn {
  position: relative;
  padding-right: 25px;
}

.remove-tolerance-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #e53935;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.remove-tolerance-btn:hover {
  background-color: #ffcdd2;
}

@media (max-width: 768px) {
  .app-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  
  .content-area {
    flex-direction: column;
  }
  
  .dimensions-panel {
    width: 100%;
    height: 300px;
    border-left: none;
    border-top: 1px solid #ddd;
  }
}

/* Stilovi za upload zonu */
.upload-zone {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #ccc;
  border-radius: 8px;
  background-color: #f9f9f9;
  transition: all 0.3s ease;
}

.upload-zone.dragover {
  background-color: #e3f2fd;
  border-color: #1976d2;
}

.upload-content {
  text-align: center;
  padding: 20px;
}

.upload-content i {
  font-size: 48px;
  color: #1976d2;
  margin-bottom: 15px;
}

.upload-content h3 {
  margin-bottom: 10px;
  color: #333;
}

.upload-content p {
  color: #666;
  margin-bottom: 20px;
}

/* Moderni kalkulator */
.calc-display-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.calc-display {
  width: 100%;
  font-size: 1.25rem;
  padding: 8px 12px;
  border: 1.5px solid #1976d2;
  border-radius: 6px;
  background: #f5faff;
  color: #1976d2;
  font-weight: bold;
  outline: none;
  transition: border 0.2s;
}
.copy-btn {
  background: #e3f2fd;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  color: #1976d2;
  font-size: 1.1em;
  transition: background 0.2s;
}
.copy-btn:hover {
  background: #bbdefb;
}
.calc-buttons {
  display: grid;
  grid-template-columns: repeat(4, 48px);
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}
.calc-btn {
  background: #1976d2;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 12px 0;
  cursor: pointer;
  transition: background 0.2s;
  box-shadow: 0 2px 8px rgba(25,118,210,0.08);
}
.calc-btn:hover {
  background: #0d47a1;
}
.calc-btn-equal {
  grid-column: span 4;
  background: #388e3c;
  color: #fff;
}
.calc-btn-equal:hover {
  background: #1b5e20;
}
@media (max-width: 600px) {
  .calc-buttons {
    grid-template-columns: repeat(4, 1fr);
  }
}
.btn-active {
  outline: 2px solid #1976d2;
  box-shadow: 0 0 0 2px #90caf9;
}
.canvas-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(255,255,255,0.97);
  border: 1px solid #1976d2;
  border-radius: 6px;
  padding: 4px 10px 4px 8px;
  font-size: 13px;
  color: #1976d2;
  box-shadow: 0 2px 8px rgba(25,118,210,0.08);
  display: flex;
  align-items: center;
  gap: 7px;
  z-index: 10;
  min-width: 0;
  white-space: nowrap;
  opacity: 0.95;
  transition: opacity 0.15s;
}
.lang-btn.lang-active {
  border: 2px solid #1976d2 !important;
  border-radius: 6px;
  background: #e3f2fd;
}
.lang-btn img {
  display: block;
}
.features-section {
  background: none !important;
  padding: 0 !important;
  margin: 40px 0 0 0 !important;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto 40px auto;
}

.feature-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(25,118,210,0.10);
  padding: 2.2rem 1.5rem 2rem 1.5rem;
  text-align: center;
  border: 2px solid #1976d2;
  transition: transform 0.18s, box-shadow 0.18s, border 0.18s;
  min-width: 0;
  max-width: 340px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.feature-card:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 8px 32px rgba(25,118,210,0.18);
  border-color: #0d47a1;
}
.feature-card i {
  font-size: 2.5rem;
  color: #1976d2;
  margin-bottom: 14px;
}
.feature-card h3 {
  color: #1976d2;
  font-size: 1.18rem;
  margin-bottom: 10px;
  font-weight: 700;
}
.feature-card p {
  color: #444;
  font-size: 0.97rem;
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }
}
@media (max-width: 600px) {
  .features-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .feature-card {
    padding: 1.2rem 0.7rem 1.2rem 0.7rem;
  }
}
/* Dodaj u styles.css ili u <style> tag */
@media (max-width: 1200px) {
  #podaciModal .dialog-content {
    max-width: 98vw !important;
    min-width: 0 !important;
  }
}
/* Dodaj na kraj styles.css */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  z-index: 1000;
  min-width: 200px;
  margin-top: 5px;
}

.dropdown-item {
  display: block;
  padding: 8px 15px;
  color: #333;
  text-decoration: none;
  transition: background 0.2s;
}

.dropdown-item:hover {
  background: #f5f5f5;
}

.dropdown-item i {
  font-size: 0.5em;
  margin-right: 8px;
  vertical-align: middle;
}

/* Navigacijske kontrole za manipulaciju crtežem */
.navigation-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: grid;
  grid-template-columns: repeat(3, 30px);
  grid-template-rows: repeat(3, 30px);
  gap: 2px;
  z-index: 100;
}

.move-btn {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: 1px solid #ccc;
  background-color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.move-btn:hover {
  background-color: rgba(230, 230, 230, 0.9);
}

.move-left { grid-column: 1; grid-row: 2; }
.move-right { grid-column: 3; grid-row: 2; }
.move-up { grid-column: 2; grid-row: 1; }
.move-down { grid-column: 2; grid-row: 3; }
.reset-view { grid-column: 2; grid-row: 2; }
/* NOVO: Stilovi za prikaz mjernog alata u listi dimenzija */
.mjerni-alat-info {
  font-size: 0.85em;
  color: #666;
  margin-top: 3px;
  font-style: italic;
}

.mjerni-alat-info i {
  margin-right: 5px;
  color: #1976d2;
}

.mjerni-alat-text {
    color: #6c757d;
    font-style: italic;
    margin-top: 2px;
    display: block;
  }
  
  .mjerni-alat-text i {
    margin-right: 4px;
    color: #007bff;
  }
/* Keyboard shortcuts tooltip styling */
.keyboard-shortcuts-tooltip {
  font-size: 14px;
  color: #1976d2;
  margin-left: 5px;
  cursor: help;
  transition: color 0.2s;
}

.keyboard-shortcuts-tooltip:hover {
  color: #0d47a1;
}