@font-face {
  font-family: 'Vazirmatn';
  src: url('/assets/fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/assets/fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-dark: #115e59;
  --primary-light: #f0fdfa;
  --primary-border: #ccfbf1;
  --primary-ring: rgba(13, 148, 136, 0.2);

  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.06);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.05);
  --shadow-card: 0 2px 6px 0 rgb(0 0 0 / 0.03), 0 16px 36px -4px rgba(15, 23, 42, 0.08);

  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--slate-800);
  background: var(--slate-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: 
    radial-gradient(ellipse at 85% 10%, rgba(204, 251, 241, 0.5), transparent 45%),
    radial-gradient(ellipse at 15% 90%, rgba(224, 242, 254, 0.4), transparent 45%),
    var(--slate-50);
}

[hidden] {
  display: none !important;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

a {
  color: inherit;
  text-decoration: none;
  transition: all 0.15s ease;
}

/* Auth Container */
.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.auth-card {
  background: #ffffff;
  width: min(100%, 460px);
  padding: 44px 38px;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-card);
  text-align: center;
  animation: fadeIn 0.25s ease-out;
}

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

/* Brand Icon & Heading */
.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
  box-shadow: 0 8px 20px -4px rgba(13, 148, 136, 0.4);
  margin-bottom: 22px;
}

.brand-badge svg {
  width: 34px;
  height: 34px;
  fill: currentColor;
}

.auth-card h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--slate-900);
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.auth-card p.subtitle {
  color: var(--slate-500);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 28px;
}

/* Modern Tabs */
.tabs {
  display: flex;
  background: var(--slate-100);
  padding: 4px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  border: 1px solid var(--slate-200);
}

.tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  color: var(--slate-600);
  font-weight: 600;
  font-size: 14px;
  min-height: 42px;
  transition: all 0.15s ease;
}

.tabs button.active {
  background: #ffffff;
  color: var(--primary-dark);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

/* Form Inputs */
form label {
  display: block;
  text-align: start;
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-700);
  margin-bottom: 18px;
}

form label input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 16px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-md);
  background: var(--slate-50);
  color: var(--slate-900);
  font-size: 14px;
  min-height: 48px;
  transition: all 0.15s ease;
  outline: none;
}

form label input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

form label input::placeholder {
  color: var(--slate-400);
}

/* Primary Button */
.primary {
  width: 100%;
  border: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  min-height: 50px;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-hover), var(--primary-dark));
  box-shadow: 0 6px 18px rgba(13, 148, 136, 0.38);
  transform: translateY(-1px);
}

.primary:active:not(:disabled) {
  transform: translateY(0);
}

/* Error Alert */
.error {
  color: var(--danger) !important;
  font-size: 13px;
  margin: 12px 0;
  text-align: start;
  line-height: 1.5;
  font-weight: 600;
  background: var(--danger-light);
  border: 1px solid #fecaca;
  padding: 10px 14px;
  border-radius: var(--radius-md);
}

.error:empty {
  display: none;
}

/* Workspace Dashboard */
#workspace.auth {
  display: grid;
  place-items: center;
}

.workspace-card {
  width: min(100%, 720px);
  padding: 40px 36px;
  text-align: start;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--slate-200);
  margin-bottom: 26px;
}

.workspace-user-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.workspace-user-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-xl);
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}

.workspace-title-box h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--slate-900);
  letter-spacing: -0.01em;
}

.workspace-title-box p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--slate-500);
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-secondary {
  border: 1px solid var(--slate-200);
  background: #ffffff;
  color: var(--slate-700);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--slate-100);
  color: var(--slate-900);
  border-color: var(--slate-300);
}

.btn-danger {
  border: 1px solid #fee2e2;
  background: var(--danger-light);
  color: #dc2626;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  min-height: 42px;
  box-shadow: var(--shadow-xs);
}

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

/* Service Grid Cards */
.services-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 26px;
}

.service-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--slate-200);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

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

.service-info {
  display: flex;
  align-items: center;
  gap: 18px;
}

.service-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--slate-100);
  color: var(--slate-700);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.service-card:hover .service-icon {
  background: var(--primary-light);
  color: var(--primary);
}

.service-texts strong {
  display: block;
  font-size: 16px;
  color: var(--slate-900);
  font-weight: 700;
  margin-bottom: 5px;
}

