/* ========================================
   Recurlog — Mobile-First Design System
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* ===== DESIGN TOKENS ===== */
:root {
  --color-primary: #1DB954;
  --color-primary-dark: #16a34a;
  --color-success: #22C55E;
  --color-danger: #EF4444;
  --color-warning: #F59E0B;
  --color-info: #3B82F6;
  --color-navy: #0B1E3D;
  --color-amber: #F59E0B;

  --color-neutral-50: #F9FAFB;
  --color-neutral-100: #F3F4F6;
  --color-neutral-200: #E5E7EB;
  --color-neutral-300: #D1D5DB;
  --color-neutral-400: #9CA3AF;
  --color-neutral-500: #6B7280;
  --color-neutral-600: #4B5563;
  --color-neutral-700: #374151;
  --color-neutral-800: #1F2937;
  --color-neutral-900: #111827;

  --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;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 30px;
  --text-4xl: 36px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);

  --sidebar-width: 240px;
  --sidebar-collapsed-width: 60px;
  --header-height: 56px;
  --bottom-nav-height: 56px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', sans-serif;
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--color-neutral-900);
  background: var(--color-neutral-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-lg);
  transition: all 150ms;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: var(--text-xs);
  min-height: 32px;
  border-radius: var(--radius-md);
}

.btn-md {
  padding: 10px 20px;
  font-size: var(--text-sm);
}

.btn-lg {
  padding: 14px 24px;
  font-size: var(--text-base);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

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

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

.btn-secondary {
  background: var(--color-neutral-100);
  color: var(--color-neutral-700);
  border: 1px solid var(--color-neutral-200);
}

.btn-secondary:hover {
  background: var(--color-neutral-200);
}

.btn-ghost {
  background: transparent;
  color: var(--color-neutral-500);
}

.btn-ghost:hover {
  background: var(--color-neutral-100);
  color: var(--color-neutral-700);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

/* ===== CARDS ===== */
.card {
  background: #fff;
  border: 1px solid var(--color-neutral-100);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 150ms;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-neutral-100);
}

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

/* ===== FORMS ===== */
.form-input {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-4);
  background: #fff;
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-lg);
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--color-neutral-900);
  transition: border 150ms, box-shadow 150ms;
  outline: none;
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.15);
}

.form-select {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-4);
  background: #fff;
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-lg);
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--color-neutral-900);
  transition: border 150ms, box-shadow 150ms;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.15);
}

.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: #fff;
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-lg);
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--color-neutral-900);
  transition: border 150ms, box-shadow 150ms;
  outline: none;
  resize: vertical;
  min-height: 88px;
}

.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.15);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-neutral-700);
  margin-bottom: 6px;
}

/* ===== 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: 500;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-pending {
  background: #FEF3C7;
  color: #92400E;
}

.badge-completed {
  background: #DCFCE7;
  color: #166534;
}

.badge-missed {
  background: #FEE2E2;
  color: #991B1B;
}

.badge-info {
  background: #DBEAFE;
  color: #1E40AF;
}

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: modalFadeIn 200ms ease;
}

.modal-content {
  background: #fff;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-6);
  width: 100%;
  max-width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalSlideUp 250ms ease;
}

@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
  }

  .modal-content {
    border-radius: var(--radius-xl);
    width: auto;
    min-width: 320px;
    max-width: 480px;
    margin: var(--space-4);
    animation: modalFadeIn 200ms ease;
  }
}

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

@keyframes modalSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ===== TABLES ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  display: none;
}

.data-table tr {
  display: block;
  background: #fff;
  border: 1px solid var(--color-neutral-100);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-3);
  padding: var(--space-4);
}

.data-table td {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: var(--text-sm);
  border: none;
}

.data-table td::before {
  content: attr(data-label);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-neutral-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: var(--space-2);
  flex-shrink: 0;
}

.data-table td:last-child { padding-bottom: 0; }
.data-table td:first-child { padding-top: 0; }

@media (min-width: 768px) {
  .data-table thead {
    display: table-header-group;
  }

  .data-table tr {
    display: table-row;
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 0;
    padding: 0;
    border-bottom: 1px solid var(--color-neutral-100);
  }

  .data-table tr:hover {
    background: var(--color-neutral-50);
  }

  .data-table th {
    text-align: left;
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-neutral-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--color-neutral-50);
    border-bottom: 1px solid var(--color-neutral-100);
  }

  .data-table td {
    display: table-cell;
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-sm);
    vertical-align: middle;
    border: none;
    justify-content: flex-start;
  }

  .data-table td::before {
    display: none;
  }
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  left: var(--space-4);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
  max-width: 400px;
  margin-left: auto;
}

.toast {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--color-neutral-300);
  padding: var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  pointer-events: auto;
  animation: slideIn 300ms ease-out;
  font-size: var(--text-sm);
}

.toast-success { border-left-color: var(--color-primary); }
.toast-error { border-left-color: var(--color-danger); }
.toast-info { border-left-color: var(--color-info); }

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

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

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-4);
  text-align: center;
}

.empty-state i {
  width: 48px;
  height: 48px;
  color: var(--color-neutral-300);
  margin-bottom: var(--space-3);
}

.empty-state p {
  color: var(--color-neutral-400);
  font-weight: 500;
}

/* ===== BOTTOM NAV (mobile only) ===== */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  background: #fff;
  border-top: 1px solid var(--color-neutral-200);
  padding: 4px var(--space-2);
  padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
}

.bottom-nav a.active {
  color: var(--color-primary) !important;
}

.bottom-nav a svg,
.bottom-nav a i {
  transition: color 150ms;
}

@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
}

/* ===== UTILITY ===== */
.brand-glow {
  box-shadow: 0 4px 14px 0 rgba(29, 185, 84, 0.3);
}
