/* ========================================
   MyNextaff Component System
   Reusable UI elements for consistent styling
   ======================================== */

/* === Buttons === */
.btn {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 0.84rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  vertical-align: middle;
}

.btn-sm {
  padding: 4px 12px;
  font-size: 0.78rem;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}
.btn-primary:hover {
  background: #002d47;
  border-color: #002d47;
}

.btn-edit {
  background: transparent;
  border: 1px solid #28a745;
  color: #28a745;
}
.btn-edit:hover {
  background: #28a745;
  color: var(--white);
}

.btn-delete {
  background: transparent;
  border: 1px solid #dc2626;
  color: #dc2626;
}
.btn-delete:hover {
  background: #dc2626;
  color: var(--white);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--gray);
  color: var(--text-muted);
}
.btn-secondary:hover {
  background: #f3f4f6;
  color: var(--text);
  border-color: #9ca3af;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--blue);
  color: var(--blue);
}
.btn-outline:hover {
  background: rgba(0,58,92,0.06);
}

/* === Tables === */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}
.admin-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid #e5e7eb;
}
.admin-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}
.admin-table tr:hover td {
  background: #fafafa;
}
.admin-table a {
  color: var(--blue);
  text-decoration: none;
}
.admin-table a:hover {
  text-decoration: underline;
}

/* Override link styling for buttons inside tables */
.admin-table .btn {
  text-decoration: none;
}
.admin-table .btn:hover {
  text-decoration: none;
}

/* === Cards === */
.admin-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 1.5rem;
}

/* === Sections === */
.admin-section {
  margin-bottom: 1.5rem;
}

/* === Utility === */
.text-muted { color: var(--text-muted); }
.empty-state { text-align: center; color: var(--text-muted); padding: 2rem !important; }

/* === Role Badges === */
.role-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.role-admin { background: #dbeafe; color: #1e40af; }
.role-support { background: #fef3c7; color: #92400e; }
.role-owner { background: #d1fae5; color: #065f46; }
.role-employee { background: #f3f4f6; color: #374151; }
.role-none { background: #f3f4f6; color: #9ca3af; }

/* === Subtabs === */
.subtab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.subtab-bar::-webkit-scrollbar { display: none; }

.subtab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.subtab-btn:hover { color: var(--text); }
.subtab-btn.active {
  color: var(--blue);
  border-bottom-color: var(--orange);
  font-weight: 600;
}
.subtab-btn .subtab-icon {
  display: inline-flex;
  align-items: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.subtab-panel { display: none; }
.subtab-panel.active { display: block; }

/* Stats cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--blue);
  line-height: 1.1;
}
.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

@media (max-width: 768px) {
  .subtab-bar { gap: 0; }
  .subtab-btn { padding: 0.55rem 0.75rem; font-size: 0.82rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* === Document Library === */
.doc-cards-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.doc-cards-col h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--blue);
}
.doc-cards {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.doc-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: var(--white);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.doc-card:hover {
  border-color: var(--blue);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.doc-card-icon { font-size: 1.3rem; flex-shrink: 0; }
.doc-card-info { min-width: 0; }
.doc-card-title {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-card-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.doc-add-form .form-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

@media (max-width: 768px) {
  .doc-cards-row { grid-template-columns: 1fr; }
  .doc-add-form .form-row { flex-direction: column; align-items: stretch; }
}
