@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300..700&display=swap');

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

:root {
  --surface-primary:    #fff;
  --surface-grey:       #f0f0f0;
  --surface-dark-grey:  #ddd;
  --border-primary:     #eee;
  --border-grey:        #e5e5e5;
  --border-dark-grey:   #aaa;
  --text-primary:       #333;
  --text-secondary:     #555;
  --text-disabled:      #aaa;
  --neutral-grey:       #ccc;
  --success-content:    #d4fcd4;
  --success-bg:         #228b22;
  --white:              #fff;
}

[data-theme="dark"] {
  --surface-primary:    #242429;
  --surface-grey:       #1a1a1e;
  --surface-dark-grey:  #4f4f4f;
  --border-primary:     #29292f;
  --border-grey:        #36363c;
  --border-dark-grey:   #aaa;
  --text-primary:       #ddd;
  --text-secondary:     #aaa;
  --text-disabled:      #888;
  --neutral-grey:       #4f4f4f;
  --success-content:    #225622;
  --success-bg:         #91e591;
  --white:              #ddd;
}

body {
  font-family: 'Space Grotesk', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100dvh;
  min-width: 100dvw;
  padding: 32px 32px;
  background-color: var(--surface-grey);
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.body-container {
  text-align: center;
  background-color: var(--surface-primary);
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 480px;
}

@media (max-width: 480px) {
  body {
    padding: 0;
  }

  .body-container {
    padding: 32px 24px;
    border: none;
    border-radius: 0;
    min-height: 100dvh;
  }
}

.status-chip {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 20px;
}

.connected {
  background-color: var(--success-content);
  color: var(--success-bg);
}

.disconnected {
  background-color: var(--neutral-grey);
  color: #888;
}

h1 {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

h2 {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-size: 24px;
}

h3 {
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.control-area h3 {
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 0px;
  font-size: 20px;
  text-align: left;
}

h4 {
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 16px;
}

h5 {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 4px;
}

@media (max-width: 480px) {
  h5 {
    font-size: 13px;
  }
}

.water-bar-container {
  width: 60px;
  height: 120px;
  background-color: var(--surface-grey);
  border-radius: 8px;
  overflow: hidden;
  margin: 32px auto;
  position: relative;
}

.water-bar {
  position: absolute;
  bottom: 0;
  left: -150%;
  transition: top 0.5s ease, background-color 0.5s ease;
  height: 200%;
  aspect-ratio: 1;
  animation: rotate 7s linear infinite;
  animation-play-state: paused;
  top: 100%;
  opacity: 0.5;
  border-radius: 43%;
}

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

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
  margin: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--neutral-grey);
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: var(--white);
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #4285f4;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

input:disabled + .slider {
  opacity: 0.5;
}

.segmented-picker {
  display: none;
  border: 1px solid var(--border-grey);
  border-radius: 8px;
  overflow: hidden;
  padding: 4px;
  margin-top: 12px;
  gap: 0;
}

.segmented-picker input {
  display: none;
}

.segmented-picker label {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  cursor: pointer;
  padding: 10px;
  text-align: center;
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 500;
  position: relative;
  border-radius: 6px;
}

.segmented-picker label:hover {
  background-color: var(--surface-grey);
}

.segmented-picker input:checked + label {
  background-color: #4285f4;
  color: white;
}

.segmented-picker input:disabled + label {
  pointer-events: none;
  opacity: 0.5;
}

.dropdown-wrapper {
  cursor: pointer;
  height: 44px;
  width: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 6px;
}

.dropdown-wrapper:hover {
  background-color: var(--surface-grey);
}

.dropdown-icon {
  border: solid var(--text-secondary);
  border-width: 0 2.5px 2.5px 0;
  display: inline-block;
  padding: 3px;
  transform: rotate(45deg);
  height: 12px;
  width: 12px;
  margin-bottom: 4px;
}

.control-area {
  display: flex;
  gap: 0;
  align-items: center;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border-grey);
}

.generic-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
  flex-direction: row;
  padding-right: 12px;
  gap: 8px;
}

.divider {
  width: 1px;
  height: 32px;
  background-color: var(--border-grey);
  margin-left: 8px;
  margin-right: 8px;
}

.side-grid {
  display: flex;
  flex-direction: row;
  gap: 16px;
  flex: 1;
}

.item-grid {
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  text-align: left;
}

#usage-card {
  width: 100%;
  text-align: left;
}

#usage-card h3 {
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 0;
  font-size: 20px;
}

#usage-card label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

@media (max-width: 480px) {
  #usage-card label {
    font-size: 13px;
  }
}

#usage-card select,
#usage-card input,
.auth-card input {
  font-family: inherit;
  font-weight: 450;
  color: var(--text-primary);
  appearance: none;
  background: var(--surface-primary);
  padding: 10px;
  margin-bottom: 20px;
  font-size: 14px;
  border: 1px solid var(--border-grey);
  border-radius: 5px;
  width: 100%;
}

#usage-card select:disabled,
#usage-card input:disabled {
  color: var(--text-disabled);
}

select:focus,
input:focus {
  background: var(--surface-grey);
  outline: none;
}

hr {
  border: 0;
  height: 1px;
  background-color: var(--border-grey);
  margin: 32px 0;
}

.usage-details p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.ftr {
  display: flex;
  flex-direction: column;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-disabled);
}

button {
  font-family: inherit;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  font-weight: 600;
  background-color: var(--surface-primary);
  color: var(--text-primary);
  cursor: pointer;
}

button:hover {
  background-color: var(--surface-grey);
}

button:disabled {
  background-color: var(--surface-primary);
  color: var(--text-disabled);
  cursor: default;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100dvw;
  height: 100lvh;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 20;
}

.modal-content {
  background: var(--surface-primary);
  padding: 24px;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  max-height: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.modal-options {
  display: flex;
  flex-direction: column;
  align-items: start;
  justify-content: start;
  flex: 1;
  overflow-y: auto;
}

.modal-options label {
  display: flex;
  flex: 1;
  width: 100%;
  padding: 12px 16px;
  border-radius: 6px;
  color: var(--text-secondary);
}

.modal-options input {
  display: none;
}

.modal-options input:hover + label {
  background-color: var(--surface-grey);
}

.modal-options input:checked + label {
  background-color: var(--surface-dark-grey);
  color: var(--text-primary);
  font-weight: 500;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: end;
}

.modal-footer button {
  padding: 8px 12px;
}

.danger {
  background-color: #e83c38;
  color: white;
}

.danger:hover {
  background-color: #9b2825;
}

#log-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  padding: 12px 0;
}

.entry {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 4px 0;
}

.start-time {
  color: var(--text-primary);
}

.numeric-data {
  color: var(--text-primary);
  font-size: 20px;
}

@media (max-width: 480px) {
  .numeric-data {
    font-size: 18px;
  }
}

.skeleton {
  border-radius: 6px;
  background: var(--surface-grey);
  height: 72px;
  width: 100%;
}

.skeleton-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-card {
  text-align: left;
}

.auth-card h2,
.auth-card h4 {
  text-align: center;
}

.auth-card label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.auth-card .auth-error {
  color: #e83c38;
  font-size: 13px;
  margin: -12px 0 16px;
  min-height: 1em;
}

.primary-btn {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  background-color: #4285f4;
  color: #fff;
  font-size: 16px;
}

.primary-btn:hover {
  background-color: #3367d6;
  color: #fff;
}

.setup-note {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}
