/**
 * Base Styles - MUI-like design system
 * Replaces Bootstrap for server-side rendered pages
 */

/* CSS Variables - MUI color palette */
:root {
  /* Primary colors */
  --primary-main: #2196f3;
  --primary-dark: #1976d2;
  --primary-light: #64b5f6;
  --primary-contrast: #ffffff;

  /* Text colors */
  --text-primary: rgba(0, 0, 0, 0.87);
  --text-secondary: rgba(0, 0, 0, 0.6);
  --text-disabled: rgba(0, 0, 0, 0.38);
  --text-hint: rgba(0, 0, 0, 0.38);

  /* Background colors */
  --background-paper: #ffffff;
  --background-default: #fafafa;

  /* Border colors */
  --border-color: rgba(0, 0, 0, 0.23);
  --border-color-hover: rgba(0, 0, 0, 0.87);
  --border-color-focus: var(--primary-main);

  /* Status colors */
  --error-main: #f44336;
  --success-main: #4caf50;
  --warning-main: #ff9800;

  /* Shadows - MUI elevation */
  --shadow-1: 0px 2px 1px -1px rgba(0,0,0,0.2), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 1px 3px 0px rgba(0,0,0,0.12);
  --shadow-2: 0px 3px 1px -2px rgba(0,0,0,0.2), 0px 2px 2px 0px rgba(0,0,0,0.14), 0px 1px 5px 0px rgba(0,0,0,0.12);
  --shadow-4: 0px 2px 4px -1px rgba(0,0,0,0.2), 0px 4px 5px 0px rgba(0,0,0,0.14), 0px 1px 10px 0px rgba(0,0,0,0.12);

  /* Spacing */
  --spacing-unit: 8px;

  /* Border radius */
  --border-radius: 4px;

  /* Transitions */
  --transition-short: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-standard: 250ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

/* Reset / Normalize basics */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Form Input - MUI TextField style */
.input-field {
  width: 100%;
  padding: 16.5px 14px;
  font-size: 1rem;
  font-family: var(--font-family);
  line-height: 1.4375em;
  color: var(--text-primary);
  background-color: var(--background-paper);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  outline: none;
  transition: border-color var(--transition-short), box-shadow var(--transition-short);
}

.input-field:hover {
  border-color: var(--border-color-hover);
}

.input-field:focus {
  border-color: var(--border-color-focus);
  border-width: 2px;
  padding: 15.5px 13px; /* Compensate for 2px border */
  box-shadow: none;
}

.input-field::placeholder {
  color: var(--text-hint);
  opacity: 1;
}

.input-field:disabled {
  background-color: var(--background-default);
  color: var(--text-disabled);
  cursor: not-allowed;
}

.input-field[readonly] {
  background-color: #f5f5f5;
  color: rgba(0, 0, 0, 0.6);
  cursor: not-allowed;
}

/* Input container for password toggle */
.input-container {
  position: relative;
  width: 100%;
  margin-bottom: 16px;
}

.input-container .input-field {
  padding-right: 48px; /* Space for toggle button */
}

.input-container .input-field:focus {
  padding-right: 47px;
}

/* Password toggle button */
.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color var(--transition-short);
}

.password-toggle:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.password-toggle:focus {
  outline: none;
  background-color: rgba(0, 0, 0, 0.08);
}

.password-toggle svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Primary Button - MUI contained button style */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 42px;
  padding: 8px 22px;
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: var(--font-family);
  line-height: 1.75;
  letter-spacing: 0.02857em;
  text-transform: uppercase;
  color: var(--primary-contrast);
  background-color: var(--primary-main);
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-2);
  cursor: pointer;
  transition: background-color var(--transition-short), box-shadow var(--transition-short);
  text-decoration: none;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  box-shadow: var(--shadow-4);
}

.btn-primary:focus {
  outline: none;
  box-shadow: var(--shadow-4), 0 0 0 3px rgba(33, 150, 243, 0.3);
}

.btn-primary:active {
  box-shadow: var(--shadow-1);
}

.btn-primary:disabled {
  background-color: rgba(0, 0, 0, 0.12);
  color: var(--text-disabled);
  box-shadow: none;
  cursor: not-allowed;
}

/* Text Link - MUI link style */
.link-text {
  color: var(--text-secondary);
  text-decoration: underline;
  font-family: var(--font-family);
  font-size: 0.875rem;
  transition: color var(--transition-short);
}

.link-text:hover {
  color: var(--primary-main);
}

/* Form group spacing */
.form-group {
  margin-bottom: 16px;
  width: 100%;
}

/* Error message */
.error-message {
  color: var(--error-main);
  font-size: 0.75rem;
  font-family: var(--font-family);
  margin-top: 4px;
  margin-left: 14px;
}

/* Success message */
.success-message {
  color: var(--success-main);
  font-size: 0.75rem;
  font-family: var(--font-family);
  margin-top: 4px;
  margin-left: 14px;
}

/* Helper text */
.helper-text {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-family: var(--font-family);
  margin-top: 4px;
  width: 100%;
}

/* Form container */
.form-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 400px;
}

/* Label */
.input-label {
  font-size: 0.875rem;
  font-weight: 400;
  font-family: var(--font-family);
  color: var(--text-primary);
  margin-bottom: 8px;
  display: block;
}

.input-label.required::after {
  content: " *";
  color: var(--error-main);
}
