/**
 * File Functionality and Connections
 * =========================================
 * Module: UI / Frontend
 * Functionality: Handles styling for the application. (style.css)
 * Connected With: Frontend PHP views and layouts.
 */

/* BlueBird Franchise ERP - Global CSS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #1a6fc4;
  --primary-dark: #1259a7;
  --primary-light: #3a8fdf;
  --secondary: #0f3460;
  --accent: #00b4d8;
  --success: #20bf80;
  --danger: #e94560;
  --warning: #f7b731;
  --info: #4db6e4;
  --white: #ffffff;
  --light: #f0f4f8;
  --gray: #6c757d;
  --gray-light: #e9ecef;
  --dark: #1a1a2e;
  --sidebar-width: 260px;
  --header-height: 64px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.16);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.25s ease;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--light);
  color: #2d3748;
  font-size: 14px;
  line-height: 1.6;
}

/* ===================== LOGIN PAGE ===================== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f3460 0%, #1a6fc4 50%, #00b4d8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
  top: -200px; right: -100px;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
  bottom: -150px; left: -100px;
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .brand-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(26,111,196,0.35);
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--secondary);
  margin-bottom: 4px;
}

.login-logo p {
  color: var(--gray);
  font-size: 13px;
}

.form-label { font-weight: 600; color: #374151; font-size: 13px; margin-bottom: 6px; }

.form-control {
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  transition: var(--transition);
  background: #fafbfc;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,111,196,0.12);
  background: white;
  outline: none;
}

.btn-primary-custom {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border: none;
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  width: 100%;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(26,111,196,0.35);
}

.btn-primary-custom:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(26,111,196,0.45);
}

/* ===================== SIDEBAR LAYOUT ===================== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--secondary) 0%, #162850 100%);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  transition: var(--transition);
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.sidebar-brand {
  padding: 40px 24px 30px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  align-items: center; /* Centered layout */
  text-align: center;
  gap: 8px;
}

.sidebar-brand .brand-icon {
  width: 58px; height: 58px;
  background: white !important; /* Force white for brand icon */
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  margin-bottom: 12px;
}

.sidebar-brand .brand-text-production {
  font-size: 8px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  line-height: 1;
  margin-bottom: 4px;
}

.sidebar-brand .brand-text h2 {
  color: white;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin: 0;
}

