/* === ZÁKLADNÍ NASTAVENÍ === */
:root {
  --primary-color: #4A90E2;
  --primary-hover: #357ABD;
  --danger-color: #E74C3C;
  --success-color: #27AE60;
  --warning-color: #F39C12;
  --text-dark: #2C3E50;
  --text-light: #7F8C8D;
  --bg-light: #F8F9FA;
  --border-color: #E1E8ED;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --header-height: 70px;
  --sidebar-width: 280px;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;              /* ZMĚNA: z min-height na height */
  overflow: hidden;           /* PŘIDÁNO: zakáže scroll na body */
  background-color: #fff;
  color: var(--text-dark);
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
}

button {
  font-family: inherit;
}

/* === HLAVIČKA === */
.main-header {
  position: fixed;
  top: 0;
  z-index: 1000;
  background: white;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  height: var(--header-height);
  width: 100%;
}

.main-header > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  height: 100%;
  max-width: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 0 0 auto;
  width: 280px;
  height: 100%;
  background-size: contain;
  background-position-x: left;
  background-position-y: center;
  background-repeat: no-repeat;
  margin-left: 10px;
  text-decoration: none;
  cursor: pointer;
}

.header-left h2 {
  font-size: 1.25rem;
  color: var(--text-dark);
  white-space: nowrap;
}

/* Progress bar v hlavičce */
.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 20px;
  min-width: 0;
}

.progress-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 600px;
}

.nav-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.nav-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Buy button v headeru - jemnější verze */
.buy-btn-header {
  /* Původní gradient zachován */
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  /* Zpomalení animace na 3s pro klidnější efekt */
  animation: pulse-soft 3s ease-in-out infinite;
}

.buy-btn-header:hover {
  /* Stejný gradient jako v základu (sjednocení) */
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  animation: none;
  /* Ponechán pouze pohyb pro interakci */
  transform: translateY(-1px) scale(1.05);
}

@keyframes pulse-soft {
  0%, 100% {
    /* Menší počáteční opacity (0.3 místo 0.4) */
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.3);
  }
  50% {
    /* Menší rozptyl stínu (6px místo 8px) */
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0);
  }
}

.progress-container {
  flex: 1;
  min-width: 200px;
}

.progress-text {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-dark);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-line {
  position: relative;
  height: 6px;
  background-color: #E9ECEF;
  border-radius: 3px;
}

.progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--primary-color), #5BA3F5);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-steps {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  transform: translateY(-50%);
  padding: 0 2px;
}

.progress-step {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: white;
  border: 2px solid #CED4DA;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transform-origin: center center; /* Zajistí růst ze středu */
}

.progress-step:hover {
  transform: scale(1.3);
  box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.15);
  border-color: var(--primary-color);
}

.progress-step.disabled {
  cursor: not-allowed;
  opacity: 0.4;
  background-color: #f0f0f0;
  border-color: #d0d0d0;
}

.progress-step.disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: #d0d0d0;
}

.progress-step.active,
.progress-step.current {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.progress-step.active:hover,
.progress-step.current:hover {
  transform: scale(1.3);
  box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.3);
}

/* Uživatelská sekce */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 1 auto;
  min-width: 0;
  position: relative;
}

/* Hamburger — hidden on desktop */
.hamburger-btn {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.hamburger-icon {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-dark);
  position: relative;
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-dark);
  position: absolute;
  left: 0;
}

.hamburger-icon::before { top: -6px; }
.hamburger-icon::after { top: 6px; }

#userSection {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  min-width: 0;
  flex-wrap: nowrap;
}

#userSection > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  flex-shrink: 1;
  min-width: 0;
}

#userSection > form {
  flex-shrink: 0;
}

#projectSelector {
  position: relative;
  flex-shrink: 0;
}

#projectBtn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-light);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  min-width: 80px;
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#projectBtn:hover {
  border-color: var(--primary-color);
  background: white;
}

#projectList {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  list-style: none;
  margin: 0;
  padding: 8px 0;
  min-width: 200px;
  z-index: 1000;

}

#projectList li {
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
}

#projectList li:hover {
  background: var(--bg-light);
}

