/* ============================================================
   ICONIG Admin — Styles
   ============================================================ */

/* ---- Variables ---- */
:root {
  --admin-bg:       #F5F5F7;
  --admin-card:     #FFFFFF;
  --admin-border:   #E5E5EA;
  --admin-text:     #1D1D1F;
  --admin-muted:    #86868B;
  --admin-primary:  #C9A96E;
  --admin-primary-h:#B8944F;
  --admin-danger:   #FF3B30;
  --admin-danger-h: #D32F2F;
  --admin-success:  #34C759;
  --admin-dark:     #1D1D1F;
  --font:           'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius:         10px;
  --shadow:         0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg:      0 10px 25px rgba(0,0,0,0.08);
}

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

body {
  font-family: var(--font);
  background: var(--admin-bg);
  color: var(--admin-text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font); font-size: 0.85rem; font-weight: 600;
  padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer;
  transition: all 0.2s ease; white-space: nowrap;
}
.btn-primary { background: var(--admin-primary); color: #fff; }
.btn-primary:hover { background: var(--admin-primary-h); transform: translateY(-1px); }
.btn-danger { background: var(--admin-danger); color: #fff; }
.btn-danger:hover { background: var(--admin-danger-h); }
.btn-ghost { background: transparent; color: var(--admin-muted); border: 1px solid var(--admin-border); }
.btn-ghost:hover { background: var(--admin-bg); color: var(--admin-text); }
.btn-outline-light { background: transparent; color: rgba(255,255,255,0.8); border: 1px solid rgba(255,255,255,0.3); font-size: 0.8rem; padding: 6px 14px; }
.btn-outline-light:hover { background: rgba(255,255,255,0.1); color: #fff; }
.btn-sm { font-size: 0.78rem; padding: 6px 14px; }
.btn-full { width: 100%; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 8px; background: transparent; border: 1px solid var(--admin-border); }
.btn-icon:hover { background: var(--admin-bg); }
.btn-link { color: rgba(255,255,255,0.8); text-decoration: none; font-size: 0.85rem; transition: color 0.2s; }
.btn-link:hover { color: #fff; }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1D1D1F 0%, #2C2C2C 50%, #1D1D1F 100%);
}
.login-card {
  background: rgba(255,255,255,0.06); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px; padding: 48px 40px; width: 100%; max-width: 380px; text-align: center;
}
.login-logo {
  font-size: 2rem; font-weight: 700; color: #fff; letter-spacing: 2px; margin-bottom: 4px;
}
.login-subtitle {
  color: rgba(255,255,255,0.5); font-size: 0.85rem; margin-bottom: 32px;
}
.login-card .form-group { margin-bottom: 20px; text-align: left; }
.login-card label { display: block; font-size: 0.78rem; font-weight: 500; color: rgba(255,255,255,0.6); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.login-card input {
  width: 100%; padding: 12px 14px; font-family: var(--font); font-size: 0.95rem;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px; color: #fff; outline: none; transition: border 0.2s;
}
.login-card input:focus { border-color: var(--admin-primary); }
.login-card input::placeholder { color: rgba(255,255,255,0.3); }
.login-card .btn-primary { margin-top: 8px; }
.login-error { color: var(--admin-danger); font-size: 0.82rem; margin-top: 12px; min-height: 20px; }

/* ============================================================
   ADMIN HEADER
   ============================================================ */
.admin-header {
  background: var(--admin-dark); color: #fff; padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.admin-header-left { display: flex; align-items: center; gap: 10px; }
.admin-logo { font-size: 1.15rem; font-weight: 700; letter-spacing: 1.5px; }
.admin-badge { font-size: 0.65rem; font-weight: 600; background: var(--admin-primary); color: #fff; padding: 2px 8px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.admin-header-right { display: flex; align-items: center; gap: 12px; }

/* ============================================================
   ADMIN CONTAINER
   ============================================================ */
.admin-container {
  max-width: 1200px; margin: 0 auto; padding: 24px;
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--admin-card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.gold { background: rgba(201,169,110,0.12); color: var(--admin-primary); }
.stat-icon.gold svg { stroke: var(--admin-primary); fill: none; }
.stat-info h4 { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.stat-info p { font-size: 0.78rem; color: var(--admin-muted); margin-top: 2px; }

/* ---- Action Bar ---- */
.action-bar {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.action-bar h2 { font-size: 1.2rem; font-weight: 700; }
.action-bar-right { display: flex; align-items: center; gap: 10px; }
.select-filter {
  font-family: var(--font); font-size: 0.85rem; padding: 8px 32px 8px 12px;
  border: 1px solid var(--admin-border); border-radius: 8px; background: var(--admin-card);
  cursor: pointer; outline: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}

/* ---- Product Table ---- */
.table-wrapper {
  background: var(--admin-card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.product-table { width: 100%; border-collapse: collapse; }
.product-table th {
  text-align: left; padding: 14px 16px; font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--admin-muted);
  border-bottom: 1px solid var(--admin-border); background: var(--admin-bg);
}
.product-table td {
  padding: 12px 16px; font-size: 0.88rem; border-bottom: 1px solid var(--admin-border);
  vertical-align: middle;
}
.product-table tbody tr { transition: background 0.15s; }
.product-table tbody tr:hover { background: #FAFAFA; }
.product-table tbody tr:last-child td { border-bottom: none; }

.table-img {
  width: 56px; height: 56px; border-radius: 8px; object-fit: cover;
  background: var(--admin-bg); border: 1px solid var(--admin-border);
}
.price-normal { text-decoration: line-through; color: var(--admin-muted); font-size: 0.82rem; }
.price-promo { font-weight: 700; color: var(--admin-primary); }
.category-tag {
  display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 3px 10px;
  border-radius: 20px; background: rgba(201,169,110,0.1); color: var(--admin-primary);
}
.action-btns { display: flex; gap: 6px; }

/* ---- Empty State ---- */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--admin-muted);
}
.empty-state svg { margin-bottom: 12px; stroke: var(--admin-border); }
.empty-state p { margin-bottom: 16px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--admin-card); border-radius: 14px; width: 100%; max-width: 640px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-small { max-width: 420px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--admin-border);
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--admin-bg);
  font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.modal-close:hover { background: var(--admin-border); }
.modal-body { padding: 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px; border-top: 1px solid var(--admin-border);
}

/* ---- Form Elements ---- */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 0.78rem; font-weight: 600; color: var(--admin-muted);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.3px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 14px; font-family: var(--font); font-size: 0.9rem;
  border: 1px solid var(--admin-border); border-radius: 8px;
  background: var(--admin-card); color: var(--admin-text); outline: none;
  transition: border 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--admin-primary); box-shadow: 0 0 0 3px rgba(201,169,110,0.1); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.flex-2 { flex: 2 !important; }
.flex-1 { flex: 1 !important; }

/* ---- Image Upload ---- */
.image-upload-area {
  position: relative; border: 2px dashed var(--admin-border); border-radius: var(--radius);
  min-height: 160px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color 0.2s; overflow: hidden;
}
.image-upload-area:hover { border-color: var(--admin-primary); }
.file-input {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 2;
}
.upload-placeholder { text-align: center; color: var(--admin-muted); }
.upload-placeholder svg { margin-bottom: 8px; stroke: var(--admin-border); }
.upload-placeholder p { font-size: 0.88rem; font-weight: 500; }
.upload-placeholder span { font-size: 0.75rem; }
.image-preview {
  width: 100%; height: 200px; object-fit: contain; border-radius: 8px;
}

.text-muted { color: var(--admin-muted); font-size: 0.85rem; margin-top: 4px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .admin-container { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .action-bar { flex-direction: column; align-items: stretch; }
  .action-bar-right { flex-direction: column; }
  .form-row { flex-direction: column; gap: 0; }
  .product-table th:nth-child(6), .product-table td:nth-child(6) { display: none; }

  .table-wrapper { overflow-x: auto; }
  .product-table { min-width: 600px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .admin-header { padding: 0 12px; }
  .login-card { padding: 32px 24px; margin: 16px; }
}

/* ============================================================
   PROFORMAS CUSTOM STYLES
   ============================================================ */

/* ---- Navigation Tabs ---- */
.admin-tabs {
  display: flex;
  gap: 12px;
  background: var(--admin-card);
  padding: 8px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.tab-btn {
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--admin-muted);
  background: transparent;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn:hover {
  color: var(--admin-text);
  background: var(--admin-bg);
}
.tab-btn.active {
  color: #fff;
  background: var(--admin-primary);
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* ---- Proforma Item Cards ---- */
.proforma-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.proforma-item-card {
  background: var(--admin-bg);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}
.proforma-item-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.proforma-item-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: #fff;
  border-bottom: 1px solid var(--admin-border);
}
.proforma-item-info {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.proforma-item-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--admin-text);
}
.proforma-item-meta {
  font-size: 0.8rem;
  color: var(--admin-muted);
  margin-bottom: 4px;
}
.proforma-item-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--admin-border);
}
.proforma-item-price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--admin-primary);
}
.proforma-item-qty {
  font-size: 0.8rem;
  background: var(--admin-border);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--admin-text);
  font-weight: 600;
}
.proforma-item-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.proforma-item-actions button {
  flex: 1;
  font-size: 0.78rem;
  padding: 6px;
  font-weight: 600;
}

/* ---- Status Badges ---- */
.status-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-badge.borrador {
  background: rgba(134, 134, 139, 0.15);
  color: #86868B;
}
.status-badge.enviada {
  background: rgba(0, 122, 255, 0.15);
  color: #007AFF;
}
.status-badge.aceptada {
  background: rgba(52, 199, 89, 0.15);
  color: var(--admin-success);
}

