:root{
  --bg:#0b1220; --panel:#0f172a; --muted:#94a3b8; --text:#e2e8f0;
  --brand:#0ea5e9; --brand-2:#22d3ee; --danger:#ef4444; --ok:#22c55e;
  --radius:18px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;background:var(--bg);color:var(--text);font-family:Inter,ui-sans-serif,system-ui,Segoe UI,Roboto,Apple Color Emoji,Noto Color Emoji,EmojiSymbols,Arial,sans-serif}
a{color:inherit;text-decoration:none}
.container{max-width:1024px;margin:0 auto;padding:16px;padding-bottom:80px}

.top-nav{
  display:none;
  padding:12px 16px;
  border-bottom:1px solid #1f2937;
  background:rgba(15,23,42,.6); backdrop-filter: blur(8px);
  position:sticky; top:0; z-index:20;
}
.top-nav .brand{font-weight:700; font-size:1.1rem; color:var(--brand)}
.top-nav nav{display:flex; gap:14px; align-items:center}
.top-nav nav a{padding:8px 12px;border-radius:12px}
.top-nav nav a:hover{background:#111827}

.bottom-nav{
  position:fixed; bottom:0; left:0; right:0;
  background:rgba(15,23,42,.85); backdrop-filter: blur(8px);
  border-top:1px solid #1f2937;
  display:flex; justify-content:space-around; padding:6px 8px; z-index:30;
}
.bottom-nav a{display:flex; flex-direction:column; align-items:center; gap:2px; font-size:.8rem; padding:6px 8px; border-radius:12px; color:var(--muted)}
.bottom-nav a:hover{background:#0b1220;color:var(--text)}

.hero{padding:32px 16px; text-align:center; background:linear-gradient(180deg, rgba(14,165,233,.1), transparent); border-radius:var(--radius)}
.hero h1{font-size:1.8rem;margin:.2rem 0 0.5rem}
.hero p{color:var(--muted); margin:0 auto 1rem; max-width:640px}
.cta-row{display:flex; gap:10px; justify-content:center; flex-wrap:wrap}
.btn{background:var(--brand); color:#001018; border-radius:16px; padding:10px 14px; font-weight:700; box-shadow:0 10px 25px rgba(14,165,233,.2)}
.btn:disabled{background:#64748b; color:#94a3b8; cursor:not-allowed; opacity:0.7}
.btn.outline{background:transparent; color:var(--text); border:1px solid #263144}
.btn.outline:disabled{background:transparent; color:#94a3b8; border:1px solid #94a3b8; cursor:not-allowed; opacity:0.7}

.features{display:grid; gap:12px; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); margin:28px 0}
.card{background:var(--panel); border:1px solid #1f2937; border-radius:var(--radius); padding:14px}
.card h3{margin:.2rem 0 .2rem}
.card p{color:var(--muted); margin:0}

.grid{display:grid; gap:14px; grid-template-columns:repeat(auto-fill,minmax(220px,1fr))}
.product-card{background:var(--panel); border:1px solid #1f2937; border-radius:var(--radius); overflow:hidden; position:relative}
.product-card img{width:100%; height:140px; object-fit:cover; background:#0b1220; cursor:pointer}
.product-card .info{padding:12px}
.badge{display:inline-flex; gap:6px; align-items:center; font-size:.75rem; color:#9ca3af; padding:4px 8px; border:1px solid #1f2937; border-radius:999px}

.toolbar{display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:10px}
.input, select, textarea{background:#0b1220; color:var(--text); border:1px solid #1f2937; border-radius:12px; padding:10px 12px; width:100%}
.row{display:grid; grid-template-columns:1fr; gap:12px}
.kpi{display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:12px}
.kpi .card strong{font-size:1.4rem}

.table{width:100%; border-collapse:collapse}
.table th, .table td{border-bottom:1px solid #1f2937; padding:10px 8px; text-align:left}
.table th{color:#94a3b8; font-weight:600}

.toast{position:fixed; top:60px; right:14px; background:#122032; border:1px solid #1f2937; color:#cbd5e1; padding:10px 14px; border-radius:12px; display:none; z-index:100}
.toast.show{display:block}

@media(min-width:980px){
  .top-nav{display:flex; align-items:center; justify-content:space-between}
  .bottom-nav{display:none}
  .hero h1{font-size:2.2rem}
  .row{grid-template-columns:repeat(2,1fr)}
}

.auth-container{max-width:380px;margin:80px auto;padding:25px;border-radius:12px;box-shadow:0 6px 16px rgba(0,0,0,0.15);background:#fff;text-align:center}
.auth-container h2{margin-bottom:20px;color:#333}
.auth-container form{display:flex;flex-direction:column;gap:15px}
.auth-container input{padding:12px;border:1px solid #ccc;border-radius:8px;font-size:15px;outline:none;transition:border 0.2s}
.auth-container input:focus{border-color:#007bff}
.password-wrapper{position:relative;display:flex;align-items:center}
.password-wrapper input{flex:1}
.password-wrapper button{position:absolute;right:8px;background:none;border:none;cursor:pointer;font-size:16px;opacity:0.6}
.password-wrapper button:hover{opacity:1}
.auth-container button[type="submit"]{padding:12px;border:none;border-radius:8px;background:#007bff;color:white;font-size:16px;cursor:pointer;transition:background 0.2s}
.auth-container button[type="submit"]:hover{background:#0056b3}
.auth-container p{margin-top:15px;font-size:14px}
.auth-container a{color:#007bff;text-decoration:none}
.auth-container a:hover{text-decoration:underline}

/* Loading indicator */
.loading {
  display: inline-block;
  font-size: 1rem;
  font-weight: 500;
}

.loading::after {
  content: " ...";
  animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
  0% { content: " ."; }
  33% { content: " .."; }
  66% { content: " ..."; }
}

/* Hidden class for elements that should be hidden */
.hidden {
  display: none !important;
}

/* Provider Section */
.provider-section {
  margin: 20px 0;
}

.provider-section h3 {
  margin-bottom: 12px;
  color: var(--text);
}

.provider-grid {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.provider-item {
  width: 70px;
  height: 70px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid #1f2937;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.provider-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
  border-color: var(--brand);
}

.provider-item img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
}

.provider-item .provider-name {
  font-size: 0.7rem;
  text-align: center;
  color: var(--text);
  padding: 5px;
}

/* Provider Dropdown */
.provider-dropdown {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.provider-dropdown .card {
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

/* Product Modal */
.product-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-modal .card {
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #1f2937;
}

.modal-header h4 {
  margin: 0;
  color: var(--text);
}

.product-details-grid {
  display: grid;
  gap: 15px;
}

.product-detail-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
  background: #0b1220;
}

.product-detail-info {
  display: grid;
  gap: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-label {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.9rem;
}

.detail-value {
  color: var(--text);
  font-weight: 500;
}

.dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #1f2937;
}

.dropdown-header h4 {
  margin: 0;
  color: var(--text);
}

.close-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  color: var(--brand);
}

.provider-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
}

.provider-product-card {
  background: var(--panel);
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 10px;
}

.provider-product-card img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}

.provider-product-card .name {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 5px;
  display: block;
}

.provider-product-card .price {
  font-size: 0.9rem;
  color: var(--brand);
  font-weight: 700;
}

.provider-product-card .stock {
  font-size: 0.7rem;
  color: var(--muted);
}

.add-to-cart-btn {
  width: 100%;
  margin-top: 8px;
  padding: 6px;
  background: var(--brand);
  color: #001018;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.add-to-cart-btn:hover {
  opacity: 0.9;
}

.add-to-cart-btn:disabled {
  background: #64748b;
  color: #94a3b8;
  cursor: not-allowed;
  opacity: 0.7;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-item label {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.9rem;
}

.info-value {
  padding: 8px 12px;
  background: #0b1220;
  border: 1px solid #1f2937;
  border-radius: 12px;
  color: var(--text);
}

/* Modal styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Ensure modal is properly centered */
  text-align: center;
  /* Additional properties for better centering */
  align-content: center;
  flex-wrap: wrap;
}

.modal-content {
  background: var(--panel);
  border: 1px solid #1f2937;
  border-radius: var(--radius);
  padding: 20px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  /* Additional centering properties */
  margin: auto;
  text-align: left;
  /* Ensure content doesn't overflow */
  box-sizing: border-box;
}

.modal-content .close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  color: var(--text);
  cursor: pointer;
}

.modal-content .close:hover {
  color: var(--brand);
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: var(--text);
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}