.sidebar-brand .brand-text p {
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.sidebar-user {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-user .avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user .user-info p { color: rgba(255,255,255,0.5); font-size: 11px; }
.sidebar-user .user-info strong { color: white; font-size: 13px; font-weight: 600; }

.sidebar-nav { padding: 12px 0; }

.nav-section-title {
  padding: 12px 24px 4px;
  color: rgba(255,255,255,0.35);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  border-radius: 0;
}

.sidebar-nav a:hover {
  color: white;
  background: rgba(255,255,255,0.07);
}

.sidebar-nav a.active {
  color: white;
  background: rgba(26,111,196,0.35);
  border-right: 3px solid var(--accent);
}

.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.sidebar-nav a i {
  font-size: 17px;
  width: 20px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
}

/* ===================== MAIN CONTENT ===================== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-height);
  padding: 0 24px;
  background: white;
  border-bottom: 1px solid #e8edf3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
  .topbar {
    height: auto;
    padding-top: calc(15px + env(safe-area-inset-top, 0px));
    padding-bottom: 12px;
    padding-left: 16px;
    padding-right: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-left h4 {
  font-size: 18px;
  font-weight: 700;
  color: var(--secondary);
  margin: 0;
}

.topbar-left .breadcrumb-text {
  font-size: 12px;
  color: var(--gray);
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--light);
  border: 1px solid var(--gray-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--gray);
  font-size: 17px;
  text-decoration: none;
}

.topbar-icon-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-1px);
}

.page-content {
  padding: 28px;
  flex: 1;
}

/* ===================== STAT CARDS ===================== */
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.04);
  transition: var(--transition);
  height: 100%;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.stat-card.primary::before { background: linear-gradient(90deg, var(--primary), var(--accent)); }
.stat-card.success::before { background: linear-gradient(90deg, var(--success), #10dc60); }
.stat-card.warning::before { background: linear-gradient(90deg, var(--warning), #ffa502); }
.stat-card.danger::before  { background: linear-gradient(90deg, var(--danger), #ff4757); }
.stat-card.info::before    { background: linear-gradient(90deg, var(--info), #74b9ff); }

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-card .icon-wrap {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}

.stat-card.primary .icon-wrap { background: rgba(26,111,196,0.1); color: var(--primary); }
.stat-card.success .icon-wrap { background: rgba(32,191,128,0.1); color: var(--success); }
.stat-card.warning .icon-wrap { background: rgba(247,183,49,0.1); color: var(--warning); }
.stat-card.danger .icon-wrap  { background: rgba(233,69,96,0.1); color: var(--danger); }
.stat-card.info .icon-wrap    { background: rgba(77,182,228,0.1); color: var(--info); }

.stat-card h2 {
  font-size: 32px;
  font-weight: 800;
  color: var(--secondary);
  margin-bottom: 4px;
  line-height: 1;
}

.stat-card p {
  color: var(--gray);
  font-size: 13px;
  font-weight: 500;
  margin: 0;
}

.stat-card .change {
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
}

/* ===================== CARDS ===================== */
.card {
  border: none !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-sm) !important;
}

.card-header {
  background: white !important;
  border-bottom: 1px solid #f0f4f8 !important;
  padding: 20px 24px !important;
  border-radius: var(--radius) var(--radius) 0 0 !important;
}

.card-header h5 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--secondary);
}

.card-body { padding: 24px !important; }

/* ===================== TABLES ===================== */
.table-wrapper {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f0f4f8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.table-header h5 {
  font-size: 16px;
  font-weight: 700;
  color: var(--secondary);
  margin: 0;
}

.table { margin-bottom: 0; }

.table thead th {
  background: #f7f9fc;
  color: #5a6482;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  border: none;
  padding: 13px 16px;
  white-space: nowrap;
}

.table tbody td {
  border-color: #f0f4f8;
  padding: 14px 16px;
  vertical-align: middle;
  font-size: 13.5px;
  color: #374151;
}

.table tbody tr:hover { background: #f7f9fc; }

/* ===================== BUTTONS ===================== */
.btn { border-radius: var(--radius-sm) !important; font-weight: 600 !important; font-size: 13px !important; transition: var(--transition) !important; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important; }
.btn-sm { padding: 5px 12px !important; font-size: 12px !important; }
.btn-xs { padding: 3px 8px !important; font-size: 11px !important; }

/* ===================== BADGES ===================== */
.badge {
  border-radius: 6px !important;
  font-weight: 600 !important;
  font-size: 11px !important;
  padding: 4px 9px !important;
}

/* ===================== FORMS ===================== */
.form-control, .form-select {
  border: 1.5px solid #e2e8f0 !important;
  border-radius: var(--radius-sm) !important;
  padding: 9px 13px !important;
  font-size: 13.5px !important;
  transition: var(--transition) !important;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(26,111,196,0.1) !important;
}

.form-label { font-weight: 600; font-size: 13px; color: #374151; margin-bottom: 6px; }

/* ===================== SEARCH ===================== */
.search-box {
  position: relative;
  max-width: 280px;
}

.search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray);
  font-size: 15px;
}

.search-box input {
  padding-left: 36px !important;
  border-radius: 20px !important;
  font-size: 13px !important;
  border: 1.5px solid #e2e8f0 !important;
}

/* ===================== PAGINATION ===================== */
.pagination .page-link {
  border-radius: var(--radius-sm) !important;
  margin: 0 2px;
  border: 1.5px solid #e2e8f0;
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
  transition: var(--transition);
}

.pagination .page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
}

/* ===================== ALERT ===================== */
.alert {
  border: none !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 500;
  font-size: 13.5px;
}

/* ===================== MODAL ===================== */
.modal-content {
  border: none !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
}

.modal-header {
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  color: white;
  border-radius: var(--radius) var(--radius) 0 0 !important;
  padding: 20px 24px !important;
}

.modal-header .btn-close { filter: invert(1); }
.modal-title { font-weight: 700 !important; font-size: 16px !important; }
.modal-footer { border-top: 1px solid #f0f4f8 !important; }

/* ===================== CHART CONTAINER ===================== */
.chart-container {
  position: relative;
  height: 280px;
}

/* ===================== ANIMATIONS ===================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in { animation: fadeInUp 0.4s ease forwards; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 50%;
  margin-right: 6px;
  animation: pulse-dot 1.5s ease infinite;
}

/* ===================== STATUS PILLS ===================== */
.status-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
}

.status-step.done { color: var(--success); }
.status-step.active { color: var(--primary); }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .stat-card h2 { font-size: 24px; }
}

/* ===================== MISC ===================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}

.empty-state i {
  font-size: 56px;
  color: #d1d9e6;
  margin-bottom: 16px;
}

.empty-state p { font-size: 15px; margin: 0; }

.tooltip-inner { background: var(--secondary); }

.cursor-pointer { cursor: pointer; }

.text-money { font-weight: 700; color: var(--success); font-family: 'Inter', monospace; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--light); }
::-webkit-scrollbar-thumb { background: #c9d3e0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
