/* ===================== SHARED GLOBAL STYLES ===================== */
* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background: #f5f5f7;
  color: #222;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* ===================== HEADER STYLES ===================== */
header {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: white;
  padding: 20px 0;
  margin-bottom: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

h1 {
  margin: 0;
  font-size: 28px;
}

h2 {
  margin: 0;
  font-size: 20px;
  color: #2c3e50;
}

h3 {
  font-size: 18px;
  color: #2c3e50;
}

.logo {
  font-weight: bold;
  font-size: 24px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===================== TABS ===================== */
.tabs {
  display: flex;
  margin-bottom: 20px;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.tab {
  padding: 15px 25px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  flex: 1;
  text-align: center;
  border-bottom: 3px solid transparent;
}

.tab.active {
  background: #f8fafc;
  border-bottom: 3px solid #4f46e5;
  color: #4f46e5;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===================== CARD STYLES ===================== */
.card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  border: 1px solid #e5e7eb;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 15px;
}

.section-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: 5px;
}

/* ===================== FORM STYLES ===================== */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  color: #374151;
  gap: 5px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="password"],
select,
textarea {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #f9fafb;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
  background: #ffffff;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.helper {
  font-size: 12px;
  color: #9ca3af;
}

/* ===================== BUTTON STYLES ===================== */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 10px;
}

button {
  border-radius: 6px;
  border: none;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.06s ease, box-shadow 0.06s ease, background 0.15s;
}

button:active {
  transform: scale(0.97);
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn-secondary:hover {
  background: #d1d5db;
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.btn-success:hover {
  opacity: 0.9;
}

.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.btn-danger:hover {
  background: #fecaca;
}

.btn-whatsapp {
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: white;
}

.btn-whatsapp:hover {
  opacity: 0.9;
}

.btn-pdf {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

.btn-pdf:hover {
  opacity: 0.9;
}

.btn-icon {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

/* ===================== BADGE & PILL STYLES ===================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #ecfdf5;
  color: #047857;
  gap: 5px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #10b981;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef2ff;
  color: #4338ca;
  gap: 5px;
}

/* ===================== SCROLL AREAS ===================== */
.scroll-area {
  max-height: 300px;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  padding: 10px;
}

/* ===================== TABLE STYLES ===================== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: #f3f4f6;
  position: sticky;
  top: 0;
  z-index: 1;
}

th,
td {
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 6px;
  text-align: left;
  vertical-align: middle;
}

th {
  font-weight: 600;
  color: #4b5563;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:nth-child(odd) {
  background: #f9fafb;
}

tbody tr:hover {
  background: #eef2ff;
}

.img-cell {
  width: 50px;
}

.thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
}

.thumb-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: 1px dashed #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #9ca3af;
  background: #f9fafb;
}

.text-right {
  text-align: right;
}

.total-row td {
  font-weight: 600;
  font-size: 14px;
  border-top: 2px solid #111827;
}

.muted {
  color: #9ca3af;
  font-size: 12px;
}

/* ===================== MODAL STYLES ===================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 25px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.close-modal {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #7f8c8d;
}

/* ===================== PRODUCT BLOCK STYLES ===================== */
.product-block {
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  margin-bottom: 8px;
}

.product-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  gap: 8px;
}

.product-title {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.variants {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.variant-pill {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* ===================== PRODUCT CARD STYLES ===================== */
.product-card {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  border: 1px solid #e5e7eb;
  transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.product-image {
  height: 200px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f5f5f5;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-details {
  padding: 20px;
}

.product-name {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 8px;
  color: #2c3e50;
}

.product-category {
  color: #7f8c8d;
  font-size: 13px;
  margin-bottom: 8px;
  background: #f1f2f6;
  display: inline-block;
  padding: 4px 10px;
  border-radius: 10px;
}

.product-description {
  font-size: 14px;
  color: #666;
  margin-bottom: 16px;
  line-height: 1.4;
}

.price-display {
  font-weight: 700;
  color: #27ae60;
  font-size: 20px;
  margin-bottom: 12px;
}

.quantity-selector {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.quantity-btn {
  background: #eee;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
}

.quantity-input {
  width: 60px;
  text-align: center;
  margin: 0 12px;
}

.add-to-cart-btn {
  width: 100%;
  justify-content: center;
}

/* ===================== LAYOUTS ===================== */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 20px;
}

.layout-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.layout-full {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* ===================== LOGIN PAGE STYLES ===================== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.login-box {
  background: white;
  border-radius: 15px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 450px;
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-header h1 {
  margin: 10px 0;
  font-size: 28px;
}

.login-header p {
  color: #6b7280;
  font-size: 14px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #374151;
}

.form-group input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.login-btn {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  font-size: 16px;
  font-weight: 600;
}

.login-toggle {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: #6b7280;
}

.login-toggle button {
  background: none;
  border: none;
  color: #4f46e5;
  cursor: pointer;
  font-weight: 600;
  padding: 0;
}

.alert {
  padding: 12px 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

.alert-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.alert-success {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .tabs {
    flex-direction: column;
  }

  .header-content {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .login-box {
    padding: 30px 20px;
  }
}