.btn-link {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.btn-link:hover {
  color: var(--primary-hover);
}

.btn-link:hover span {
  text-decoration: underline;
}

.btn-logout {
  background: var(--bg-light);
  color: var(--text-dark);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: var(--danger-color);
  color: #fff;
  border-color: var(--danger-color);
}

/* Submit tlačítka v hlavičce */
.submit-container {
  display: flex;
  gap: 12px;
  align-items: center;
}

.preview-button,
.buy-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.preview-button {
  background: white;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

.preview-button:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.buy-button {
  background: var(--primary-color);
  color: white;
}

.buy-button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.button-icon {
  font-size: 18px;
}

.button-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.button-text-main {
  font-weight: 600;
}

.button-text-sub {
  font-size: 11px;
  opacity: 0.8;
}

/* === LAYOUT === */
.layout-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - var(--header-height));
  margin-top: var(--header-height);  /* PŘIDÁNO: odsazení od fixed hlavičky */
}

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-width);
  min-width: 200px;
  max-width: 50vw;
  background: var(--bg-light);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;           /* ZMĚNA: z hidden na auto */
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  background: white;
  flex-shrink: 0;
}

.sidebar-header h2 {
  font-size: 1.1rem;
  margin: 0;
}

.sidebar h2 {
  font-size: 1.1rem;
  padding: 8px 16px;
  margin: 0;
  border-bottom: 1px solid var(--border-color);
  background: white;
  flex-shrink: 0;
}

.upload-form {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  background: white;
  flex-shrink: 0;
}

.upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.upload-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.upload-counter {
  display: inline;
  font-size: 0.8rem;
  color: var(--text-light);
  font-weight: normal;
  margin-left: 8px;
  white-space: nowrap;
}

.upload-counter--full {
  color: #c0392b;
  font-weight: bold;
}

.photo-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  padding: 12px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;              /* DŮLEŽITÉ: bez toho flex nefunguje správně */
  align-content: start;
}

.photo-list::-webkit-scrollbar {
  width: 8px;
}

.photo-list::-webkit-scrollbar-track {
  background: transparent;
}

.photo-list::-webkit-scrollbar-thumb {
  background: #CED4DA;
  border-radius: 4px;
}

.photo-list::-webkit-scrollbar-thumb:hover {
  background: #ADB5BD;
}

.galerie-foto-wrapper {
  position: relative;
  margin-bottom: 0;
  border-radius: var(--radius-sm);
}

.galerie-foto {
  display: block;
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
}

.galerie-foto img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.galerie-foto:hover img {
  transform: scale(1.05);
}

.galerie-foto:hover::after {
  content: "Přidat nový výřez";
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 12px;
  font-weight: 500;
  transition: opacity 0.25s ease;
  pointer-events: none;
  padding: 8px;
  text-align: center;
}

/* Kolečko s nůžkami */
.galerie-foto::before {
  content: "✂️";
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(74, 144, 226, 0.65);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Proužek s textem */
.galerie-foto::after {
  content: "Přidat výřez";
  position: absolute;
  bottom: 9px;
  left: 24px;
  background: rgba(74, 144, 226, 0.65);
  color: white;
  padding: 1px 10px;
  border-radius: 14px;
  font-size: 10px;
  line-height: 20px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
}

.galerie-foto:hover::after {
  display: flex;
}

.delete-source-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--danger-color);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s;
  z-index: 10;
  opacity: 1;
}

.galerie-foto-wrapper:hover .delete-source-btn {
  opacity: 1;
}

.delete-source-btn:hover {
  background: var(--danger-color);
  color: white;
  transform: scale(1.1);
}

/* === RESIZER (posuvná hranice) === */
.resizer {
  width: 12px;
  background: var(--bg-light);
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  flex-shrink: 0;
  user-select: none;
  position: relative;
}

.resizer-buttons {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.resizer-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s ease;
  padding: 0;
}

.resizer-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: scale(1.1);
}

.resizer-btn:active {
  transform: scale(0.95);
}

.resizer-handle {
  width: 4px;
  height: 40px;
  background: var(--border-color);
  border-radius: 2px;
  margin: 4px 0;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-light);
  min-width: 300px;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;              /* PŘIDÁNO: důležité pro flex children */
}

.main-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-color);
  background: white;
  flex-shrink: 0;
  box-sizing: border-box;
}

.main-header-bar h2 {
  font-size: 1.1rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}


.crop-count {
  background: var(--primary-color);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  min-width: 24px;
  text-align: center;
}

.main-content::-webkit-scrollbar {
  width: 10px;
}

.main-content::-webkit-scrollbar-track {
  background: transparent;
}

.main-content::-webkit-scrollbar-thumb {
  background: #CED4DA;
  border-radius: 5px;
}

