/* MojeOpava - Main Styles */

:root {
  --primary-color: #3498db;
  --secondary-color: #2c3e50;
  --success-color: #4caf50;
  --danger-color: #e74c3c;
  --warning-color: #f39c12;
  --light-bg: #f5f5f5;
  --border-color: #ddd;
  --text-color: #333;
  --shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: var(--text-color);
  line-height: 1.6;
}

/* Map Container */
#map {
  height: calc(100vh - 60px);
  width: 100%;
  position: relative;
  margin-top: 60px;
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: white;
  box-shadow: var(--shadow);
  z-index: 1000;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  height: 60px;
}

.app-title {
  font-size: 1.35rem;
  color: var(--secondary-color);
  font-weight: 600;
  white-space: nowrap;
  margin-right: auto;
}

/* Hamburger button — hidden on desktop */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1100;
}

.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--secondary-color);
  border-radius: 2px;
  transition: all 0.3s;
}

.hamburger-btn.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.open span:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Navigation */
.app-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links {
  border-right: 1px solid var(--border-color);
  padding-right: 0.75rem;
  margin-right: 0.25rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.75rem;
  text-decoration: none;
  color: var(--secondary-color);
  font-size: 0.85rem;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.2s;
}

.nav-link:hover {
  background: var(--light-bg);
}

.nav-link-admin {
  color: var(--primary-color);
  font-weight: 500;
}

.nav-user {
  gap: 0.5rem;
}

.nav-lang {
  border-left: 1px solid var(--border-color);
  padding-left: 0.75rem;
  margin-left: 0.25rem;
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
}

.btn-outline {
  background: transparent;
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  background: var(--light-bg);
}

.app-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.header-link {
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Language Switcher */
.language-switcher {
  display: flex;
  gap: 0.25rem;
}

.lang-btn {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border-color);
  background: white;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s;
}

.lang-btn:hover {
  background: var(--light-bg);
}

.lang-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Context Menu */
.context-menu {
  position: absolute;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 0.5rem 0;
  min-width: 200px;
  z-index: 2000;
}

.context-menu-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.context-menu-item:hover {
  background: var(--light-bg);
}

.context-menu-item i {
  width: 20px;
}

/* Issue Report Form */
.report-form-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: 3000;
}

