/* Calory — Forms & Buttons */

/* Date selector */
.date-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.date-header {
  text-align: center;
  margin-bottom: 12px;
}

.date-header-text {
  font-family: 'Aakar', Georgia, 'Times New Roman', serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}

.date-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
}

.date-input-wrap input[type="date"] {
  flex: 0;
  width: auto;
  min-width: 0;
  padding: 8px 10px;
  text-align: center;
  font-family: 'Ubuntu Sans', -apple-system, sans-serif;
  font-size: 0.85rem;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Inputs */
.form-group {
  margin-bottom: 12px;
  position: relative;
}

label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}

input[type="text"],
input[type="date"],
input[type="number"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  padding: 10px 12px;
  font-size: 0.875rem;
  font-family: 'Ubuntu Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: border-color var(--transition-fast) ease, background var(--transition-fast) ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

textarea {
  resize: vertical;
  min-height: 60px;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input.error,
textarea.error {
  border-color: var(--red);
}

.error-text {
  font-size: 0.72rem;
  color: var(--red);
  margin-top: 4px;
  line-height: 1.3;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: 'Ubuntu Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: pointer;
  transition: all var(--transition-fast) ease;
  min-height: 40px;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--accent2);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: var(--surface2);
  color: var(--text-sub);
}

.btn-ghost:hover {
  background: var(--surface3);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--border-red);
}

.btn-danger:hover {
  background: var(--red-bg);
  border-color: var(--border-red-hover);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.8125rem;
}

.btn-block {
  width: 100%;
}

.btn-arrow {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast) ease;
  flex-shrink: 0;
  font-family: inherit;
}

.btn-arrow:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--surface3);
}

.btn-arrow:active {
  transform: scale(0.92);
}

/* Form actions */
.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}

.form-actions .btn {
  flex: 1;
}

/* Login form */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 380px;
}

.login-box h1 {
  font-family: 'Aakar', Georgia, 'Times New Roman', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.login-box p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-submit {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.9rem;
  font-family: 'Ubuntu Sans', -apple-system, sans-serif;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast) ease;
  min-height: 44px;
}

.login-submit:hover {
  background: var(--accent2);
}

.login-submit:active {
  transform: scale(0.97);
}

.login-toggle {
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 14px;
  text-align: center;
  display: block;
  transition: color var(--transition-fast) ease;
}

.login-toggle:hover {
  color: var(--accent);
}

.login-error {
  color: var(--red);
  font-size: 0.82rem;
  margin-top: 8px;
  min-height: 1.2em;
}

/* Loading button state */
.btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 6px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
