/* Tripploy HR — full responsive design */

:root {
  --brand: #0ea5e9;
  --brand-dark: #0284c7;
  --brand-light: #e0f2fe;
}

html, body { height: 100%; }
body { font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }

/* Tables */
.t-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.t-table th, .t-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid #e2e8f0; text-align: left; vertical-align: middle; }
.t-table thead th { background: #f1f5f9; font-weight: 600; color: #334155; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.t-table tbody tr:hover { background: #f8fafc; }

/* Sidebar nav */
.nav-link { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.9rem; border-radius: 0.5rem; color: #475569; font-weight: 500; font-size: 0.9rem; transition: all .15s; cursor: pointer; }
.nav-link:hover { background: #f1f5f9; color: #0f172a; }
.nav-link.active { background: var(--brand); color: white; }
.nav-link.active:hover { background: var(--brand-dark); color: white; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 1rem; border-radius: 0.5rem; font-weight: 500; font-size: 0.875rem; transition: all .15s; cursor: pointer; border: 1px solid transparent; min-height: 40px; }
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: white; color: #334155; border-color: #cbd5e1; }
.btn-secondary:hover { background: #f8fafc; }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; color: #475569; }
.btn-ghost:hover { background: #f1f5f9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* Small variants */
.btn.text-xs.py-1.px-2 { min-height: 30px; }

/* Form inputs */
.input, .select, .textarea { width: 100%; padding: 0.55rem 0.75rem; border: 1px solid #cbd5e1; border-radius: 0.5rem; font-size: 0.95rem; background: white; transition: border-color .15s; min-height: 42px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15); }
.label { display: block; font-size: 0.85rem; font-weight: 500; color: #334155; margin-bottom: 0.35rem; }
.textarea { min-height: 80px; }

/* Card */
.card { background: white; border-radius: 0.75rem; box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03); padding: 1.5rem; }
.card-title { font-size: 1.05rem; font-weight: 600; color: #0f172a; margin-bottom: 1rem; }

/* Stat */
.stat-card { background: white; border-radius: 0.75rem; padding: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,0.04); border: 1px solid #e2e8f0; }
.stat-label { font-size: 0.75rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: #0f172a; margin-top: 0.25rem; }

/* Badge */
.badge { display: inline-flex; align-items: center; padding: 0.2rem 0.6rem; border-radius: 9999px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-purple { background: #f3e8ff; color: #6b21a8; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.modal-card { background: white; border-radius: 0.75rem; max-width: 36rem; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: white; z-index: 10; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid #e2e8f0; display: flex; justify-content: flex-end; gap: 0.5rem; }

/* Toast */
.toast { padding: 0.75rem 1rem; border-radius: 0.5rem; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); display: flex; align-items: center; gap: 0.5rem; min-width: 14rem; max-width: 24rem; animation: slideIn .2s ease-out; }
.toast-success { background: #16a34a; color: white; }
.toast-error { background: #dc2626; color: white; }
.toast-info { background: #0ea5e9; color: white; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* === Mobile menu hamburger button === */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 45;
  width: 44px;
  height: 44px;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Sidebar styles */
.sidebar {
  width: 16rem;
  background: white;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

/* Print styles for certificates */
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { position: absolute; left: 0; top: 0; width: 100%; }
  .no-print, .sidebar, .mobile-menu-btn { display: none !important; }
}

/* ====== RESPONSIVE BREAKPOINTS ====== */

/* Tablet & smaller */
@media (max-width: 1024px) {
  .stat-value { font-size: 1.5rem; }
  .card { padding: 1.25rem; }
  .t-table th, .t-table td { padding: 0.5rem; font-size: 0.825rem; }
}

/* Mobile — phones */
@media (max-width: 768px) {
  /* Show hamburger */
  .mobile-menu-btn { display: flex; }

  /* Hide sidebar by default on mobile, show as overlay when .open */
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 40;
    width: 84%;
    max-width: 20rem;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    box-shadow: 4px 0 12px rgba(0,0,0,0.15);
  }
  .sidebar.open { transform: translateX(0); }

  /* Sidebar overlay when open */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    z-index: 35;
  }
  .sidebar-overlay.show { display: block; }

  /* Main content takes full width */
  main { width: 100%; }

  /* Page header — give space for hamburger */
  main > div:first-child { padding-left: 4rem !important; }

  /* Smaller stat values */
  .stat-value { font-size: 1.25rem; }
  .stat-card { padding: 1rem; }

  /* Reduce all card padding */
  .card { padding: 1rem; border-radius: 0.5rem; }
  .card-title { font-size: 0.95rem; margin-bottom: 0.75rem; }

  /* Tables wrap in horizontal scroll */
  .t-table { font-size: 0.8rem; min-width: 100%; }
  .t-table th, .t-table td { padding: 0.5rem 0.6rem; }

  /* Buttons: keep touch targets */
  .btn { padding: 0.6rem 0.8rem; font-size: 0.85rem; }
  .btn.text-xs.py-1.px-2 { padding: 0.4rem 0.6rem; min-height: 32px; }

  /* Smaller modal */
  .modal-backdrop { padding: 0.5rem; }
  .modal-card { max-height: 95vh; border-radius: 0.5rem; }
  .modal-header { padding: 1rem; }
  .modal-body { padding: 1rem; }
  .modal-footer { padding: 0.75rem 1rem; flex-wrap: wrap; }

  /* Grids stack on mobile */
  .grid-cols-2, .grid-cols-3, .grid-cols-4 {
    grid-template-columns: 1fr !important;
  }
  .md\:grid-cols-2, .md\:grid-cols-3, .md\:grid-cols-4 {
    grid-template-columns: 1fr !important;
  }

  /* Toast on mobile: full-width-ish */
  #toast-container { right: 0.5rem !important; top: 4rem !important; left: 0.5rem; }
  .toast { width: 100%; max-width: 100%; }
}

/* Very small screens (older Androids) */
@media (max-width: 380px) {
  .stat-value { font-size: 1.1rem; }
  .stat-label { font-size: 0.65rem; }
  .card { padding: 0.75rem; }
  .btn { font-size: 0.8rem; }
}

/* Hide spinner on number inputs */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
