/* ===========================
   CSS Reset & Base Styles
   =========================== */

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

/* ===========================
   CSS Custom Properties
   =========================== */

:root {
  /* Colors - Modern Minimal Palette */
  --color-primary: #2563eb;        /* Blue 600 */
  --color-primary-hover: #1d4ed8;  /* Blue 700 */
  --color-primary-light: #dbeafe;  /* Blue 100 */

  --color-secondary: #64748b;      /* Slate 500 */
  --color-secondary-hover: #475569;/* Slate 600 */

  --color-success: #10b981;        /* Green 500 */
  --color-error: #ef4444;          /* Red 500 */
  --color-warning: #f59e0b;        /* Amber 500 */

  --color-text-primary: #0f172a;   /* Slate 900 */
  --color-text-secondary: #64748b; /* Slate 500 */
  --color-text-disabled: #cbd5e1;  /* Slate 300 */

  --color-bg-primary: #ffffff;     /* White */
  --color-bg-secondary: #f8fafc;   /* Slate 50 */
  --color-bg-tertiary: #f1f5f9;    /* Slate 100 */

  --color-border: #e2e8f0;         /* Slate 200 */
  --color-border-focus: #2563eb;   /* Blue 600 */

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto',
                 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans',
                 'Helvetica Neue', sans-serif;

  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 1.875rem;  /* 30px */

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Spacing */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */

  /* Border Radius */
  --radius-sm: 0.25rem;  /* 4px */
  --radius-md: 0.5rem;   /* 8px */
  --radius-lg: 0.75rem;  /* 12px */
  --radius-xl: 1rem;     /* 16px */

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
               0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
               0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
               0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 200ms ease-in-out;
  --transition-slow: 300ms ease-in-out;
}

/* ===========================
   Base Typography
   =========================== */

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--color-text-primary);
  background-color: var(--color-bg-secondary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  color: var(--color-text-primary);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

p {
  margin-bottom: var(--space-md);
}

small {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* ===========================
   Form Elements
   =========================== */

.form-group {
  margin-bottom: var(--space-lg);
}

label {
  display: block;
  margin-bottom: var(--space-sm);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

input:disabled {
  background-color: var(--color-bg-tertiary);
  cursor: not-allowed;
  opacity: 0.6;
}

/* ===========================
   Buttons
   =========================== */

button {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition-base);
}

.btn-primary {
  width: 100%;
  padding: var(--space-md);
  color: white;
  background-color: var(--color-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

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

.btn-secondary {
  padding: var(--space-sm) var(--space-lg);
  color: var(--color-secondary);
  background-color: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-bg-tertiary);
  border-color: var(--color-secondary);
  color: var(--color-secondary-hover);
}

/* Button Loading State */
.btn-primary .btn-loader,
.btn-secondary .btn-loader {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ===========================
   Spinner/Loader
   =========================== */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ===========================
   Error Messages
   =========================== */

.error-message {
  margin-top: var(--space-md);
  padding: var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--color-error);
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  display: none;
}

.error-message:empty {
  display: none;
}

.error-message:not(:empty) {
  display: block;
}

/* ===========================
   Utility Classes
   =========================== */

.text-center {
  text-align: center;
}

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.hidden {
  display: none !important;
}
