/* css/style.css - Business Service System */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&family=Kanit:wght@400;500;600;700&display=swap');

:root {
  --primary: #00aaee;
  --primary-dark: #0088cc;
  --primary-light: #33bbff;
  --primary-bg: #e8f7fd;
  --secondary: #6c757d;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --dark: #2c3e50;
  --light: #f8f9fa;
  --white: #ffffff;
  --border: #dee2e6;
  --shadow: 0 4px 20px rgba(0,170,238,0.15);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-lg: 16px;
  --font-main: 'Sarabun', sans-serif;
  --font-head: 'Kanit', sans-serif;
  --transition: all 0.25s ease;
}

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

body {
  font-family: var(--font-main);
  background: #f0f4f8;
  color: var(--dark);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e8f7fd 0%, #ffffff 50%, #e8f7fd 100%);
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  border-top: 4px solid var(--primary);
}

.logo-box {
  width: 120px; height: 120px;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-family: var(--font-head);
  font-size: 28px; font-weight: 700;
  color: var(--primary);
  background: var(--primary-bg);
  letter-spacing: 1px;
}

.login-title { font-family: var(--font-head); color: var(--primary); font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { font-weight: 700; font-size: 15px; margin-bottom: 28px; color: var(--dark); }

.form-group { text-align: left; margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 14px; }
.form-group input {
  width: 100%; padding: 10px 14px;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  font-family: var(--font-main);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}
.form-group input:focus { border-color: var(--primary-dark); box-shadow: 0 0 0 3px rgba(0,170,238,0.15); }

.btn-row { display: flex; gap: 12px; margin-top: 20px; }
.btn {
  flex: 1; padding: 11px 20px;
  border: none; border-radius: var(--radius);
  font-family: var(--font-main); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: var(--transition); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: #5a6268; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c82333; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #218838; }
.btn-warning { background: var(--warning); color: #333; }
.btn-sm { padding: 6px 12px; font-size: 13px; flex: unset; }

.alert {
  padding: 12px 16px; border-radius: var(--radius);
  margin-bottom: 16px; font-size: 14px; font-weight: 500;
}
.alert-danger { background: #fdecea; color: #c0392b; border: 1px solid #f5c6cb; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background: var(--primary-bg); color: var(--primary-dark); border: 1px solid #bee5eb; }

/* ===== DASHBOARD / MAIN LAYOUT ===== */
.app-header {
  background: var(--white);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 0 24px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}

.app-header .brand {
  font-family: var(--font-head);
  font-size: 22px; font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: 0.5px;
}

.header-right { display: flex; align-items: center; gap: 16px; }
.user-badge {
  background: var(--primary-bg);
  color: var(--primary-dark);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px; font-weight: 600;
}
.role-badge {
  padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.role-admin { background: #fff3e0; color: #e65100; }
.role-manager { background: #e8f5e9; color: #2e7d32; }
.role-user { background: var(--primary-bg); color: var(--primary-dark); }

/* ===== DASHBOARD MENU ===== */
.dashboard-wrap {
  max-width: 700px; margin: 0 auto;
  padding: 32px 20px;
}

.page-title-section { text-align: center; margin-bottom: 28px; }
.page-title-section h1 { font-family: var(--font-head); font-size: 32px; color: var(--primary); font-weight: 700; }
.login-by { font-size: 14px; color: var(--secondary); margin-top: 4px; }
.login-by span { color: var(--primary); font-weight: 600; }

.menu-grid { display: flex; flex-direction: column; gap: 10px; }

.menu-btn {
  display: block; width: 100%; padding: 18px 24px;
  background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius);
  font-family: var(--font-head); font-size: 18px; font-weight: 700;
  cursor: pointer; text-align: center; text-decoration: none;
  transition: var(--transition); letter-spacing: 0.5px;
  box-shadow: 0 3px 10px rgba(0,170,238,0.25);
}
.menu-btn:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: var(--shadow); color: #fff; }
.menu-btn.disabled {
  background: #bdc3c7; cursor: not-allowed; opacity: 0.7;
  box-shadow: none;
}
.menu-btn.disabled:hover { transform: none; background: #bdc3c7; }

.menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn-logout {
  display: block; width: 100%; padding: 16px 24px;
  background: var(--secondary); color: #fff;
  border: none; border-radius: var(--radius);
  font-family: var(--font-head); font-size: 16px; font-weight: 600;
  cursor: pointer; text-align: center; text-decoration: none;
  transition: var(--transition); margin-top: 10px;
}
.btn-logout:hover { background: #5a6268; color: #fff; }

.footer-text { text-align: center; margin-top: 20px; font-size: 13px; color: var(--secondary); }
.footer-text span { color: var(--primary); font-weight: 600; }

/* ===== PAGE CONTENT ===== */
.page-wrap { max-width: 1100px; margin: 0 auto; padding: 28px 20px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-family: var(--font-head); font-size: 24px; color: var(--primary); font-weight: 700; }
.breadcrumb { font-size: 13px; color: var(--secondary); margin-bottom: 20px; }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ===== CARDS ===== */
.card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  padding: 24px; margin-bottom: 20px;
}
.card-title { font-family: var(--font-head); font-size: 16px; font-weight: 700; margin-bottom: 16px; color: var(--dark); border-bottom: 2px solid var(--primary-bg); padding-bottom: 10px; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { background: var(--primary); color: #fff; padding: 12px 14px; text-align: left; font-weight: 600; font-size: 13px; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
tbody tr:hover { background: var(--primary-bg); }
tbody td { padding: 11px 14px; vertical-align: middle; }
.badge { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-active { background: #d4edda; color: #155724; }
.badge-inactive { background: #f8d7da; color: #721c24; }
.badge-admin { background: #fff3e0; color: #e65100; }
.badge-manager { background: #e8f5e9; color: #2e7d32; }
.badge-user { background: var(--primary-bg); color: var(--primary-dark); }

/* ===== 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;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 28px;
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(-20px); transition: transform 0.25s;
}
.modal-overlay.active .modal-box { transform: translateY(0); }
.modal-title { font-family: var(--font-head); font-size: 18px; font-weight: 700; margin-bottom: 20px; color: var(--dark); border-bottom: 2px solid var(--primary-bg); padding-bottom: 12px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ===== FORM ===== */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-family: var(--font-main); font-size: 14px; outline: none;
  transition: var(--transition);
}
.form-row input:focus, .form-row select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,170,238,0.12); }

/* ===== PERMISSIONS GRID ===== */
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.perm-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius);
  border: 1.5px solid var(--border); background: var(--light);
  transition: var(--transition); cursor: pointer;
}
.perm-item:hover { border-color: var(--primary); background: var(--primary-bg); }
.perm-item input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
.perm-item label { font-size: 13px; font-weight: 500; cursor: pointer; flex: 1; }

/* ===== LOG TABLE ===== */
.log-action { font-size: 12px; padding: 3px 8px; border-radius: 8px; }
.log-login { background: #d4edda; color: #155724; }
.log-logout { background: #f8d7da; color: #721c24; }
.log-user { background: var(--primary-bg); color: var(--primary-dark); }
.log-menu { background: #fff3cd; color: #856404; }

/* ===== SEARCH / FILTER ===== */
.search-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-bar input, .search-bar select {
  padding: 8px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-family: var(--font-main);
  font-size: 14px; outline: none; min-width: 180px;
}
.search-bar input:focus, .search-bar select:focus { border-color: var(--primary); }

/* ===== DENIED ===== */
.denied-wrap { text-align: center; padding: 60px 20px; }
.denied-wrap .icon { font-size: 64px; margin-bottom: 16px; }
.denied-wrap h2 { font-family: var(--font-head); color: var(--danger); margin-bottom: 10px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .login-card { padding: 32px 20px; }
  .menu-row { grid-template-columns: 1fr; }
  .perm-grid { grid-template-columns: 1fr; }
  .dashboard-wrap { padding: 20px 12px; }
  .app-header { padding: 0 14px; }
}