.main-content::-webkit-scrollbar-thumb:hover {
  background: #ADB5BD;
}

/* === GRID VÝŘEZŮ === */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px;
}

.crop-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: white;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  cursor: grab;
}

.crop-card.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.crop-card.drag-over {
  border: 2px dashed var(--primary-color);
  transform: scale(1.02);
}

.crop-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.crop-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: var(--bg-light);
}

.crop-card .info {
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: white;
  border-top: 1px solid var(--border-color);
}

.crop-name {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.crop-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
}

.crop-name input {
  flex: 1;
  padding: 4px 8px;
  font-size: 14px;
  border: 1px solid var(--primary-color);
  border-radius: 4px;
  outline: none;
}

.btn-edit-name {
  font-size: 16px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 1;
  padding: 4px;
  transition: opacity 0.2s ease;
  color: var(--text-light);
}


.btn-edit-name:hover {
  color: var(--primary-color);
}

.actions {
  display: flex;
  gap: 4px;
}

.actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  transition: all 0.2s ease;
  color: var(--text-light);
}

.actions button:hover {
  transform: scale(1.1);
}

.btn-edit-crop:hover {
  color: var(--primary-color);
}

.delete-btn:hover {
  color: var(--danger-color);
}

/* Editovací stav */
.crop-card.editing {
  position: relative;
  z-index: 10;
  box-shadow: var(--shadow-lg);
  transform: scale(1.02);
}

body.dimmed::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 5;
  backdrop-filter: blur(2px);
}

.crop-card.editing .actions {
  opacity: 0;
  pointer-events: none;
}

/* === FOOTER === */
.footer-debug {
  position: fixed;
  bottom: 12px;
  left: 12px;
  background: rgba(44, 62, 80, 0.85);
  color: rgba(255, 255, 255, 0.7);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  z-index: 9998;
  backdrop-filter: blur(10px);
}

.footer-debug p {
  margin: 0;
}

/* FAB Contact button */
.fab-contact {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

.fab-contact:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* === STEP 3 DROPZONE === */
.step3-dropzone {
  display: block;
  border: 3px dashed var(--primary-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  margin-bottom: 30px;
  background: var(--bg-light);
  cursor: pointer;
  transition: all 0.3s ease;
}

.step3-dropzone-icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.step3-dropzone-title {
  text-align: center;
  font-size: 1.8rem;
  margin: 0 0 20px 0;
  color: var(--text-dark);
}

.step3-dropzone-desc {
  text-align: center;
  font-size: 1.1rem;
  margin: 0 0 25px 0;
  opacity: 0.95;
  color: var(--text-dark);
}

.step3-dropzone-hint {
  color: var(--text-light);
  font-size: 0.95rem;
}

.step3-continue-cta {
  margin-top: 28px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 28px;
  background: var(--primary-color);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.step3-continue-cta:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: var(--primary-color-dark, var(--primary-color));
}
.step3-continue-main {
  font-size: 1.1rem;
  font-weight: 600;
}
.step3-continue-sub {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* === DROPZONE === */
.dropzone {
  max-width: 600px;
  margin: 40px auto;
  padding: 60px 30px;
  border: 3px dashed var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-light);
  text-align: center;
  font-size: 1.1rem;
  color: var(--text-light);
  transition: all 0.25s ease;
  cursor: pointer;
}

.dropzone:hover {
  background: white;
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.dropzone.dragover {
  background: #E3F2FD;
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

/* === POPUP === */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.popup-content {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 90%;
  max-height: 90%;
  width: 900px;
  overflow: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  padding: 30px;
}

.popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 24px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-light);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.popup-close:hover {
  background: var(--bg-light);
  color: var(--danger-color);
}

/* === FLASH MESSAGES === */
.flash-messages {
  position: fixed;
  top: calc(var(--header-height) + 20px);
  right: 20px;
  z-index: 10001;
  max-width: 400px;
}

.alert {
  padding: 16px 40px 16px 16px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  position: relative;
  animation: slideIn 0.3s ease-out;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.alert-warning {
  background: #FFF3CD;
  border-left: 4px solid var(--warning-color);
  color: #856404;
}

.alert-error {
  background: #F8D7DA;
  border-left: 4px solid var(--danger-color);
  color: #721C24;
}

.alert-success {
  background: #D4EDDA;
  border-left: 4px solid var(--success-color);
  color: #155724;
}

.alert-info {
  background: #D1ECF1;
  border-left: 4px solid #17A2B8;
  color: #0C5460;
}

.alert-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0;
  width: 20px;
  height: 20px;
  line-height: 1;
  transition: opacity 0.2s;
}

.alert-close:hover {
  opacity: 1;
}

.alert.fade-out {
  animation: fadeOut 0.3s ease-out forwards;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateX(400px);
  }
}

/* === UTILITY CLASSES === */
.hidden {
  display: none !important;
}

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

.text-center {
  text-align: center;
}

.muted {
  color: var(--text-light);
  font-size: 14px;
  padding: 20px;
  text-align: center;
}

/* Disabled stav */
button.disabled,
button:disabled {
  opacity: 0.5;
  cursor: not-allowed !important;
  background-color: #ADB5BD !important;
  border-color: #ADB5BD !important;
}

button.disabled:hover,
button:disabled:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* === PDF LOADING OVERLAY === */
.pdf-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 999999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.pdf-loading-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.pdf-loading-overlay .pdf-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--bg-light, #e5e7eb);
  border-top-color: var(--primary-color, #2563eb);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.pdf-loading-overlay .pdf-loading-text {
  font-size: 1.05rem;
  color: var(--text-color, #333);
  font-weight: 500;
}

/* === LOADING STATE === */
.uploading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  padding: 20px;
}

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

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.uploading p {
  margin: 0;
  color: var(--primary-color);
  font-weight: 500;
}

/* === ANIMACE === */
@keyframes highlight-pulse {
  0%, 100% {
    box-shadow: var(--shadow-sm);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 20px 5px rgba(74, 144, 226, 0.6);
    transform: scale(1.03);
  }
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    padding: 16px;
  }
}


/* === DESKTOP REŽIM (>1100px) === */
@media (min-width: 1101px) {
  .sidebar {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    grid-template-columns: unset !important;
    grid-template-rows: unset !important;
  }

  .sidebar > h2 {
    grid-column: unset;
    grid-row: unset;
    width: 100%;
  }

  .sidebar > .upload-form {
    grid-column: unset;
    grid-row: unset;
    width: 100%;
  }

  .photo-list {
    grid-column: unset;
    grid-row: unset;
  }

  /* Oprava pozice resizer tlačítek pro desktop */
  .resizer-buttons {
    position: absolute !important;  /* z fixed na absolute */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);  /* vystředění */
  }
}

