/* Common components */

/* Navigation Bar */
.navigation-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(255, 248, 245, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-4);
  z-index: 20;
  border-bottom: 1px solid var(--surface-container-high);
}

.navigation-bar .back-btn {
  position: absolute;
  left: var(--space-3);
  width: var(--touch-target);
  height: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: var(--radius-full);
}

.navigation-bar .page-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-title);
}

/* Tab Bar */
.tab-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--tabbar-height);
  background: rgba(255, 248, 245, 0.98);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0);
  border-top: 1px solid var(--surface-container-high);
  z-index: 20;
}

.tab-bar .tab-item {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.2s;
}

.tab-bar .tab-item.active {
  color: var(--brand-primary);
}

.tab-bar .tab-item .tab-icon {
  width: 24px;
  height: 24px;
}

.tab-bar .tab-item .tab-label {
  font-size: var(--text-xs);
  font-weight: 600;
}

/* Cards */
.card {
  background: var(--surface-container-lowest);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-soft);
}

.card-flat {
  background: var(--surface-container-low);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

/* Buttons */
.btn-primary {
  width: 100%;
  height: var(--btn-height);
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: none;
  border-radius: var(--radius-lg);
  font-size: var(--text-lg);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

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

.btn-secondary {
  width: 100%;
  height: var(--btn-height);
  background: var(--brand-secondary-container);
  color: var(--brand-on-secondary-container);
  border: none;
  border-radius: var(--radius-lg);
  font-size: var(--text-lg);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-outline {
  width: 100%;
  height: var(--btn-height);
  background: transparent;
  color: var(--brand-primary);
  border: 2px solid var(--brand-primary);
  border-radius: var(--radius-lg);
  font-size: var(--text-lg);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-sm {
  height: var(--btn-sm-height);
  padding: 0 var(--space-4);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--brand-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  padding: var(--space-2);
}

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
}

.tag-primary {
  background: var(--brand-primary-container);
  color: var(--brand-on-primary-container);
}

.tag-secondary {
  background: var(--surface-container-high);
  color: var(--text-secondary);
}

.tag-error {
  background: var(--error);
  color: var(--on-error);
}

/* Inputs */
.input {
  width: 100%;
  height: var(--btn-height);
  background: var(--surface-container-low);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-md);
  padding: 0 var(--space-4);
  font-size: var(--text-base);
  color: var(--text-primary);
  outline: none;
  box-sizing: border-box;
}

.input:focus {
  border-color: var(--brand-primary);
}

.input::placeholder {
  color: var(--text-tertiary);
}

textarea.input {
  height: auto;
  padding: var(--space-3) var(--space-4);
}

/* List items */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--surface-container-high);
}

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

/* Section title */
.section-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-3);
  color: var(--text-primary);
  font-family: var(--font-title);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-tertiary);
  text-align: center;
}

.empty-state svg {
  margin-bottom: var(--space-3);
  opacity: 0.6;
}

/* Bottom bar */
.bottom-bar {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--screen-width);
  box-sizing: border-box;
  padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom, 0));
  background: rgba(255, 248, 245, 0.98);
  border-top: 1px solid var(--surface-container-high);
  z-index: 20;
}

.has-bottom-bar .screen-content {
  padding-bottom: calc(var(--btn-height) + var(--space-6));
}

/* Toast */
#toast {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(40, 25, 18, 0.9);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  z-index: 100;
  pointer-events: none;
  transition: opacity 0.3s;
  max-width: 300px;
  text-align: center;
}

#toast.opacity-0 {
  opacity: 0;
}

#toast:not(.opacity-0) {
  opacity: 1;
}

/* Utilities */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
