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

body {
  font-family: 'Roboto', sans-serif;
  background-color: #fafafa;
  color: #212121;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  height: 100%;
}

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
  color: white;
  padding: 16px 24px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.header-content h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 500;
}

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

.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.header-content .material-icons {
  font-size: 28px;
}

/* Tabs Navigation */
.tabs {
  display: flex;
  background-color: #fff;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
  overflow-x: auto;
}

.tab-button {
  flex: 1;
  min-width: 120px;
  padding: 16px 24px;
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
}

.tab-button:hover {
  color: #1976d2;
}

.tab-button.active {
  color: #1976d2;
  border-bottom-color: #1976d2;
}

.tab-button .material-icons {
  font-size: 20px;
}

/* Main Content */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.requires-auth {
  display: none;
}

body.authenticated .requires-auth {
  display: block;
}

body.authenticated .tabs.requires-auth {
  display: flex;
}

body.authenticated .main-content.requires-auth {
  display: block;
}

.unauth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.unauth-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.unauth-card h2 {
  margin-bottom: 12px;
  font-size: 20px;
  font-weight: 600;
}

.unauth-card p {
  margin-bottom: 20px;
  color: #555;
  font-size: 14px;
}

.unauth-card .btn {
  display: inline-flex;
  margin: 0 auto;
}

body.authenticated #unauth {
  display: none;
}

/* Tab Content */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 20px;
  font-weight: 500;
}

/* Forms */
.form-container {
  background-color: #fff;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
}

.form-container h3 {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #666;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'Roboto', sans-serif;
  transition: all 0.3s ease;
}

.form-input:focus {
  outline: none;
  border-color: #1976d2;
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.08);
}

.form-input:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.route-input-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* Buttons */
.btn {
  padding: 10px 24px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
  font-family: 'Roboto', sans-serif;
}

.btn-primary {
  background-color: #1976d2;
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
  background-color: #1565c0;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background-color: #e0e0e0;
  color: #212121;
}

.btn-secondary:hover {
  background-color: #d0d0d0;
}

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

.btn-danger:hover {
  background-color: #c62828;
}

.btn .material-icons {
  font-size: 20px;
}

/* Items and Presets List */
.items-list,
.presets-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.item-card,
.preset-card {
  background-color: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: start;
  transition: all 0.3s ease;
}

.item-card:hover,
.preset-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.item-details,
.preset-details {
  flex: 1;
}

.item-details h4,
.preset-details h4 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
}

.item-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  font-size: 14px;
  color: #666;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-weight: 500;
  color: #999;
  font-size: 12px;
}

.info-value {
  color: #212121;
  font-size: 14px;
}

.item-actions {
  display: flex;
  gap: 8px;
  margin-left: 12px;
}

.btn-icon {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.btn-icon:hover {
  background-color: #f5f5f5;
  color: #1976d2;
}

.btn-icon.delete:hover {
  color: #d32f2f;
}

.btn-icon .material-icons {
  font-size: 20px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 14px;
}

/* Helper Classes */
.hidden {
  display: none;
}

/* Export Container */
.export-container {
  background-color: #fff;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.export-preview {
  background-color: #f5f5f5;
  border-radius: 8px;
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
}

.export-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.export-preview-table thead {
  background-color: #e0e0e0;
}

.export-preview-table th,
.export-preview-table td {
  padding: 12px 8px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.export-preview-table th {
  font-weight: 500;
  color: #333;
}

/* Snackbar */
.snackbar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(150px);
  background-color: #323232;
  color: white;
  padding: 16px 24px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 1000;
  max-width: 90%;
}

.snackbar.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .app-header {
    padding: 12px 16px;
  }

  .header-content h1 {
    font-size: 20px;
  }

  .main-content {
    padding: 16px;
  }

  .tab-button {
    min-width: 100px;
    padding: 12px 16px;
    font-size: 12px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .form-container {
    padding: 16px;
  }

  .form-row,
  .route-input-group {
    grid-template-columns: 1fr;
  }

  .item-card,
  .preset-card {
    flex-direction: column;
  }

  .item-actions {
    margin-left: 0;
    margin-top: 12px;
  }

  .item-info {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .btn {
    width: 100%;
  }

  .tab-button .material-icons {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 8px 12px;
  }

  .header-content h1 {
    font-size: 18px;
    gap: 8px;
  }

  .header-content .material-icons {
    font-size: 24px;
  }

  .main-content {
    padding: 12px;
  }

  .tabs {
    gap: 0;
  }

  .tab-button {
    min-width: 80px;
    padding: 8px 12px;
    font-size: 11px;
  }

  .tab-button .material-icons {
    font-size: 16px;
  }

  .section-header h2 {
    font-size: 18px;
  }

  .form-container {
    padding: 12px;
  }

  .item-info {
    grid-template-columns: 1fr;
  }

  .btn-icon {
    padding: 6px;
  }

  .snackbar {
    bottom: 10px;
    left: 10px;
    right: 10px;
    transform: translateY(150px);
    max-width: none;
  }

  .snackbar.show {
    transform: translateY(0);
  }
}