@media (max-width: 1100px) {
  :root {
    --header-height: auto;
  }

  .hide-mobile {
    display: none;
  }

  html, body {
    height: 100%;
    overflow: hidden;
  }

  .main-header {
    position: relative;       /* ZMĚNA: z fixed na relative */
  }

  .main-header > div {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 6px;
  }

  .header-left {
    flex: 1;              /* ZMĚNA: flex místo width 100% */
    min-width: 0;         /* umožní zmenšení */
    order: 1;
    height: 50%;
    margin-left: 2px;
  }

  .header-left h2 {
    font-size: 1.1rem;
  }

  .header-right {
    flex: 0 0 auto;
    order: 2;
  }

  .hamburger-btn {
    display: flex;
  }

  .user-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: 12px 16px;
    z-index: 1100;
    min-width: 220px;
  }

  .user-menu.open {
    display: block;
  }

  .user-menu #userSection {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* Na mobilu: project button jako ikonka bez textu */
  #projectBtn {
    width: 36px;
    height: 36px;
    min-width: unset;
    max-width: unset;
    padding: 0;
    justify-content: center;
  }

  #projectBtn .project-btn-text {
    display: none;
  }

  .header-center {
    order: 3;             /* pod header-left a header-right */
    width: 100%;          /* přes celou šířku */
    flex-basis: 100%;     /* PŘIDÁNO: vynutí nový řádek */
    padding: 4px 0 0 0;
    border-top: 1px solid var(--border-color);
  }

  .progress-wrapper {
    max-width: 100%;
  }

  .progress-text {
    font-size: 12px;
  }

  .crop-card{
  position:relative}

  .crop-card .btn-edit-crop{
    position: absolute;
    bottom: 57px;
    right: 45px;
    display: flex;
    gap: 6px;
    background: rgba(255, 255, 255, 0.55);
    padding: 4px 6px;
    border-radius: 6px;
}

  .crop-card .delete-btn {
    position: absolute;
    bottom: 57px;
    right: 3px;
    display: flex;
    gap: 6px;
    background: rgba(255, 255, 255, 0.55);
    padding: 4px 6px;
    border-radius: 6px;
}

  .nav-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }


  #userSection {
    font-size: 13px;
  }

  .layout-container {
    flex-direction: column;
    height: auto;             /* ZMĚNA */
    flex: 1;                  /* PŘIDÁNO */
    margin-top: 0;            /* PŘIDÁNO: hlavička už není fixed */
    min-height: 0;            /* PŘIDÁNO */
  }

  .sidebar {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    height: 40vh;
    min-height: 200px;
    max-height: 50vh;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    display: grid;                                    /* ZMĚNA: použít grid */
    grid-template-columns: 60% 40%;                   /* 2 sloupce: 60% a 40% */
    grid-template-rows: auto 1fr;                     /* 2 řádky: auto výška a zbytek */
    overflow: hidden;
  }

  /* h2 - první sloupec, první řádek */
  .sidebar > h2 {
    grid-column: 1;
    grid-row: 1;
    padding: 6px 12px;
    margin: 0;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: white;
    min-height: auto;
    font-size: 1rem;
  }

  /* upload-form - druhý sloupec, první řádek */
  .sidebar > .upload-form {
    grid-column: 2;
    grid-row: 1;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
    background: white;
    display: flex;
    align-items: center;
  }

  /* photo-list - oba sloupce, druhý řádek (scrollovatelný) */
  .photo-list {
    grid-column: 1 / 3;                              /* Span přes oba sloupce */
    grid-row: 2;
    overflow-y: auto;                                 /* Scrolluje */
    min-height: 0;
  }
  .resizer {
    display: flex;
    width: 100%;
    height: auto;
    border-left: none;
    border-right: none;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-light);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2px 0;
  }

  .resizer-buttons {
    position: static;
    transform: none;
    flex-direction: row;
    gap: 4px;
    padding: 0;
  }

  .resizer-btn {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }

  #resizer-left {
    transform: rotate(90deg);
  }

  #resizer-right {
    transform: rotate(90deg);
  }

  .resizer-handle {
    width: 32px;
    height: 3px;
    margin: 0 4px;
  }

  .main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }

  .main-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }

  .main-header-bar {
    padding: 12px 16px;
    min-height: auto;
  }

  .main-header-bar h2 {
    font-size: 1rem;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    padding: 12px;
  }

  .submit-container {
    flex-direction: column;
    width: 100%;
  }

  .preview-button,
  .buy-button {
    width: 100%;
    justify-content: center;
  }

  .button-text {
    align-items: center;
  }

  .step3-dropzone {
    padding: 20px 16px;
    margin-bottom: 16px;
  }

  .step3-dropzone-icon {
    font-size: 2rem;
    margin-bottom: 8px;
  }

  .step3-dropzone-title {
    font-size: 1.2rem;
    margin: 0 0 10px 0;
  }

  .step3-dropzone-desc {
    font-size: 0.9rem;
    margin: 0 0 12px 0;
  }

  .step3-dropzone-hint {
    font-size: 0.85rem;
  }

  .footer-debug {
    position: relative;
    bottom: auto;
    left: auto;
    margin: 8px;
    text-align: center;
  }

  .fab-contact {
    bottom: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    padding: 10px;
  }

  .crop-card .info {
    padding: 10px;
    font-size: 13px;
  }

  .sidebar h2 {
    font-size: 0.95rem;
    padding: 6px 10px;
    margin: 0;
    border-bottom: 1px solid var(--border-color);
    background: white;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    min-height: auto;
    box-sizing: border-box;
  }

  .upload-form {
    padding: 6px 8px;
  }

  .upload-btn {
    padding: 8px;
    font-size: 13px;
  }
  .header-left {
    flex: 1;
    min-width: 0;
    order: 1;
    height: 40px;
    margin-left: 0;
  }

  .header-right {
    order: 2;
  }
}




