/* ==========================================================================
   WORKSAFE SOLUTIONS PERU E.I.R.L. - Admin & Intranet Stylesheet
   Dominio: worksafe-solutions.pe
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  --admin-navy: #0B1E36;
  --admin-navy-dark: #071324;
  --admin-teal: #00A887;
  --admin-teal-light: #E6F8F4;
  --admin-bg: #F1F5F9;
  --admin-card: #FFFFFF;
  --admin-text: #0F172A;
  --admin-muted: #64748B;
  --admin-border: #E2E8F0;
  
  --status-draft: #94A3B8;
  --status-sent: #3B82F6;
  --status-approved: #10B981;
  --status-rejected: #EF4444;
  --status-cancelled: #64748B;

  --sidebar-width: 260px;
  --header-height: 70px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--admin-bg);
  color: var(--admin-text);
  line-height: 1.5;
  display: flex;
  min-height: 100vh;
}

/* Layout */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--admin-navy-dark);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: all 0.3s ease;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-brand img {
  height: 40px;
  width: 40px;
  object-fit: cover;
  border-radius: 8px;
  background: #FFFFFF;
  padding: 2px;
}
.sidebar-brand-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.2;
}
.sidebar-brand-text span {
  color: var(--admin-teal);
  font-size: 0.75rem;
  display: block;
  font-weight: 500;
  letter-spacing: 1px;
}

.sidebar-menu {
  padding: 1.5rem 0.75rem;
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.menu-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748B;
  padding: 0.75rem 0.75rem 0.25rem;
  font-weight: 700;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: #94A3B8;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
}
.menu-item svg {
  width: 20px;
  height: 20px;
}
.menu-item:hover,
.menu-item.active {
  background: rgba(0, 168, 135, 0.15);
  color: #FFFFFF;
}
.menu-item.active {
  color: var(--admin-teal);
  font-weight: 600;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: all 0.25s ease;
}
.user-info {
  display: flex;
  flex-direction: column;
}
.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #FFFFFF;
}
.user-role {
  font-size: 0.72rem;
  color: var(--admin-teal);
  font-weight: 500;
  letter-spacing: 0.3px;
}
.sidebar-logout {
  color: #F87171;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  transition: all 0.2s ease;
}
.sidebar-logout:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #FFFFFF;
}

/* Main Content Area */
.admin-main {
  margin-left: var(--sidebar-width);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-header {
  height: var(--header-height);
  background: #FFFFFF;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 90;
}
.header-title-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-toggle-btn {
  background: transparent;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--admin-navy);
  cursor: pointer;
  transition: all 0.2s ease;
}
.sidebar-toggle-btn:hover {
  background: var(--admin-bg);
  border-color: var(--admin-teal);
  color: var(--admin-teal);
}
.header-title-box h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--admin-navy);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Minimizable / Collapsed Sidebar Rules */
body.sidebar-collapsed .admin-sidebar {
  width: 72px;
}
body.sidebar-collapsed .admin-main {
  margin-left: 72px;
}
body.sidebar-collapsed .sidebar-brand {
  padding: 1.25rem 0.5rem;
  justify-content: center;
}
body.sidebar-collapsed .sidebar-brand-text {
  display: none;
}
body.sidebar-collapsed .menu-section-title {
  display: none;
}
body.sidebar-collapsed .menu-item {
  justify-content: center;
  padding: 0.75rem 0.5rem;
}
body.sidebar-collapsed .menu-item span {
  display: none;
}
body.sidebar-collapsed .sidebar-footer {
  padding: 1rem 0.5rem;
  justify-content: center;
}
body.sidebar-collapsed .sidebar-footer .user-info {
  display: none;
}
body.sidebar-collapsed .sidebar-logout span {
  display: none;
}
body.sidebar-collapsed .sidebar-logout {
  padding: 0.4rem;
}

.admin-body {
  padding: 2rem;
  flex-grow: 1;
}

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--admin-border);
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stat-info h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--admin-muted);
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.stat-info .stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--admin-navy);
}
.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.icon-teal { background: var(--admin-teal-light); color: var(--admin-teal); }
.icon-blue { background: #EFF6FF; color: #3B82F6; }
.icon-amber { background: #FEF3C7; color: #D97706; }
.icon-purple { background: #F3E8FF; color: #9333EA; }

/* Table Container & Cards */
.card {
  background: #FFFFFF;
  border-radius: 12px;
  border: 1px solid var(--admin-border);
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
  margin-bottom: 2rem;
  overflow: hidden;
}
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--admin-navy);
}
.card-body {
  padding: 1.5rem;
}

/* Custom Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}
.table th {
  background: #F8FAFC;
  padding: 0.9rem 1rem;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid var(--admin-border);
  white-space: nowrap;
}
.table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--admin-border);
  vertical-align: middle;
}
.table tr:hover td {
  background: #F8FAFC;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-draft { background: #E2E8F0; color: #475569; }
.badge-sent { background: #DBEAFE; color: #1E40AF; }
.badge-approved { background: #D1FAE5; color: #065F46; }
.badge-rejected { background: #FEE2E2; color: #991B1B; }
.badge-low-stock { background: #FEF3C7; color: #92400E; }
.badge-ok-stock { background: #D1FAE5; color: #065F46; }

/* Table Action Buttons Group */
.table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  white-space: nowrap;
}
.table-actions form {
  display: inline-flex;
  margin: 0;
  padding: 0;
}
.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.32rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.15s ease-in-out;
  height: 29px;
  box-sizing: border-box;
}
.btn-action-edit {
  background: #FFFFFF;
  color: #334155;
  border-color: #CBD5E1;
}
.btn-action-edit:hover {
  background: #F1F5F9;
  border-color: #94A3B8;
  color: var(--admin-navy);
}
.btn-action-delete {
  background: #FEF2F2;
  color: #DC2626;
  border-color: #FECACA;
}
.btn-action-delete:hover {
  background: #FEE2E2;
  border-color: #FCA5A5;
  color: #991B1B;
}
.btn-action-view {
  background: var(--admin-teal-light);
  color: #007A62;
  border-color: #A7F3D0;
}
.btn-action-view:hover {
  background: #CCFBF1;
  color: #065F46;
}

/* Numeric and Currency cells */
.cell-price {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
}
.cell-price.cost {
  color: #475569;
  font-weight: 500;
}
.cell-price.sale {
  color: #00876C;
  font-weight: 700;
}
.text-nowrap {
  white-space: nowrap;
}
.text-right {
  text-align: right;
}
.text-center {
  text-align: center;
}

/* Dynamic Quotation Builder */
.quote-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}
.quote-item-row {
  display: grid;
  grid-template-columns: 3fr 1fr 1fr 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px dashed var(--admin-border);
}
.quote-summary-box {
  background: #F8FAFC;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.summary-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
}
.summary-line.total {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--admin-navy);
  border-top: 2px solid var(--admin-border);
  padding-top: 0.75rem;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 30, 54, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-backdrop.show {
  display: flex;
}
.modal-card {
  background: #FFFFFF;
  border-radius: 14px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--admin-muted);
}
.modal-body {
  padding: 1.5rem;
}
.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--admin-border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Forms in Admin */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}
.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  background: #FFFFFF;
}
.form-control:focus {
  outline: none;
  border-color: var(--admin-teal);
  box-shadow: 0 0 0 3px rgba(0, 168, 135, 0.15);
}

/* Login Card */
.login-body {
  background: radial-gradient(circle at center, #16365C 0%, #0B1E36 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.login-card {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-logo img {
  width: 170px;
  max-width: 100%;
  height: auto;
  margin: 0 auto 0.75rem;
  display: block;
}
