/* ==========================================================================
   ADMIN PANEL STYLES - HYDROTECH
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e9ecef;
  --accent: #e11d48;
  --accent-hover: #ef4444;
  --accent-dark: #7f1d1d;
  --text-primary: #18191d;
  --text-secondary: #495057;
  --text-muted: #868e96;
  --border: rgba(0, 0, 0, 0.08);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --trans: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { background: var(--bg-primary); color: var(--text-primary); font-family: var(--font-body); line-height: 1.6; min-height: 100vh; }
h1,h2,h3,h4 { font-family: var(--font-heading); font-weight: 700; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; outline: none; }

/* LOGIN */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(circle at 50% 0%, rgba(225,29,72,0.05) 0%, transparent 60%); }
.login-card { width: 100%; max-width: 420px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 48px 40px; box-shadow: 0 15px 40px rgba(0,0,0,0.06); }
.login-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 32px; font-family: var(--font-heading); font-size: 1.6rem; font-weight: 800; background: linear-gradient(135deg, #e11d48, #7f1d1d); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.login-title { text-align: center; font-size: 1.4rem; margin-bottom: 8px; }
.login-sub { text-align: center; color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 32px; }
.login-error { color: var(--danger); font-size: 0.85rem; text-align: center; margin-top: 12px; min-height: 20px; }

/* FORMS */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-weight: 500; font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 8px; }
.form-control { width: 100%; padding: 12px 16px; background: rgba(0,0,0,0.02); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); transition: var(--trans); }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(225,29,72,0.08); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control { cursor: pointer; }
select.form-control option { background: var(--bg-secondary); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-full { grid-column: 1 / -1; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 24px; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; transition: var(--trans); font-size: 0.9rem; }
.btn-primary { background: linear-gradient(135deg, #e11d48, #7f1d1d); color: #fff; box-shadow: 0 0 20px rgba(225,29,72,0.15); width: 100%; }
.btn-primary:hover { box-shadow: 0 0 28px rgba(225,29,72,0.25); transform: translateY(-1px); }
.btn-secondary { background: rgba(0,0,0,0.02); border: 1px solid var(--border); }
.btn-secondary:hover { background: rgba(0,0,0,0.04); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-warning { background: var(--warning); color: #000; }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); background: rgba(0,0,0,0.02); border: 1px solid var(--border); }
.btn-icon:hover { background: rgba(0,0,0,0.04); }
.btn-wide { width: 100%; }

/* ADMIN LAYOUT */
.admin-layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.admin-sidebar { width: 240px; background: var(--bg-secondary); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; transition: transform var(--trans); overflow-y: auto; }
.sidebar-brand { padding: 24px 20px; border-bottom: 1px solid var(--border); font-family: var(--font-heading); font-weight: 800; font-size: 1.2rem; background: linear-gradient(135deg, #e11d48, #7f1d1d); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sidebar-brand small { display: block; font-size: 0.65rem; color: var(--text-muted); -webkit-text-fill-color: var(--text-muted); background: none; -webkit-background-clip: unset; letter-spacing: 0.1em; text-transform: uppercase; margin-top: 2px; }
.sidebar-menu { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer; transition: var(--trans); font-weight: 500; font-size: 0.9rem; border: none; background: none; width: 100%; text-align: left; }
.sidebar-item:hover { background: rgba(0,0,0,0.04); color: var(--text-primary); }
.sidebar-item.active { background: rgba(225,29,72,0.08); color: var(--accent); border-left: 3px solid var(--accent); padding-left: 11px; }
.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-divider { height: 1px; background: var(--border); margin: 8px 12px; }
.sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--border); }

/* MAIN CONTENT */
.admin-main { margin-left: 240px; flex: 1; min-height: 100vh; display: flex; flex-direction: column; }
.admin-topbar { height: 64px; background: rgba(255,255,255,0.8); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 32px; gap: 16px; position: sticky; top: 0; z-index: 50; }
.topbar-title { font-size: 1.1rem; font-weight: 600; flex: 1; }
.topbar-badge { background: rgba(225,29,72,0.08); color: var(--accent); border: 1px solid rgba(225,29,72,0.15); padding: 4px 10px; border-radius: 100px; font-size: 0.78rem; font-weight: 600; }
.admin-content { padding: 32px; flex: 1; }

/* PANELS */
.panel { display: none; }
.panel.active { display: block; }

/* STAT CARDS */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 24px; display: flex; flex-direction: column; gap: 8px; transition: var(--trans); }
.stat-card:hover { border-color: rgba(225,29,72,0.35); transform: translateY(-2px); }
.stat-card-icon { font-size: 2rem; }
.stat-card-label { font-size: 0.78rem; color: var(--text-secondary); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-card-value { font-family: var(--font-heading); font-size: 2rem; font-weight: 800; color: var(--accent); }

/* TABLE */
.table-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 24px; }
.table-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.table-title { font-size: 1rem; font-weight: 600; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { background: rgba(0,0,0,0.02); padding: 12px 20px; text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; }
.admin-table td { padding: 14px 20px; border-top: 1px solid rgba(0,0,0,0.04); font-size: 0.88rem; vertical-align: middle; }
.admin-table tr:hover td { background: rgba(0,0,0,0.02); }
.table-actions { display: flex; gap: 6px; align-items: center; }

/* FORM PANEL */
.form-panel { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 28px; margin-bottom: 24px; }
.form-panel-title { font-size: 1rem; font-weight: 600; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }

/* BADGE */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 100px; font-size: 0.72rem; font-weight: 600; }
.badge-red { background: rgba(225,29,72,0.15); color: var(--accent); }
.badge-green { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-orange { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-gray { background: rgba(0,0,0,0.06); color: var(--text-secondary); }

/* MODAL */
.admin-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.75); backdrop-filter: blur(8px); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity var(--trans); }
.admin-modal-overlay.active { opacity: 1; pointer-events: all; }
.admin-modal { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; padding: 32px; transform: scale(0.95); transition: transform var(--trans); }
.admin-modal-overlay.active .admin-modal { transform: scale(1); }
.modal-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-close-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.5rem; line-height: 1; transition: var(--trans); padding: 0; }
.modal-close-btn:hover { color: var(--text-primary); }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

/* TOAST */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 20px; display: flex; align-items: center; gap: 10px; font-size: 0.88rem; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,0.4); animation: slideIn 0.3s ease; min-width: 260px; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 60px 24px; color: var(--text-secondary); }
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text-primary); }
.empty-state p { font-size: 0.9rem; margin-bottom: 20px; }

/* SPEC BUILDER */
.spec-row-builder { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.spec-row-builder input { flex: 1; padding: 9px 12px; background: rgba(0,0,0,0.02); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 0.85rem; transition: var(--trans); }
.spec-row-builder input:focus { border-color: var(--accent); outline: none; }

/* MOBILE */
.mobile-menu-btn { display: none; position: fixed; top: 16px; left: 16px; z-index: 200; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; cursor: pointer; color: var(--text-primary); align-items: center; justify-content: center; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; }

@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .admin-main { margin-left: 0; }
  .admin-topbar { padding: 0 16px 0 60px; }
  .admin-content { padding: 20px 16px; }
  .mobile-menu-btn { display: flex; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .admin-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; }
}