/* === CROP EDITOR POPUP === */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.popup-overlay[aria-hidden="false"] {
  opacity: 1;
}

.popup-overlay[aria-hidden="true"] {
  display: none;
}

.popup-content {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.popup-overlay[aria-hidden="false"] .popup-content {
  transform: scale(1);
}

.popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-dark);
  font-size: 20px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.popup-close:hover {
  background: var(--danger-color);
  color: white;
  transform: rotate(90deg);
}

#popupInner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

#editorHeader {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-light);
  flex-shrink: 0;
}

#editorTitle {
  font-size: 1.4rem;
  color: var(--text-dark);
  margin-bottom: 8px;
}

#editorControls {
  display: flex;
  align-items: center;
  gap: 12px;
}

#editorFilename {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 500;
}

.muted {
  color: var(--text-light);
  font-size: 13px;
}

/* Canvas kontejner */
#canvas {
  flex: 1;
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: calc(90vh - 220px);
  object-fit: contain;
  background: #f0f0f0;
  cursor: move;
}

/* Editor controls row */
.editor-row {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: white;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.editor-row label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
}

.editor-row input[type="text"] {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: all 0.2s ease;
}

.editor-row input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.editor-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.editor-actions button,
#saveCrop,
#resetCrop {
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

#saveCrop {
  background: var(--primary-color);
  color: white;
}

