/* =========================================
   Rice Mill Trade - Admin Panel Styles
   ========================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --admin-primary: #1a5f7a;
  --admin-dark: #0f2a37;
  --admin-bg: #f1f5f9;
  --admin-card: #ffffff;
  --admin-text: #1e293b;
  --admin-muted: #64748b;
  --admin-border: #e2e8f0;
  --admin-success: #10b981;
  --admin-danger: #ef4444;
  --admin-warning: #f59e0b;
  --admin-info: #3b82f6;
  --transition: all 0.2s ease;
}
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--admin-bg); color: var(--admin-text); }
a { color: inherit; text-decoration: none; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border: none; border-radius: 8px; font-size: 0.95rem;
  font-weight: 600; cursor: pointer; transition: var(--transition);
}
.btn-primary { background: var(--admin-primary); color: #fff; }
.btn-primary:hover { background: var(--admin-dark); }
.btn-success { background: var(--admin-success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--admin-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: transparent; color: var(--admin-primary); border: 2px solid var(--admin-primary); }
.btn-outline:hover { background: var(--admin-primary); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.input-group { margin-bottom: 18px; }
.input-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.95rem; color: var(--admin-text); }
.input-group input, .input-group select, .input-group textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--admin-border); border-radius: 8px;
  font-size: 0.95rem; background: #fff; transition: var(--transition);
}
.input-group input:focus, .input-group select:focus, .input-group textarea:focus {
  outline: none; border-color: var(--admin-primary);
}
.hidden { display: none !important; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 12px; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; }
.badge-spare { background: #e3f2fd; color: #1565c0; }
.badge-recon { background: #fff3e0; color: #ef6c00; }
.badge-solar { background: #e8f5e9; color: #2e7d32; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 0.95rem; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e3a8a; border: 1px solid #bfdbfe; }
/* Login */
.login-page { min-height: 100vh; background: linear-gradient(135deg, var(--admin-primary) 0%, var(--admin-dark) 100%); display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: #fff; padding: 48px; border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,0.25); width: 100%; max-width: 400px; }
.login-card h2 { text-align: center; margin-bottom: 8px; color: var(--admin-primary); font-size: 1.75rem; }
.login-card p { text-align: center; color: var(--admin-muted); margin-bottom: 30px; font-size: 0.95rem; }
.login-card .btn { width: 100%; justify-content: center; }

/* Dashboard Layout */
.dashboard { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 260px; background: var(--admin-dark); color: #fff; display: flex; flex-direction: column;
  transition: var(--transition);
}
.sidebar-header { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-header h2 { font-size: 1.25rem; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.sidebar-nav { flex: 1; padding: 20px 0; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 14px; padding: 14px 24px; color: rgba(255,255,255,0.7);
  font-size: 0.95rem; border-left: 4px solid transparent; transition: var(--transition);
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,0.08); color: #fff; border-left-color: var(--admin-success); }
.sidebar-footer { padding: 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.main-content { flex: 1; overflow-y: auto; padding: 30px; background: var(--admin-bg); }

/* Topbar */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; background: #fff; padding: 20px 30px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.topbar h1 { font-size: 1.5rem; color: var(--admin-primary); }
.user-info { display: flex; align-items: center; gap: 12px; }
.user-info span { font-size: 0.9rem; color: var(--admin-muted); }
.logout-btn { background: var(--admin-danger); color: #fff; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 0.9rem; }
.logout-btn:hover { background: #dc2626; }

/* Cards Grid */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: #fff; padding: 24px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); display: flex; justify-content: space-between; align-items: center; }
.stat-card h3 { font-size: 2rem; color: var(--admin-primary); }
.stat-card p { color: var(--admin-muted); font-size: 0.9rem; }
.stat-card .icon { font-size: 2rem; opacity: 0.2; }

/* Table */
.table-wrap { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); overflow: hidden; margin-bottom: 30px; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 16px; text-align: left; border-bottom: 1px solid var(--admin-border); }
th { background: #f8fafc; font-weight: 700; color: var(--admin-muted); text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.05em; }
tr:hover { background: #f8fafc; }
tr td img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--admin-border); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0,0,0,0.3); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--admin-border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 1.25rem; color: var(--admin-primary); }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--admin-muted); line-height: 1; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--admin-border); display: flex; justify-content: flex-end; gap: 10px; }

/* Feature toggles */
.features-list { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); overflow: hidden; }
.feature-item { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; border-bottom: 1px solid var(--admin-border); }
.feature-item:last-child { border-bottom: none; }
.feature-item h4 { font-size: 1rem; font-weight: 600; }
.feature-item p { font-size: 0.9rem; color: var(--admin-muted); margin-top: 4px; }
.toggle { position: relative; width: 52px; height: 28px; background: var(--admin-border); border-radius: 14px; cursor: pointer; transition: var(--transition); }
.toggle.active { background: var(--admin-success); }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; background: #fff; border-radius: 50%; transition: var(--transition); }
.toggle.active::after { transform: translateX(24px); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .topbar { flex-direction: column; gap: 15px; align-items: stretch; }
  .stat-cards { grid-template-columns: 1fr; }
  table { font-size: 0.85rem; }
  th, td { padding: 12px 8px; }
}