.service-texts p {
  margin: 0;
  font-size: 13px;
  color: var(--slate-500);
  line-height: 1.55;
}

.service-arrow {
  color: var(--slate-400);
  font-size: 20px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.service-card:hover .service-arrow {
  color: var(--primary);
  transform: translateX(-4px);
}

/* Admin Dialog */
dialog#adminDialog {
  width: min(94vw, 740px);
  max-height: 90vh;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-2xl);
  padding: 32px;
  background: #ffffff;
  box-shadow: var(--shadow-xl);
  overflow-y: auto;
}

dialog#adminDialog::backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--slate-200);
  margin-bottom: 24px;
}

.dialog-head h2 {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  color: var(--slate-900);
}

.dialog-head button {
  border: 0;
  background: var(--slate-100);
  color: var(--slate-600);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  font-size: 16px;
}

.dialog-head button:hover {
  background: var(--slate-200);
  color: var(--slate-900);
}

.admin-section {
  padding-top: 22px;
  margin-top: 24px;
  border-top: 1px solid var(--slate-200);
}

.admin-section:first-of-type {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.admin-section h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--slate-900);
  margin: 0 0 8px;
}

.admin-hint {
  font-size: 13px;
  color: var(--slate-500);
  line-height: 1.6;
  margin: 0 0 18px;
}

.invite-form label {
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-700);
}

.invite-form input, .invite-form select {
  display: block;
  width: 100%;
  margin: 6px 0 16px;
  padding: 11px 14px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--slate-800);
  font-size: 14px;
  min-height: 46px;
  outline: none;
}

.invite-form input:focus, .invite-form select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.invite-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.invite-created {
  margin: 18px 0;
  padding: 18px 20px;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-lg);
  background: var(--success-light);
}

.invite-created strong {
  display: block;
  color: #065f46;
  font-size: 15px;
  margin-bottom: 6px;
}

.invite-created p {
  color: #047857;
  font-size: 13px;
  margin: 0 0 14px;
  line-height: 1.5;
}

.invite-code-row {
  display: flex;
  align-items: center;
  gap: 10px;
  direction: ltr;
}

.invite-code-row code {
  flex: 1;
  background: #ffffff;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid #a7f3d0;
  font-size: 14px;
  font-family: monospace;
  color: #065f46;
  user-select: all;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.invite-code-row button {
  border: 1px solid #059669;
  background: #059669;
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.invite-code-row button:hover {
  background: #047857;
}

#copyStatus {
  display: block;
  font-size: 12px;
  color: #059669;
  margin-top: 8px;
  font-weight: 700;
}

/* Invite List */
.invite-list {
  display: grid;
  gap: 14px;
}

.invite-card {
  padding: 18px 20px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  background: var(--slate-50);
}

.invite-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.invite-card-header strong {
  font-size: 15px;
  color: var(--slate-900);
}

.invite-status {
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-full);
  padding: 3px 10px;
  background: var(--success-light);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.invite-meta, .invite-id {
  font-size: 12px;
  color: var(--slate-500);
  margin: 6px 0;
  line-height: 1.5;
}

.invite-users summary {
  cursor: pointer;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 0;
}

.invite-users ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.invite-users li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid var(--slate-200);
  font-size: 12px;
  color: var(--slate-700);
}

.revoke-invite {
  border: 1px solid #fee2e2;
  background: #ffffff;
  color: #dc2626;
  font-weight: 600;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  display: inline-block;
}

.revoke-invite:hover {
  background: #fee2e2;
}

/* Usage Table */
.usage-wrap {
  overflow-x: auto;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  margin-top: 14px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  min-width: 440px;
}

th {
  background: var(--slate-100);
  color: var(--slate-800);
  padding: 12px 16px;
  font-weight: 700;
  text-align: right;
  border-bottom: 1px solid var(--slate-200);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--slate-200);
  color: var(--slate-800);
  text-align: right;
}

tr:last-child td {
  border-bottom: 0;
}

tr:hover td {
  background: var(--slate-50);
}

@media (max-width: 640px) {
  .auth-card {
    padding: 32px 22px;
    border-radius: var(--radius-xl);
  }
  .workspace-card {
    padding: 28px 20px;
  }
  .workspace-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .invite-fields {
    grid-template-columns: 1fr;
  }
  .service-card {
    padding: 16px 18px;
  }
}