#saveCrop:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

#resetCrop {
  background: var(--bg-light);
  color: var(--text-dark);
  border: 1px solid var(--text-light);
}

#resetCrop:hover {
  background: white;
  border-color: var(--text-dark);
}

#editorHelp {
  padding: 12px 24px;
  background: var(--bg-light);
  border-top: 1px solid var(--border-color);
  text-align: center;
  flex-shrink: 0;
}

/* Dialog pro zadání názvu projektu */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

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

.dialog-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 500px;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.dialog-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: #333;
  font-weight: 600;
}

.dialog-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.dialog-close:hover {
  background: #f5f5f5;
  color: #666;
}

.dialog-body {
  padding: 24px;
}

.dialog-body p {
  margin: 0 0 12px 0;
  color: #666;
  font-size: 0.95rem;
}

.dialog-body input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.dialog-body input[type="text"]:focus {
  outline: none;
  border-color: #4A90E2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.input-hint {
  margin-top: 8px;
  font-size: 0.85rem;
  color: #999;
}

.dialog-error {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fee;
  border-left: 3px solid #e53935;
  border-radius: 4px;
  color: #c62828;
  font-size: 0.9rem;
}

.dialog-footer {
  padding: 16px 24px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.dialog-footer button {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-secondary {
  background: #f5f5f5;
  color: #666;
}

.btn-secondary:hover {
  background: #e0e0e0;
}

.btn-primary {
  background: #4A90E2;
  color: white;
}

.btn-primary:hover {
  background: #357ABD;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(74, 144, 226, 0.3);
}

.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* Responsive úpravy pro crop editor */
@media (max-width: 768px) {
  .popup-overlay {
    padding: 8px;
  }

  .popup-content {
    max-height: 95vh;
    border-radius: var(--radius-md);
  }

  #editorHeader {
    padding: 16px 16px 12px;
  }

  #editorTitle {
    font-size: 1.2rem;
  }

  .editor-row {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .editor-row label {
    min-width: auto;
  }

  .editor-row input[type="text"] {
    width: 100%;
  }

  .editor-actions {
    margin-left: 0;
    width: 100%;
  }

  .editor-actions button {
    flex: 1;
    justify-content: center;
  }

  #canvas {
    max-height: calc(95vh - 280px);
  }

  #editorHelp {
    padding: 10px 16px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .popup-close {
    width: 36px;
    height: 36px;
    font-size: 18px;
    top: 8px;
    right: 8px;
  }

  #editorTitle {
    font-size: 1.1rem;
    margin-bottom: 6px;
  }

  #editorFilename {
    font-size: 12px;
  }

  .editor-row {
    padding: 10px 12px;
    gap: 8px;
  }

  .editor-actions button {
    padding: 8px 12px;
    font-size: 13px;
  }

  #canvas {
    max-height: calc(95vh - 300px);
  }
}

/* Print styl */
/* === MOBILE TIP POPUP === */
.mobile-popup-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.25s ease;
  padding: 20px;
}
.mobile-popup-overlay.visible { opacity: 1; }

.mobile-popup {
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.25s ease;
}
.mobile-popup-overlay.visible .mobile-popup { transform: scale(1); }

.mobile-popup-icon { font-size: 40px; margin-bottom: 12px; }

.mobile-popup-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-dark);
  margin-bottom: 20px;
  text-align: center;
}
.mobile-popup-text strong { display: block; font-size: 1.05rem; margin-bottom: 8px; }
.mobile-popup-text p { margin: 0; }

.mobile-popup-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-popup-btn {
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.1s;
}
.mobile-popup-btn:active { transform: scale(0.97); }

