/* Reset und Basis-Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

/* Modal fixes */
.modal {
  z-index: 1055;
}

.modal-backdrop {
  z-index: 1050;
}

.modal-dialog {
  pointer-events: auto !important;
  z-index: 1060 !important;
  position: relative !important;
}

.modal-content {
  pointer-events: auto !important;
  z-index: 1060 !important;
  position: relative !important;
}

.modal-body {
  pointer-events: auto !important;
}

.modal-footer {
  pointer-events: auto !important;
}

/* Screen Management */
.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: block;
}

/* Login Screen */
#login-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
  background: white;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.logo {
  margin-bottom: 2rem;
}

.logo i {
  font-size: 3rem;
  color: #667eea;
  margin-bottom: 1rem;
}

.logo h1 {
  color: #333;
  margin-bottom: 0.5rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
  color: #555;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
}

/* Button Styles */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 5px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn-primary {
  background: #667eea;
  color: white;
  width: 100%;
  justify-content: center;
}

.btn-primary:hover {
  background: #5a67d8;
  transform: translateY(-2px);
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-success {
  background: #28a745;
  color: white;
}

.btn-success:hover {
  background: #218838;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #c82333;
}

.btn-info {
  background: #17a2b8;
  color: white;
  width: 100%;
  justify-content: center;
  margin-bottom: 1rem;
}

.btn-info:hover {
  background: #138496;
}

/* Main App Layout */
#main-screen {
  background: #f8f9fa;
}

.app-header {
  background: white;
  padding: 1rem 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left h2 {
  color: #333;
  margin-bottom: 0.25rem;
}

.header-left p {
  color: #666;
  font-size: 0.9rem;
}

.header-right {
  display: flex;
  gap: 1rem;
}

/* Delivery List */
.main-content {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.delivery-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.delivery-card {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
}

.delivery-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.delivery-card h3 {
  color: #333;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.delivery-card p {
  color: #666;
  margin-bottom: 0.5rem;
}

.delivery-status {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: bold;
  text-transform: uppercase;
}

.status-pending {
  background: #fff3cd;
  color: #856404;
}

.status-completed {
  background: #d4edda;
  color: #155724;
}

.status-in-progress {
  background: #cce7ff;
  color: #004085;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: white;
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  color: #333;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  padding: 0.5rem;
  border-radius: 50%;
  transition: background 0.3s;
}

.close-btn:hover {
  background: #f5f5f5;
}

.modal-body {
  padding: 1.5rem;
}

.delivery-info {
  margin-bottom: 2rem;
}

.delivery-info h4 {
  color: #333;
  margin-bottom: 0.5rem;
}

.delivery-info p {
  color: #666;
  margin-bottom: 1rem;
}

/* Action Sections */
.action-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
}

.action-section:last-child {
  border-bottom: none;
}

.action-section h4 {
  color: #333;
  margin-bottom: 1rem;
}

/* Photo Upload */
#photo-input {
  margin-bottom: 1rem;
}

.photo-preview {
  border: 2px dashed #ddd;
  border-radius: 5px;
  padding: 1rem;
  text-align: center;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 5px;
}

.photo-preview.empty {
  color: #999;
}

/* Textarea */
textarea {
  width: 100%;
  min-height: 100px;
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
}

textarea:focus {
  outline: none;
  border-color: #667eea;
}

/* Signature Canvas */
#signature-canvas {
  border: 2px solid #ddd;
  border-radius: 5px;
  cursor: crosshair;
  width: 100%;
  max-width: 400px;
  height: 200px;
  background: white;
}

.signature-controls {
  margin-top: 1rem;
}

/* Modal Actions */
.modal-actions {
  margin-top: 2rem;
  text-align: center;
}

/* Error Messages */
.error-message {
  background: #f8d7da;
  color: #721c24;
  padding: 0.75rem;
  border-radius: 5px;
  margin-top: 1rem;
  text-align: center;
}

.success-message {
  background: #d4edda;
  color: #155724;
  padding: 0.75rem;
  border-radius: 5px;
  margin-top: 1rem;
  text-align: center;
}

/* Offline Indicator */
.offline-indicator {
  background: #ffc107;
  color: #856404;
  padding: 0.5rem;
  border-radius: 5px;
  margin-top: 1rem;
  text-align: center;
  font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .header-right {
    width: 100%;
    justify-content: center;
  }

  .main-content {
    padding: 1rem;
  }

  .delivery-list {
    grid-template-columns: 1fr;
  }

  .modal-content {
    width: 95%;
    margin: 1rem;
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-body {
    padding: 1rem;
  }

  #signature-canvas {
    width: 100%;
    height: 150px;
  }
}

/* Loading Spinner */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Sync Status */
.sync-pending {
  background: #fff3cd !important;
  border-left: 4px solid #ffc107;
}

.sync-pending::after {
  content: " (Synchronisation ausstehend)";
  color: #856404;
  font-size: 0.8rem;
  font-style: italic;
}
