/* =============================================================================
   Rentoria — Global Stylesheet
   Core CSS variables, resets, typography, and base utility classes.
   Admin-specific styles are in admin.css.
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;500;600;700;800&family=Noto+Sans:wght@400;500;600&display=swap');

/* === CSS Variables === */
:root {
  /* Brand Colors */
  --color-primary: #E05A2B;
  --color-primary-dark: #C44E23;
  --color-primary-light: #F97F4F;
  --color-primary-subtle: #FEF0EA;

  --color-accent: #2D6A4F;
  --color-accent-light: #40916C;
  --color-accent-subtle: #E8F5F0;

  --color-warning: #E9C46A;
  --color-warning-subtle: #FDF6E3;

  --color-danger: #C1292E;
  --color-danger-subtle: #FDEAEA;

  /* Neutrals */
  --color-surface: #FFFFFF;
  --color-bg: #FAF7F4;
  --color-bg-2: #F2EDE8;
  --color-border: #E4DBD3;
  --color-border-light: #EDE7E1;

  --color-text-primary: #1A1410;
  --color-text-secondary: #5C4D42;
  --color-text-muted: #9C8B80;
  --color-text-on-primary: #FFFFFF;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(26,20,16,0.08);
  --shadow-md: 0 4px 16px rgba(26,20,16,0.10);
  --shadow-lg: 0 8px 32px rgba(26,20,16,0.12);
  --shadow-card: 0 2px 8px rgba(26,20,16,0.08), 0 0 0 1px rgba(26,20,16,0.04);

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Spacing Scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Typography */
  --font-display: 'Baloo 2', cursive;
  --font-body: 'Noto Sans', sans-serif;

  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 17px;
  --text-lg: 20px;
  --text-xl: 24px;
  --text-2xl: 30px;
  --text-3xl: 38px;
  --text-4xl: 48px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Container */
  --container-max: 1200px;
  --container-padding: 20px;
}

/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: 1.25;
  color: var(--color-text-primary);
}

h1 { font-size: var(--text-3xl); font-weight: 800; }
h2 { font-size: var(--text-2xl); font-weight: 700; }
h3 { font-size: var(--text-xl);  font-weight: 700; }
h4 { font-size: var(--text-lg);  font-weight: 600; }
h5 { font-size: var(--text-md);  font-weight: 600; }
h6 { font-size: var(--text-base); font-weight: 600; }

p { line-height: 1.7; }

/* === Layout Utilities === */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.section {
  padding-block: var(--space-16);
}

.section-sm {
  padding-block: var(--space-10);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 11px 22px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1;
  transition: all var(--transition-base);
  white-space: nowrap;
  cursor: pointer;
  border: 2px solid transparent;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(224,90,43,0.35);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-secondary:hover {
  background: var(--color-primary-subtle);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-bg-2);
  color: var(--color-text-primary);
}

.btn-accent {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

.btn-accent:hover {
  background: var(--color-accent-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(45,106,79,0.3);
}

.btn-sm {
  padding: 7px 14px;
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: var(--text-md);
  border-radius: var(--radius-lg);
}

.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* === Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-display);
  line-height: 1.4;
}

.badge-verified {
  background: var(--color-accent-subtle);
  color: var(--color-accent);
}

.badge-online {
  background: #E8F4FD;
  color: #1A6FA8;
}

.badge-basic {
  background: var(--color-bg-2);
  color: var(--color-text-secondary);
}

.badge-pending {
  background: var(--color-warning-subtle);
  color: #A0790A;
}

.badge-danger {
  background: var(--color-danger-subtle);
  color: var(--color-danger);
}

/* === Cards === */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-body {
  padding: var(--space-5);
}

/* === Form Elements === */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  font-family: var(--font-display);
}

.form-label .required {
  color: var(--color-primary);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-family: var(--font-body);
  color: var(--color-text-primary);
  background: var(--color-surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(224,90,43,0.12);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(193,41,46,0.10);
}

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

.form-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
  font-weight: 500;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* === Toggle Switch === */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: background var(--transition-base);
  flex-shrink: 0;
}

.toggle-input:checked + .toggle-track {
  background: var(--color-primary);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-base);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-input:checked + .toggle-track::after {
  transform: translateX(20px);
}

/* === Divider === */
.divider {
  height: 1px;
  background: var(--color-border);
  margin-block: var(--space-6);
}

/* === Section Headers === */
.section-header {
  margin-bottom: var(--space-8);
}

.section-tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--color-text-primary);
  margin-bottom: var(--space-3);
}

.section-subtitle {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  max-width: 520px;
}

/* === Toast Notifications === */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px 18px;
  background: var(--color-text-primary);
  color: white;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastSlideIn var(--transition-base) ease;
  max-width: 340px;
}

.toast.success { background: var(--color-accent); }
.toast.error   { background: var(--color-danger); }
.toast.warning { background: #A0790A; }

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,20,16,0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  animation: fadeIn 200ms ease;
}

.modal-box {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalSlideUp 250ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modalSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* === Loading Spinner === */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.empty-state svg {
  opacity: 0.5;
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-secondary);
}

.empty-state-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 300px;
}

/* === Page State === */
.page-loading,
.page-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  min-height: 200px;
  text-align: center;
  color: var(--color-text-secondary);
}

/* === Responsive === */
@media (max-width: 768px) {
  :root {
    --container-padding: 16px;
  }

  h1 { font-size: var(--text-2xl); }
  h2 { font-size: var(--text-xl); }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .section { padding-block: var(--space-10); }
}

@media (max-width: 480px) {
  .btn-lg {
    padding: 12px 20px;
    font-size: var(--text-base);
  }
}