.mobile-popup-btn-register {
  background: #f0f0f0;
  color: var(--text-dark);
}
.mobile-popup-btn-register:hover { background: #e0e0e0; }

.mobile-popup-btn-dismiss {
  background: #27ae60;
  color: #fff;
}
.mobile-popup-btn-dismiss:hover { background: #219a52; }

@media (min-width: 1101px) {
  .mobile-popup-overlay { display: none !important; }
}

@media print {
  .sidebar,
  .main-header,
  .mobile-popup-overlay,
  .footer-debug,
  .fab-contact,
  .flash-messages,
  .actions,
  .delete-source-btn,
  .resizer,
  .popup-overlay {
    display: none !important;
  }

  .main {
    overflow: visible;
  }

  .crop-card {
    break-inside: avoid;
  }
}


/* === STEP 2 TOUR === */
.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 10200;
  background: transparent;
  pointer-events: all;
  opacity: 0;
  transition: opacity 0.3s;
}
.tour-overlay.visible { opacity: 1; }
.tour-overlay:not(.visible) { pointer-events: none; }

.tour-hl {
  position: fixed;
  border: 2.5px solid rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.62);
  pointer-events: none;
  opacity: 0;
  z-index: 10201;
  transition: top 0.35s ease, left 0.35s ease, width 0.35s ease, height 0.35s ease, opacity 0.25s;
}

