* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-deep: #1a1a2e;
  --bg-card: #16213e;
  --bg-card-hover: #1c2a4a;
  --bg-input: #16213e;
  --text-primary: #eeeeee;
  --text-secondary: #a0a0b8;
  --accent-gold: #c9a227;
  --accent-wine: #8b2252;
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1.6;
}

#app {
  height: 100%;
  position: relative;
}

/* === VIEW CONTAINER === */
.view {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
}

/* === HEADER ROW === */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header {
  padding: 24px 20px 16px;
  flex-shrink: 0;
}

header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.5px;
}

.scroll-area {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 100px;
  padding-bottom: calc(100px + var(--safe-bottom));
}

/* === SUB HEADER (back + delete) === */
.sub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.back-btn {
  background: none;
  border: none;
  color: var(--accent-gold);
  font-size: 18px;
  padding: 16px 20px;
  cursor: pointer;
  font-family: inherit;
}

.sub-header-actions {
  display: flex;
  align-items: center;
}

.edit-btn {
  background: none;
  border: none;
  font-size: 20px;
  padding: 16px 8px 16px 20px;
  cursor: pointer;
  opacity: 0.6;
}

.delete-event-btn {
  background: none;
  border: none;
  font-size: 20px;
  padding: 16px 20px 16px 8px;
  cursor: pointer;
  opacity: 0.6;
}

/* === EVENT HEADER (inside wines view) === */
.event-header {
  margin-bottom: 20px;
}

.event-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent-gold);
  line-height: 1.3;
}

.event-date {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* === EVENT CARD === */
.event-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  border: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.event-card:active {
  background: var(--bg-card-hover);
  transform: scale(0.98);
}

.event-card-info {
  flex: 1;
  min-width: 0;
}

.event-card-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.event-card-meta {
  font-size: 14px;
  color: var(--text-secondary);
}

.card-arrow {
  color: var(--text-secondary);
  font-size: 22px;
  margin-left: 12px;
  flex-shrink: 0;
}

/* === WINE CARD === */
.wine-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  border: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wine-card:active {
  background: var(--bg-card-hover);
  transform: scale(0.98);
}

.wine-card-info {
  flex: 1;
  min-width: 0;
}

.wine-card-name {
  font-size: 19px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.wine-card-meta {
  font-size: 14px;
  color: var(--text-secondary);
}

.wine-card-type {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 20px;
  margin-left: 12px;
  flex-shrink: 0;
}

.wine-card-type[data-type="Rouge"] {
  background: rgba(139, 34, 82, 0.3);
  color: #e06090;
}

.wine-card-type[data-type="Blanc"] {
  background: rgba(212, 168, 67, 0.2);
  color: #d4a843;
}

.wine-card-type[data-type="Rosé"] {
  background: rgba(219, 136, 136, 0.2);
  color: #e8a0a0;
}

.wine-card-type[data-type="Bulles"] {
  background: rgba(196, 168, 130, 0.2);
  color: #c4a882;
}

/* === WINE DETAIL === */
.detail-content {
  padding: 0 24px 40px;
  padding-bottom: calc(40px + var(--safe-bottom));
}

.detail-name {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 6px;
  line-height: 1.3;
}

.detail-year {
  font-size: 22px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.detail-value {
  font-size: 18px;
  color: var(--text-primary);
  line-height: 1.7;
}

.detail-notes {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border-left: 3px solid var(--accent-gold);
}

.detail-notes .detail-value {
  font-size: 19px;
  line-height: 1.8;
}

/* === FAB (Floating Action Button) === */
.fab {
  position: fixed;
  bottom: 28px;
  right: 20px;
  bottom: calc(28px + var(--safe-bottom));
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent-gold);
  color: var(--bg-deep);
  font-size: 32px;
  font-weight: 300;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(201, 162, 39, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
  z-index: 20;
}

.fab:active {
  transform: scale(0.92);
  box-shadow: 0 2px 8px rgba(201, 162, 39, 0.3);
}

/* === FORMS === */
.form-container {
  padding: 0 24px 40px;
}

.form-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  margin-top: 16px;
}

.form-label:first-of-type {
  margin-top: 0;
}

.form-input {
  display: block;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 17px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.form-input:focus {
  border-color: var(--accent-gold);
}

.form-input::placeholder {
  color: rgba(160, 160, 184, 0.5);
}

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

select.form-input {
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  padding-bottom: 40px;
}

.btn-cancel {
  flex: 1;
  padding: 14px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 17px;
  font-family: inherit;
  cursor: pointer;
}

.btn-save {
  flex: 1;
  padding: 14px;
  background: var(--accent-gold);
  border: none;
  border-radius: 10px;
  color: var(--bg-deep);
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-save:active {
  opacity: 0.85;
}

/* === EMPTY STATE === */
.empty-msg {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 20px;
  font-size: 16px;
  line-height: 1.6;
}

/* === MODE TOGGLE === */
.mode-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 8px 14px;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.mode-toggle:active {
  background: var(--bg-card-hover);
}

.mode-label {
  letter-spacing: 0.5px;
}

/* === LOADING === */
.loading {
  text-align: center;
  color: var(--text-secondary);
  padding: 60px 20px;
  font-size: 17px;
}

.btn-save:disabled {
  opacity: 0.5;
  cursor: default;
}
