@import "tailwindcss";

@theme {
  /* ── Primary (indigo) ─────────────────────────────────── */
  --color-primary-50:  #eef2ff;
  --color-primary-100: #e0e7ff;
  --color-primary-500: #6366f1;
  --color-primary-600: #4f46e5;
  --color-primary-700: #4338ca;

  /* ── Surfaces ─────────────────────────────────────────── */
  --color-surface-base:    #f9fafb;   /* page bg */
  --color-surface-card:    #ffffff;   /* cards, modals */
  --color-surface-raised:  #f3f4f6;  /* hover, subtle bg */
  --color-surface-navbar:  rgba(255, 255, 255, 0.95);
  --color-overlay:         rgba(0, 0, 0, 0.5);

  /* ── Text ─────────────────────────────────────────────── */
  --color-text-primary:    #111827;   /* headings, strong */
  --color-text-secondary:  #4b5563;   /* body */
  --color-text-muted:      #6b7280;   /* labels, hints */
  --color-text-dim:        #9ca3af;   /* placeholders, disabled */

  /* ── Borders ──────────────────────────────────────────── */
  --color-border:          #e5e7eb;
  --color-border-subtle:   rgba(229, 231, 235, 0.6);

  /* ── Semantic ─────────────────────────────────────────── */
  --color-success:         #059669;
  --color-success-subtle:  #ecfdf5;
  --color-error:           #dc2626;
  --color-error-subtle:    #fef2f2;
  --color-warning:         #d97706;
  --color-warning-subtle:  #fffbeb;
  --color-info:            #2563eb;
  --color-info-subtle:     #eff6ff;

  /* ── Radius ───────────────────────────────────────────── */
  --radius-sm:  0.375rem;   /* 6px — inputs, badges */
  --radius-md:  0.5rem;     /* 8px — buttons, cards */
  --radius-lg:  0.75rem;    /* 12px — modals, panels */
  --radius-xl:  1rem;       /* 16px — large cards */
  --radius-full: 9999px;    /* pills, avatars */

  /* ── Shadows ──────────────────────────────────────────── */
  --shadow-card:  0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-raised: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.15), 0 8px 20px rgba(0, 0, 0, 0.1);

  /* ── Sidebar ──────────────────────────────────────────── */
  --sidebar-width: 14rem;
}

/* ── RobotiForms hooks ──────────────────────────────────── */

.ra-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ra-field-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.ra-field-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--color-text-primary);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.ra-field-input:focus {
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.ra-field--invalid .ra-field-input {
  border-color: var(--color-error);
}

.ra-field--invalid .ra-field-input:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.ra-field-error {
  font-size: 0.8125rem;
  color: var(--color-error);
}

/* ── BEM: tm-* (tematak) ────────────────────────────────── */

/* Navbar */
.tm-navbar {
  border-bottom: 1px solid var(--color-border-subtle);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(8px);
  background: var(--color-surface-navbar);
}

.tm-navbar__inner {
  display: flex;
  align-items: center;
  height: 3.5rem;
  padding: 0 1rem;
  gap: 0.5rem;
}

@media (min-width: 1024px) {
  .tm-navbar__inner {
    padding: 0 1.5rem;
  }
}

.tm-navbar__logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
  flex-shrink: 0;
  margin-right: 0.5rem;
}

/* Navbar tabs */
.tm-tab {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  height: 3.5rem;
  font-size: 0.875rem;
  transition: color 0.12s, border-color 0.12s;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  color: var(--color-text-muted);
  font-weight: 500;
}

.tm-tab:hover {
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

.tm-tab--active {
  border-color: var(--color-text-primary);
  color: var(--color-text-primary);
  font-weight: 600;
}

/* Sidebar */
.tm-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  min-height: calc(100vh - 3.5rem);
}

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

.tm-sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all 0.12s;
}

.tm-sidebar__link:hover {
  background: var(--color-surface-raised);
  color: var(--color-text-primary);
}

.tm-sidebar__link--active {
  background: var(--color-primary-50);
  color: var(--color-primary-700);
}

/* Avatar */
.tm-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-surface-raised);
  color: var(--color-text-secondary);
  font-weight: 600;
  flex-shrink: 0;
}

.tm-avatar--sm { width: 2rem; height: 2rem; font-size: 0.875rem; }
.tm-avatar--md { width: 2.25rem; height: 2.25rem; font-size: 0.875rem; }

/* Flash */
.tm-flash {
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.tm-flash--notice  { background: var(--color-info-subtle);    border: 1px solid #bfdbfe; color: #1e40af; }
.tm-flash--alert   { background: var(--color-error-subtle);   border: 1px solid #fecaca; color: var(--color-error); }
.tm-flash--success { background: var(--color-success-subtle); border: 1px solid #a7f3d0; color: var(--color-success); }

/* Modal */
.tm-backdrop {
  opacity: 0;
  transition: opacity 0.2s;
}

.tm-backdrop--open {
  opacity: 1;
}

.tm-modal__panel {
  background: var(--color-surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.2s, opacity 0.2s;
}

.tm-modal__panel--open {
  transform: scale(1);
  opacity: 1;
}

.tm-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

/* Card */
.tm-card {
  background: var(--color-surface-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.tm-card--interactive {
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tm-card--interactive:hover {
  border-color: var(--color-primary-500);
  box-shadow: var(--shadow-card);
}

/* Empty state */
.tm-empty {
  padding: 2rem;
  text-align: center;
  color: var(--color-text-dim);
}

.tm-empty__icon {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 0.75rem;
}

/* Button */
.tm-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all 0.12s;
  cursor: pointer;
  border: none;
}

.tm-btn--primary {
  background: var(--color-primary-600);
  color: #ffffff;
}

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

.tm-btn--secondary {
  background: var(--color-surface-card);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

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

/* Input */
.tm-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--color-text-primary);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.tm-input:focus {
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Label */
.tm-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 0.25rem;
}

/* Tabs */
.tm-tabs {
  display: flex;
  gap: 1.5rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.tm-tabs__item {
  padding: 0.75rem 0;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  color: var(--color-text-muted);
  transition: all 0.12s;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tm-tabs__item:hover {
  color: var(--color-text-secondary);
  border-bottom-color: var(--color-border);
}

.tm-tabs__item--active {
  color: var(--color-primary-600);
  border-bottom-color: var(--color-primary-500);
}

/* Scrollbar hide (for nav overflow) */
.tm-scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.tm-scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Drawer (mobile sidebar) */
.tm-drawer {
  position: fixed;
  inset-block: 0;
  left: 0;
  z-index: 50;
  width: 16rem;
  background: var(--color-surface-card);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
}

.tm-drawer--open {
  transform: translateX(0);
}

.tm-drawer__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all 0.12s;
}

.tm-drawer__link:hover {
  background: var(--color-surface-raised);
  color: var(--color-text-primary);
}

.tm-drawer__link--active {
  background: var(--color-surface-raised);
  color: var(--color-text-primary);
}
