/* ============================================================
   T-Club – Garment Production Management System
   Custom Design System (Bootstrap 5 override layer)
   ============================================================ */

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

/* ---------- CSS Custom Properties (Design Tokens) ---------- */
:root {
  --tc-primary:      #1A3C5E;
  --tc-primary-dark: #112740;
  --tc-secondary:    #2E86AB;
  --tc-accent:       #F4A261;
  --tc-accent-dark:  #E07B3A;
  --tc-success:      #2D9C5C;
  --tc-danger:       #DC3545;
  --tc-warning:      #FFC107;
  --tc-bg:           #F5F7FA;
  --tc-surface:      #FFFFFF;
  --tc-border:       #E2E8F0;
  --tc-text:         #1E293B;
  --tc-muted:        #64748B;
  --tc-sidebar-w:    260px;
  --tc-topbar-h:     64px;
  --tc-radius:       10px;
  --tc-radius-lg:    16px;
  --tc-shadow:       0 2px 12px rgba(26,60,94,0.08);
  --tc-shadow-card:  0 4px 20px rgba(26,60,94,0.10);
  --tc-transition:   all 0.22s cubic-bezier(.4,0,.2,1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--tc-bg);
  color: var(--tc-text);
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 { font-weight: 700; color: var(--tc-primary); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }
.text-muted { color: var(--tc-muted) !important; }
.font-weight-semibold { font-weight: 600; }

/* ---------- Auth Pages ---------- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

.auth-left {
  background: linear-gradient(145deg, var(--tc-primary) 0%, var(--tc-secondary) 100%);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 320px; height: 320px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}

.auth-left::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -60px;
  width: 220px; height: 220px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

.auth-left .brand-icon {
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--tc-radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
}

.auth-left h1 { color: #fff; font-size: 2rem; margin-bottom: 0.5rem; }
.auth-left p  { color: rgba(255,255,255,0.75); font-size: 0.95rem; max-width: 280px; text-align: center; }

.auth-right {
  flex: 0 0 480px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem;
  background: var(--tc-surface);
  overflow-y: auto;
}

.auth-right .auth-header { margin-bottom: 2rem; }
.auth-right .auth-header h2 { color: var(--tc-primary); margin-bottom: 0.25rem; }
.auth-right .auth-header p  { color: var(--tc-muted); font-size: 0.9rem; }

@media (max-width: 768px) {
  .auth-wrapper { flex-direction: column; }
  .auth-left { flex: 0 0 auto; padding: 2rem 1.5rem; min-height: 220px; }
  .auth-right { flex: 1; padding: 2rem 1.5rem; }
}

/* ---------- Sidebar Layout ---------- */
.tc-layout { display: flex; min-height: 100vh; }

.tc-sidebar {
  width: var(--tc-sidebar-w);
  background: var(--tc-primary);
  color: #fff;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--tc-transition);
  z-index: 1000;
  overflow-y: auto;
}

.tc-sidebar .sidebar-brand {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  text-decoration: none;
}

.tc-sidebar .sidebar-brand .brand-icon {
  width: 42px; height: 42px;
  background: var(--tc-secondary);
  border-radius: var(--tc-radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.tc-sidebar .sidebar-brand .brand-text h6 {
  color: #fff; font-size: 0.95rem; font-weight: 700; margin: 0; line-height: 1.2;
}
.tc-sidebar .sidebar-brand .brand-text span {
  color: rgba(255,255,255,0.55); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em;
}

.tc-sidebar .sidebar-user {
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.tc-sidebar .sidebar-user .user-avatar {
  width: 38px; height: 38px;
  background: var(--tc-accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; color: #fff;
  flex-shrink: 0;
}

.tc-sidebar .sidebar-user .user-info .user-name {
  font-size: 0.875rem; font-weight: 600; color: #fff; line-height: 1.2; display: block;
}
.tc-sidebar .sidebar-user .user-info .user-role {
  font-size: 0.72rem; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.06em;
}

.tc-sidebar nav { flex: 1; padding: 1rem 0; }

.tc-sidebar .nav-section-label {
  padding: 0.5rem 1.25rem 0.25rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  font-weight: 600;
  margin-top: 0.5rem;
}

.tc-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: rgba(255,255,255,0.75);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0;
  transition: var(--tc-transition);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.tc-sidebar .nav-link i {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.5);
  width: 20px;
  text-align: center;
  transition: var(--tc-transition);
}

.tc-sidebar .nav-link:hover,
.tc-sidebar .nav-link.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
  border-left-color: var(--tc-accent);
}

.tc-sidebar .nav-link:hover i,
.tc-sidebar .nav-link.active i {
  color: var(--tc-accent);
}

.tc-sidebar .sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.tc-sidebar .sidebar-footer a {
  display: flex; align-items: center; gap: 0.6rem;
  color: rgba(255,255,255,0.5); font-size: 0.82rem; text-decoration: none;
  transition: var(--tc-transition);
}
.tc-sidebar .sidebar-footer a:hover { color: #fff; }

/* ---------- Admin sidebar accent ---------- */
.tc-sidebar.admin-sidebar { background: var(--tc-primary-dark); }
.tc-sidebar.admin-sidebar .sidebar-brand .brand-icon { background: var(--tc-accent); }

/* ---------- Top Bar ---------- */
.tc-topbar {
  height: var(--tc-topbar-h);
  background: var(--tc-surface);
  border-bottom: 1px solid var(--tc-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: fixed;
  top: 0;
  left: var(--tc-sidebar-w);
  right: 0;
  z-index: 900;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}

.tc-topbar .topbar-left {
  display: flex; align-items: center; gap: 0.75rem;
}

.tc-topbar .sidebar-toggle {
  background: none; border: none; font-size: 1.3rem;
  color: var(--tc-primary); cursor: pointer; padding: 0.25rem;
  display: none;
  transition: var(--tc-transition);
}
.tc-topbar .sidebar-toggle:hover { color: var(--tc-secondary); }

.tc-topbar .page-breadcrumb { font-size: 0.9rem; color: var(--tc-muted); }
.tc-topbar .page-breadcrumb strong { color: var(--tc-text); font-weight: 600; }

.tc-topbar .topbar-right { display: flex; align-items: center; gap: 0.75rem; }

/* ---------- Main Content ---------- */
.tc-main {
  margin-left: var(--tc-sidebar-w);
  margin-top: var(--tc-topbar-h);
  padding: 1.75rem;
  min-height: calc(100vh - var(--tc-topbar-h));
  transition: var(--tc-transition);
}

.tc-main .page-header {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.tc-main .page-header h1 { font-size: 1.5rem; margin: 0; }
.tc-main .page-header .page-subtitle { color: var(--tc-muted); font-size: 0.875rem; margin: 0; }

/* ---------- KPI Cards ---------- */
.kpi-card {
  background: var(--tc-surface);
  border-radius: var(--tc-radius-lg);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--tc-shadow-card);
  border: 1px solid var(--tc-border);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: var(--tc-transition);
  text-decoration: none;
  color: inherit;
  height: 100%;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(26,60,94,0.14); }

.kpi-card .kpi-icon {
  width: 54px; height: 54px;
  border-radius: var(--tc-radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.kpi-icon.bg-primary-soft { background: rgba(46,134,171,0.12); color: var(--tc-secondary); }
.kpi-icon.bg-success-soft { background: rgba(45,156,92,0.12); color: var(--tc-success); }
.kpi-icon.bg-accent-soft  { background: rgba(244,162,97,0.12); color: var(--tc-accent-dark); }
.kpi-icon.bg-danger-soft  { background: rgba(220,53,69,0.12);  color: var(--tc-danger); }
.kpi-icon.bg-purple-soft  { background: rgba(111,66,193,0.12); color: #6f42c1; }

.kpi-card .kpi-data .kpi-value {
  font-size: 1.75rem; font-weight: 800;
  color: var(--tc-primary); line-height: 1.1;
}
.kpi-card .kpi-data .kpi-label {
  font-size: 0.8rem; color: var(--tc-muted); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em; margin-top: 0.15rem;
}

/* ---------- Content Cards ---------- */
.tc-card {
  background: var(--tc-surface);
  border-radius: var(--tc-radius-lg);
  box-shadow: var(--tc-shadow);
  border: 1px solid var(--tc-border);
  overflow: hidden;
}

.tc-card .card-header-tc {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--tc-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--tc-surface);
}
.tc-card .card-header-tc h5 {
  margin: 0; font-size: 1rem; font-weight: 700; color: var(--tc-primary);
  display: flex; align-items: center; gap: 0.5rem;
}
.tc-card .card-header-tc h5 i { color: var(--tc-secondary); font-size: 1.1rem; }
.tc-card .card-body-tc { padding: 1.5rem; }

/* ---------- Forms ---------- */
.tc-form .form-label {
  font-weight: 600; font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--tc-muted); margin-bottom: 0.4rem;
}

.tc-form .form-control,
.tc-form .form-select {
  border: 1.5px solid var(--tc-border);
  border-radius: var(--tc-radius);
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  color: var(--tc-text);
  background: var(--tc-surface);
  transition: var(--tc-transition);
}

.tc-form .form-control:focus,
.tc-form .form-select:focus {
  border-color: var(--tc-secondary);
  box-shadow: 0 0 0 3px rgba(46,134,171,0.15);
  outline: none;
}

.tc-form .form-control.is-invalid { border-color: var(--tc-danger); }
.tc-form .form-control.auto-calc { background: #F8FAFC; font-weight: 600; }

.tc-form .form-section-divider {
  border: none; border-top: 1px solid var(--tc-border); margin: 1.5rem 0;
}

/* ---------- Buttons ---------- */
.btn-tc-primary {
  background: var(--tc-secondary);
  border: none; color: #fff;
  font-weight: 600; font-size: 0.9rem;
  padding: 0.6rem 1.5rem;
  border-radius: var(--tc-radius);
  transition: var(--tc-transition);
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-tc-primary:hover { background: #266B8A; color: #fff; transform: translateY(-1px); }

.btn-tc-accent {
  background: var(--tc-accent);
  border: none; color: #fff;
  font-weight: 600; font-size: 0.9rem;
  padding: 0.6rem 1.5rem;
  border-radius: var(--tc-radius);
  transition: var(--tc-transition);
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-tc-accent:hover { background: var(--tc-accent-dark); color: #fff; transform: translateY(-1px); }

.btn-tc-outline {
  background: transparent;
  border: 1.5px solid var(--tc-border);
  color: var(--tc-text);
  font-weight: 600; font-size: 0.9rem;
  padding: 0.6rem 1.5rem;
  border-radius: var(--tc-radius);
  transition: var(--tc-transition);
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-tc-outline:hover { border-color: var(--tc-secondary); color: var(--tc-secondary); }

/* ---------- Tables ---------- */
.tc-table { border-collapse: collapse; width: 100%; }
.tc-table th {
  background: #F1F5F9; color: var(--tc-primary);
  font-size: 0.75rem; text-transform: uppercase; font-weight: 700; letter-spacing: 0.06em;
  padding: 0.85rem 1rem; border-bottom: 2px solid var(--tc-border);
}
.tc-table td {
  padding: 0.8rem 1rem; border-bottom: 1px solid #F1F5F9;
  font-size: 0.875rem; vertical-align: middle;
}
.tc-table tbody tr { transition: var(--tc-transition); }
.tc-table tbody tr:hover { background: #F8FAFF; }

/* ---------- Badges ---------- */
.tc-badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.tc-badge.badge-stock       { background: rgba(46,134,171,0.12); color: var(--tc-secondary); }
.tc-badge.badge-accessories { background: rgba(111,66,193,0.12);  color: #6f42c1; }
.tc-badge.badge-cutting     { background: rgba(244,162,97,0.12);  color: var(--tc-accent-dark); }
.tc-badge.badge-final       { background: rgba(45,156,92,0.12);   color: var(--tc-success); }
.tc-badge.badge-cost        { background: rgba(220,53,69,0.12);   color: var(--tc-danger); }

/* ---------- Flash / Toast Messages ---------- */
.tc-toast-container {
  position: fixed; top: calc(var(--tc-topbar-h) + 1rem); right: 1rem;
  z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem;
}
.tc-toast {
  min-width: 300px; padding: 0.85rem 1.25rem;
  border-radius: var(--tc-radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  display: flex; align-items: center; gap: 0.75rem;
  animation: slideInRight 0.3s ease;
  font-size: 0.875rem; font-weight: 500;
}
.tc-toast.success { background: #ECFDF5; border-left: 4px solid var(--tc-success); color: #065F46; }
.tc-toast.error   { background: #FEF2F2; border-left: 4px solid var(--tc-danger);  color: #991B1B; }
.tc-toast.info    { background: #EFF6FF; border-left: 4px solid var(--tc-secondary); color: #1E40AF; }

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

/* ---------- Image Preview ---------- */
.img-preview-box {
  width: 100%; max-width: 300px; height: 180px;
  border: 2px dashed var(--tc-border);
  border-radius: var(--tc-radius);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #F8FAFC;
  transition: var(--tc-transition);
}
.img-preview-box img { width: 100%; height: 100%; object-fit: cover; }
.img-preview-box .placeholder-icon { font-size: 2.5rem; color: var(--tc-border); }
.img-preview-box:hover { border-color: var(--tc-secondary); }

/* ---------- Nav Tabs ---------- */
.tc-tabs .nav-link {
  color: var(--tc-muted); font-weight: 600; font-size: 0.875rem;
  border: none; padding: 0.65rem 1.25rem;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  transition: var(--tc-transition);
}
.tc-tabs .nav-link:hover { color: var(--tc-secondary); }
.tc-tabs .nav-link.active {
  color: var(--tc-secondary);
  border-bottom-color: var(--tc-secondary);
  background: none;
}

/* ---------- Responsive Sidebar ---------- */
@media (max-width: 991px) {
  .tc-sidebar {
    left: calc(-1 * var(--tc-sidebar-w));
  }
  .tc-sidebar.open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
  }
  .tc-topbar {
    left: 0;
  }
  .tc-topbar .sidebar-toggle { display: block; }
  .tc-main { margin-left: 0; }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 999;
  }
  .sidebar-overlay.active { display: block; }
}

@media (max-width: 768px) {
  .tc-main { padding: 1rem; }
  .kpi-card .kpi-data .kpi-value { font-size: 1.4rem; }
  .auth-left h1 { font-size: 1.5rem; }
}

/* ---------- Quick Actions ---------- */
.quick-action-btn {
  background: var(--tc-surface);
  border: 1.5px solid var(--tc-border);
  border-radius: var(--tc-radius);
  padding: 1.1rem 0.75rem;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0.5rem; text-decoration: none;
  color: var(--tc-text); font-size: 0.8rem; font-weight: 600;
  transition: var(--tc-transition);
  min-height: 90px;
}
.quick-action-btn i { font-size: 1.5rem; }
.quick-action-btn:hover {
  border-color: var(--tc-secondary);
  background: #EBF5FB;
  color: var(--tc-secondary);
  transform: translateY(-2px);
}

/* ---------- Search & Filter Panel ---------- */
.filter-panel {
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--tc-shadow);
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center; padding: 3.5rem 1rem;
}
.empty-state .empty-icon {
  font-size: 3.5rem; color: var(--tc-border); margin-bottom: 1rem;
}
.empty-state p { color: var(--tc-muted); font-size: 0.9rem; }

/* ---------- Print Styles ---------- */
@media print {
  .tc-sidebar, .tc-topbar, .btn, .tc-toast-container { display: none !important; }
  .tc-main { margin: 0 !important; padding: 0 !important; }
  .tc-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
