/* ==========================================================================
   Yuria Design System — Phase 1
   B2B SaaS | WhatsApp AI Assistant Platform
   Loaded after Tailwind CSS (CDN). Purely additive — does not override Tailwind.
   ========================================================================== */


/* ==========================================================================
   1. CSS Custom Properties
   ========================================================================== */

:root {

  /* --- Brand Scale --- */
  --color-brand-900: #0f172a;
  --color-brand-800: #1e293b;
  --color-brand-700: #334155;
  --color-brand-600: #475569;
  --color-brand-50:  #f8fafc;

  /* --- Accent (Interactive Blue) --- */
  --color-accent-600: #2563eb;
  --color-accent-500: #3b82f6;
  --color-accent-100: #dbeafe;

  /* --- Admin Context (Indigo) --- */
  --color-admin-800: #1e1b4b;
  --color-admin-600: #4338ca;

  /* --- WhatsApp — use ONLY for chat components --- */
  --color-whatsapp:      #25d366;
  --color-whatsapp-dark: #128c7e;

  /* --- Semantic --- */
  --color-success: #059669;
  --color-warning: #d97706;
  --color-error:   #dc2626;

  /* --- Surfaces & Borders --- */
  --color-surface:        #ffffff;
  --color-surface-raised: #f8fafc;
  --color-border:         #e2e8f0;
  --color-border-strong:  #cbd5e1;

  /* --- Typography Colors --- */
  --color-text-primary:   #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted:     #94a3b8;

  /* --- Typography Families --- */
  --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* --- Border Radius --- */
  --radius-sm:   0.375rem;
  --radius-md:   0.5rem;
  --radius-lg:   0.75rem;
  --radius-xl:   1rem;
  --radius-full: 9999px;

  /* --- Shadows --- */
  --shadow-card:   0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-raised: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-modal:  0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);

  /* --- Spacing --- */
  --space-section: 5rem;
  --space-card:    1.5rem;
  --space-form:    1rem;

  /* --- Transitions --- */
  --transition-fast: 100ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}


/* ==========================================================================
   2. Base Reset
   ========================================================================== */

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

body {
  font-family: var(--font-sans);
}


/* ==========================================================================
   3. Buttons
   All buttons share a base and are differentiated by modifier classes.
   Applied after Tailwind so these classes win without !important.
   ========================================================================== */

.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;           /* py-2 px-4 */
  border: 0;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--transition-fast),
              box-shadow var(--transition-fast),
              color var(--transition-fast);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible {
  outline: 2px solid var(--color-accent-500);
  outline-offset: 2px;
}

/* Primary — blue */
.btn-primary {
  background-color: var(--color-accent-600);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #1d4ed8; /* blue-700 */
}

/* Secondary — outlined */
.btn-secondary {
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background-color: var(--color-surface-raised);
}

/* Danger — red */
.btn-danger {
  background-color: var(--color-error);
  color: #ffffff;
}

.btn-danger:hover {
  background-color: #b91c1c; /* red-700 */
}


/* ==========================================================================
   4. Cards
   ========================================================================== */

.card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-card);
}

/* card-hover extends card — apply both classes: class="card card-hover" */
.card-hover {
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

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


/* ==========================================================================
   5. Form Controls
   ========================================================================== */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 0.375rem;
}

.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;       /* py-2 px-3 */
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--color-text-primary);
  background-color: var(--color-surface);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
  border-color: var(--color-accent-500);
  box-shadow: 0 0 0 3px var(--color-accent-100);
}

.form-input::placeholder {
  color: var(--color-text-muted);
}


/* ==========================================================================
   6. Badges
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;      /* py-0.5 px-2 */
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-success {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background-color: #fef3c7;
  color: #92400e;
}

.badge-error {
  background-color: #fee2e2;
  color: #991b1b;
}

.badge-neutral {
  background-color: #f1f5f9;
  color: var(--color-text-secondary);
}


/* ==========================================================================
   7. Skeleton Loaders
   ========================================================================== */

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 1rem;
  width: 100%;
}

.skeleton-text-sm {
  height: 0.75rem;
  width: 60%;
}

.skeleton-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
}


/* ==========================================================================
   8. Sidebar
   ========================================================================== */

/* User sidebar — dark brand */
.sidebar-dark {
  background-color: var(--color-brand-800);
  color: #ffffff;
}

/* Admin sidebar — deep indigo */
.sidebar-admin {
  background-color: var(--color-admin-800);
  color: #ffffff;
}

/* Shared nav item */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.sidebar-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* Active state — shared base */
.sidebar-item-active {
  background-color: rgba(255, 255, 255, 0.12);
  border-left: 3px solid var(--color-accent-500);
  /* Compensate for border width so icon/text stay aligned */
  padding-left: calc(0.75rem - 3px);
  color: #ffffff;
}

/* Admin active — indigo-400 for legibility on deep-indigo bg */
.sidebar-admin .sidebar-item-active {
  border-left-color: #818cf8;
}


/* ==========================================================================
   9. Page Layout Helpers
   ========================================================================== */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-top: 0.25rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.content-area {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
  background-color: var(--color-surface-raised);
}


/* ==========================================================================
   10. Dropdown
   ========================================================================== */

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.dropdown-item:hover {
  background-color: var(--color-surface-raised);
}

.dropdown-item-danger:hover {
  background-color: #fee2e2;
  color: var(--color-error);
}


/* ==========================================================================
   11. Table Helpers
   ========================================================================== */

.table-row-hover:hover {
  background-color: var(--color-surface-raised);
}

.table-header-cell {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
}

.table-cell {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border);
}


/* ==========================================================================
   12. Empty State
   ========================================================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state-description {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  max-width: 20rem;
}


/* ==========================================================================
   13. Status Indicators
   Used in sidebar user section and presence displays.
   ========================================================================== */

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  display: inline-block;
  flex-shrink: 0;
}

.status-dot-online {
  background-color: var(--color-success);
}

.status-dot-offline {
  background-color: var(--color-error);
}

.status-dot-away {
  background-color: var(--color-warning);
}