.tour-box {
  position: fixed;
  z-index: 10202;
  background: #fff;
  border-radius: 12px;
  padding: 20px 22px 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
  pointer-events: all;
  line-height: 1.5;
  max-width: 310px;
}
.tour-box .tour-indicator {
  font-size: 0.75rem;
  color: #999;
  margin-bottom: 5px;
  letter-spacing: 0.02em;
}
.tour-box h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 9px;
  color: #1a1a1a;
}
.tour-box p {
  font-size: 0.88rem;
  color: #444;
  margin: 0 0 16px;
}
.tour-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}
.tour-btn {
  padding: 7px 13px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.tour-btn-primary {
  background: var(--primary-color);
  color: #fff;
  margin-left: auto;
}
.tour-btn-primary:hover { background: var(--primary-hover); }
.tour-btn-secondary {
  background: #f0f0f0;
  color: #333;
}
.tour-btn-secondary:hover { background: #e2e2e2; }
.tour-btn-ghost {
  background: transparent;
  color: #aaa;
  font-weight: 400;
  padding: 7px 8px;
}
.tour-btn-ghost:hover { color: #555; }

/* FAB Help button */
.fab-help {
  position: fixed;
  bottom: 16px;
  right: 68px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: #6c757d;
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.fab-help:hover {
  background: #5a6268;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}

@media (max-width: 1100px) {
  .fab-help {
    width: 40px;
    height: 40px;
    right: 60px;
    bottom: 12px;
    font-size: 1.1rem;
  }
  .tour-box {
    padding: 16px 18px 14px;
  }
  .tour-box h3 {
    font-size: 0.95rem;
  }
  .tour-box p {
    font-size: 0.84rem;
  }
}

@media print {
  .tour-overlay, .fab-help { display: none !important; }
}

/* Upload Dialog */
#upload-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#upload-dialog-overlay.visible {
  opacity: 1;
}

.upload-dialog {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

#upload-dialog-overlay.visible .upload-dialog {
  transform: scale(1);
}

.upload-dialog-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.upload-dialog h3 {
  margin: 0 0 16px;
  color: #333;
}

.upload-dialog-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #f0f0f0;
  border-top-color: #4F46E5;
  border-radius: 50%;
  margin: 20px auto;
  animation: spin 1s linear infinite;
}

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

.upload-dialog-files {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px 16px;
  text-align: left;
  font-size: 14px;
  margin-top: 16px;
}

.upload-dialog-files strong {
  color: #333;
}

.upload-dialog-files ul {
  margin: 8px 0 0;
  padding-left: 20px;
  color: #666;
}

.upload-dialog-files li {
  margin: 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-dialog-files li.more {
  color: #999;
  font-style: italic;
}

/* Upload Progress Dialog */
.upload-dialog-progress {
  max-width: 400px;
}

.upload-dialog-progress h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.upload-icon {
  font-size: 28px;
  animation: upload-bounce 1.2s ease infinite;
}

@keyframes upload-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.upload-progress-bar-wrap {
  position: relative;
  background: #e9ecef;
  border-radius: 10px;
  height: 12px;
  overflow: hidden;
  margin-bottom: 8px;
}

.upload-progress-bar-bg {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 8px,
    rgba(255,255,255,0.15) 8px,
    rgba(255,255,255,0.15) 16px
  );
  animation: upload-stripes 0.8s linear infinite;
}

@keyframes upload-stripes {
  0% { background-position: 0 0; }
  100% { background-position: 22.6px 0; }
}

.upload-progress-bar {
  position: relative;
  background: linear-gradient(90deg, #6366f1, #4F46E5, #7c3aed);
  height: 100%;
  border-radius: 10px;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px rgba(79, 70, 229, 0.4);
}

.upload-progress-text {
  font-size: 14px;
  color: #666;
  margin-bottom: 16px;
  font-weight: 500;
}

.upload-file-list {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
  /* Pevná výška = 6 řádků (5 položek + „a X dalších"). Okno se během
     nahrávání posouvá a počet vykreslených řádků kolísá (u konce jich je
     míň) — pevná výška + overflow zabrání poskakování výšky dialogu. */
  height: 228px;
  overflow: hidden;
}

.upload-file-item {
  display: flex;
  /* POZOR: stav "uploading" dává položce třídu .uploading, která se kryje
     s globální utilitou .uploading (loading spinner, flex-direction:column).
     Explicitní row zajistí, že ikona a název jsou vedle sebe na jednom řádku
     (jinak se název zalomí pod ikonu a při pevné výšce se úplně ořízne). */
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  transition: background 0.3s ease, opacity 0.3s ease, color 0.3s ease, transform 0.3s ease;
  opacity: 0.6;
  /* Každá položka právě jeden řádek pevné výšky — dlouhé názvy nikdy
     nezalomí na dva řádky (viz i min-width:0 na .upload-file-name). */
  height: 38px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.upload-file-item.current {
  background: #eef2ff;
  opacity: 1;
  font-weight: 500;
  transform: scale(1.02);
  box-shadow: 0 1px 4px rgba(79, 70, 229, 0.15);
}

.upload-file-item.done {
  color: #16a34a;
  opacity: 0.85;
}

.upload-file-item.error {
  color: #c62828;
  background: #ffeaea;
  opacity: 1;
}

.upload-file-item.skipped {
  color: #999;
  opacity: 0.5;
}

.upload-file-item.waiting {
  color: #999;
}

.upload-file-item.more {
  color: #bbb;
  font-style: italic;
  font-size: 13px;
  opacity: 0.5;
}

.upload-file-status {
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  font-size: 16px;
}

.upload-file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =====================================================================
   Modal správy projektů (pm = projects modal)
   ===================================================================== */
.pm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.pm-dialog {
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 620px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.pm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.pm-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.pm-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #666;
  padding: 0 4px;
}

.pm-close:hover { color: #000; }

.pm-body {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}

.pm-loading {
  padding: 24px;
  text-align: center;
  color: #777;
}

.pm-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* Řádek projektu v modalu */
.pm-row {
  display: grid;
  grid-template-columns: 24px 1fr auto auto auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid #f0f0f0;
  transition: background .15s;
}

.pm-row:last-child { border-bottom: none; }
.pm-row:hover { background: #fafafa; }

.pm-row-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  color: var(--primary-color);
}

.pm-row-name:hover { text-decoration: underline; }

.pm-row-meta {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
}

.pm-row-action {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 3px 5px;
  border-radius: 4px;
  opacity: .6;
  transition: opacity .15s, background .15s;
}

.pm-row-action:hover {
  opacity: 1;
  background: #f0f0f0;
}

.pm-footer .btn-primary {
  white-space: nowrap;
}

@media (max-width: 480px) {
  /* Na mobilu flex — skryté meta-prvky neberou místo v layoutu */
  .pm-row {
    display: flex;
    gap: 6px;
    padding: 10px 14px;
  }

  .pm-row-name { flex: 1; min-width: 0; }

  .pm-row-meta { display: none; }
}

/* === Error pages (404, 500, 429) === */
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 2rem;
  text-align: center;
}

.error-page__inner {
  max-width: 480px;
}

.error-page__code {
  font-size: 6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--color-primary, #e05a2b);
  margin-bottom: 0.5rem;
}

.error-page__title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.error-page__text {
  color: #666;
  line-height: 1.6;
  margin-bottom: 2rem;
}