.report-form {
  background: white;
  border-radius: 8px;
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.report-form h2 {
  margin-bottom: 1.5rem;
  color: var(--secondary-color);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--secondary-color);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-error {
  color: var(--danger-color);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Photo Upload */
.photo-upload {
  border: 2px dashed var(--border-color);
  border-radius: 4px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.photo-upload:hover {
  border-color: var(--primary-color);
  background: var(--light-bg);
}

.photo-upload input[type="file"] {
  display: none;
}

.photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.photo-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 4px;
  overflow: hidden;
}

.photo-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-preview-item button {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  background: var(--danger-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}

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

.btn-primary:hover {
  background: #2980b9;
}

.btn-secondary {
  background: var(--light-bg);
  color: var(--text-color);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

/* Loading Spinner */
.spinner {
  border: 3px solid var(--light-bg);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

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

/* Notifications */
.notification {
  position: fixed;
  top: 5rem;
  right: 2rem;
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 4000;
  animation: slideIn 0.3s ease-out;
}

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

.notification.success {
  border-left: 4px solid var(--success-color);
}

.notification.error {
  border-left: 4px solid var(--danger-color);
}

.notification.warning {
  border-left: 4px solid var(--warning-color);
}

/* User Profile */
.user-profile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--light-bg);
  border-radius: 20px;
  font-size: 0.875rem;
  color: var(--secondary-color);
}

.user-avatar {
  font-size: 1.1rem;
}

.user-email {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Responsive Design */
@media (max-width: 768px) {
  .hamburger-btn {
    display: flex;
  }

  .app-nav {
    position: fixed;
    top: 60px;
    right: 0;
    bottom: 0;
    width: 260px;
    background: white;
    box-shadow: -4px 0 12px rgba(0,0,0,0.1);
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 0.75rem;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    z-index: 1050;
  }

  .app-nav.open {
    transform: translateX(0);
  }

  .nav-section {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding-right: 0;
    padding-bottom: 0.75rem;
    margin-right: 0;
    margin-bottom: 0;
  }

  .nav-lang {
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding-left: 0;
    padding-top: 0.75rem;
    margin-left: 0;
  }

  .nav-link {
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    border-radius: 6px;
  }

  .nav-link:hover {
    background: var(--light-bg);
  }

  .user-profile {
    justify-content: flex-start;
  }

  .user-email {
    display: inline;
    max-width: 160px;
  }

  .language-switcher {
    justify-content: flex-start;
  }

  .btn-sm {
    width: 100%;
    text-align: center;
    padding: 0.6rem;
  }

  .report-form {
    padding: 1.5rem;
    width: 95%;
  }
  
  .notification {
    right: 1rem;
    left: 1rem;
  }
}

/* Leaflet Custom Styles */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
}

.leaflet-popup-content {
  margin: 1rem;
}

.custom-marker {
  background: var(--primary-color);
  border: 3px solid white;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Pulsing ring for pending (unapproved) issue markers */
@keyframes pulse-pending {
  0%   { opacity: 1; transform: scale(1); }
  50%  { opacity: 0.4; transform: scale(1.25); }
  100% { opacity: 1; transform: scale(1); }
}

/* Loading Screen */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--light-bg);
}

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

.loading-screen p {
  margin-top: 1rem;
  color: #666;
  font-size: 0.875rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #666;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.empty-state h3 {
  margin-bottom: 0.5rem;
  color: var(--secondary-color);
}

/* Address Search Bar on Map */
.map-address-search {
  position: absolute;
  top: 10px;
  left: 50px;
  right: 50px;
  z-index: 1000;
  max-width: 400px;
}

.map-address-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 2px solid rgba(0,0,0,0.15);
  border-radius: 6px;
  font-size: 0.9rem;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  outline: none;
  box-sizing: border-box;
}

.map-address-input:focus {
  border-color: var(--primary-color, #3498db);
}

.map-address-dropdown {
  background: white;
  border: 1px solid #ddd;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-height: 220px;
  overflow-y: auto;
  margin-top: -2px;
}

.map-address-item {
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  font-size: 0.85rem;
  border-bottom: 1px solid #f0f0f0;
  line-height: 1.4;
}

.map-address-item:last-child {
  border-bottom: none;
}

.map-address-item:hover {
  background: #f0f7ff;
}

.map-address-empty {
  color: #999;
  cursor: default;
}

.map-address-empty:hover {
  background: white;
}

@media (max-width: 768px) {
  .map-address-search {
    left: 10px;
    right: 10px;
    top: 8px;
    max-width: none;
    z-index: 900;
  }
}

/* Time Range Filter on Map */
.map-time-filter {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.map-time-filter-toggle {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(0,0,0,0.15);
  border-radius: 6px;
  background: white;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
}

.map-time-filter-toggle:hover {
  border-color: var(--primary-color, #3498db);
}

.map-time-filter-toggle.active {
  background: var(--primary-color, #3498db);
  color: white;
  border-color: var(--primary-color, #3498db);
}

.map-time-filter-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  border: 1px solid rgba(0,0,0,0.1);
  flex-wrap: wrap;
}

.map-time-filter-panel label {
  font-size: 0.8rem;
  color: #555;
  display: flex;
  align-items: center;
  gap: 4px;
}

.map-time-filter-panel input[type="date"] {
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.8rem;
  outline: none;
}

.map-time-filter-panel input[type="date"]:focus {
  border-color: var(--primary-color, #3498db);
}

.map-time-filter-btn {
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  background: var(--primary-color, #3498db);
  color: white;
  transition: opacity 0.2s;
}

.map-time-filter-btn:hover {
  opacity: 0.85;
}

.map-time-filter-reset {
  background: #95a5a6;
}

@media (max-width: 768px) {
  .map-time-filter {
    right: 8px;
    top: 52px;
    z-index: 900;
  }

  .map-time-filter-panel {
    flex-direction: column;
    align-items: stretch;
    min-width: 180px;
  }
}

/* Admin Map Menu */
.map-admin-menu {
  position: absolute;
  top: 52px;
  right: 10px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.map-admin-menu-toggle {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(0,0,0,0.15);
  border-radius: 6px;
  background: white;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.map-admin-menu-toggle:hover {
  border-color: var(--primary-color, #3498db);
}

.map-admin-menu-toggle.has-new::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  background: var(--danger-color, #e74c3c);
  border-radius: 50%;
  border: 1.5px solid white;
}

.map-admin-menu-panel {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  min-width: 200px;
  padding: 0.4rem 0;
  border: 1px solid rgba(0,0,0,0.08);
}

.map-admin-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  color: var(--text-color, #333);
  text-decoration: none;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}

.map-admin-menu-item:hover {
  background: var(--light-bg, #f5f5f5);
}

.map-admin-menu-divider {
  height: 1px;
  background: var(--border-color, #ddd);
  margin: 0.3rem 0;
}

.map-admin-badge {
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--danger-color, #e74c3c);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  margin-left: auto;
}

@media (max-width: 768px) {
  .map-admin-menu {
    right: 8px;
    top: 94px;
  }
}

/* Cookie Consent Banner */
#cookieConsentBanner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(44, 62, 80, 0.95);
  color: #fff;
  z-index: 100000;
  padding: 0.3rem 1rem;
  box-shadow: 0 -1px 6px rgba(0,0,0,0.2);
  animation: cookieSlideIn 0.4s ease-out;
}

.cookie-consent-content {
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.5rem;
}

.cookie-consent-text {
  flex: 1;
}

.cookie-consent-text strong {
  font-size: 0.75rem;
  margin-right: 0.3rem;
}

.cookie-consent-text p {
  display: inline;
  font-size: 0.7rem;
  line-height: 1.3;
  opacity: 0.9;
  margin: 0;
}

.cookie-consent-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cookie-btn {
  padding: 0.25rem 0.7rem;
  border: none;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.cookie-btn:hover {
  opacity: 0.85;
}

.cookie-btn-accept {
  background: #4caf50;
  color: #fff;
}

.cookie-btn-reject {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.5);
}

.cookie-btn-reject:hover {
  border-color: #fff;
}

@keyframes cookieSlideIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes cookieSlideOut {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

@media (max-width: 600px) {
  #cookieConsentBanner { padding: 0.5rem 0.75rem; }
  .cookie-consent-content { flex-wrap: wrap; justify-content: center; text-align: center; }
  .cookie-consent-text p { display: block; margin-top: 0.2rem; }
}

/* User Profile Dropdown */
.user-profile-wrapper {
  position: relative;
}

.user-profile {
  cursor: pointer;
  user-select: none;
}

.user-dropdown-arrow {
  font-size: 0.7rem;
  margin-left: 0.25rem;
  opacity: 0.6;
}

.user-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  min-width: 220px;
  z-index: 2000;
  padding: 0.4rem 0;
  margin-top: 0.5rem;
}

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

.user-dropdown-item {
  display: block;
  padding: 0.55rem 1rem;
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.15s;
}

.user-dropdown-item:hover {
  background: var(--light-bg);
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.3rem 0;
}

/* Custom Modal Utilities */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200000;
}

.modal-animate-in {
  animation: modalFadeIn 0.2s ease-out;
}

.modal-box {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  text-align: center;
  animation: modalSlideUp 0.25s ease-out;
}

.modal-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.modal-message {
  font-size: 0.95rem;
  color: #333;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.modal-btn {
  padding: 0.55rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.modal-btn:hover { opacity: 0.9; }
.modal-btn:active { transform: scale(0.97); }

.modal-btn-primary {
  background: var(--primary-color, #3498db);
  color: white;
}

.modal-btn-danger {
  background: var(--danger-color, #e74c3c);
  color: white;
}

.modal-btn-secondary {
  background: #ecf0f1;
  color: #333;
}

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

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