/* ========================================================
   FORDTER — css/app.css   (HR-Center Layout System)
   ======================================================== */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --primary: #1B4F9A;
  --primary-light: #EBF2FF;
  --accent: #F59E0B;
  --success: #16A34A;
  --danger: #EF4444;
  --bg: #F5F6FA;
  --card-bg: #fff;
  --border: #E2E8F0;
  --text: #1E293B;
  --text-sub: #64748B;
  --sidebar-active: #1B4F9A;
  --font: 'Sarabun', 'Inter', sans-serif;
  --shadow: 0 1px 4px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --radius: 12px;
}

*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%;font-family:var(--font);font-size:15px;color:var(--text);background:var(--bg);}
a{text-decoration:none;color:inherit}
button{cursor:pointer;font-family:var(--font);}

/* ── APP LAYOUT ── */
.app-wrap{display:flex;min-height:100vh;}

/* ── SIDEBAR ── */
.app-sidebar{
  width:var(--sidebar-w);position:fixed;top:0;left:0;height:100vh;
  background:#fff;border-right:1px solid var(--border);
  display:flex;flex-direction:column;z-index:200;
  box-shadow:2px 0 12px rgba(0,0,0,.05);overflow-y:auto;
}
.sidebar-logo{
  padding:20px 22px 16px;border-bottom:1px solid var(--border);
  display:flex;align-items:center;gap:12px;flex-shrink:0;
}
.sidebar-logo-icon{
  width:40px;height:40px;border-radius:10px;
  background:linear-gradient(135deg,#1B4F9A,#2563EB);
  display:flex;align-items:center;justify-content:center;
  color:#fff;font-weight:900;font-size:1rem;letter-spacing:-.02em;flex-shrink:0;
}
.sidebar-logo-text{font-weight:800;font-size:1.05rem;color:var(--primary);letter-spacing:.02em;}
.sidebar-logo-sub{font-size:.7rem;color:var(--text-sub);font-weight:500;}

.sidebar-section-label{
  padding:18px 22px 6px;
  font-size:.68rem;font-weight:700;letter-spacing:.1em;
  text-transform:uppercase;color:#94A3B8;
}
.sidebar-nav-item{
  display:flex;align-items:center;gap:12px;
  padding:11px 22px;margin:1px 10px;
  border-radius:10px;font-size:.88rem;font-weight:600;
  color:var(--text-sub);transition:all .15s;border:none;background:none;
  width:calc(100% - 20px);text-align:left;position:relative;
}
.sidebar-nav-item:hover{background:var(--primary-light);color:var(--primary);}
.sidebar-nav-item.active{background:var(--primary-light);color:var(--primary);font-weight:700;}
.sidebar-nav-item.active::before{
  content:'';position:absolute;left:-10px;top:50%;transform:translateY(-50%);
  width:4px;height:22px;background:var(--primary);border-radius:0 4px 4px 0;
}
.sidebar-nav-item i{width:19px;height:19px;flex-shrink:0;}
.sidebar-nav-badge{
  margin-left:auto;background:var(--danger);color:#fff;
  border-radius:20px;padding:2px 8px;font-size:.68rem;font-weight:800;
}
.sidebar-bottom{margin-top:auto;border-top:1px solid var(--border);padding:14px 10px;}
.sidebar-logout{
  display:flex;align-items:center;gap:10px;padding:10px 22px;
  border-radius:10px;color:var(--danger);font-weight:600;font-size:.88rem;
  border:none;background:none;width:100%;cursor:pointer;
  transition:background .15s;
}
.sidebar-logout:hover{background:#FEF2F2;}

/* ── MAIN AREA ── */
.app-main{margin-left:var(--sidebar-w);flex:1;display:flex;flex-direction:column;min-height:100vh;}

/* ── TOPBAR ── */
.app-topbar{
  height:var(--topbar-h);background:#fff;border-bottom:1px solid var(--border);
  padding:0 28px;display:flex;align-items:center;justify-content:space-between;
  position:sticky;top:0;z-index:100;
}
.topbar-left{display:flex;flex-direction:column;}
.topbar-greeting{font-weight:800;font-size:1rem;color:var(--text);}
.topbar-sub{font-size:.78rem;color:var(--text-sub);font-weight:500;}
.topbar-right{display:flex;align-items:center;gap:16px;}
.topbar-notif{
  position:relative;width:38px;height:38px;border-radius:10px;
  background:var(--bg);border:1px solid var(--border);
  display:flex;align-items:center;justify-content:center;cursor:pointer;
  transition:background .15s;
}
.topbar-notif:hover{background:var(--primary-light);}
.notif-dot{
  position:absolute;top:6px;right:6px;
  width:8px;height:8px;border-radius:50%;background:var(--danger);
  border:2px solid #fff;
}
.topbar-user{
  display:flex;align-items:center;gap:10px;padding:6px 14px 6px 6px;
  border-radius:12px;cursor:pointer;transition:background .15s;
}
.topbar-user:hover{background:var(--bg);}
.topbar-avatar{width:36px;height:36px;border-radius:10px;object-fit:cover;}
.topbar-uname{font-weight:700;font-size:.88rem;}
.topbar-urole{font-size:.72rem;color:var(--success);font-weight:600;}
.line-connect-btn{
  display:flex;align-items:center;gap:8px;padding:8px 16px;
  background:#06C755;color:#fff;border:none;border-radius:10px;
  font-weight:700;font-size:.82rem;cursor:pointer;transition:all .2s;
}
.line-connect-btn:hover{background:#05A847;transform:translateY(-1px);}

/* ── CONTENT ── */
.app-content{padding:28px;flex:1;}

/* ── WELCOME BANNER ── */
.welcome-banner{
  background:linear-gradient(120deg,#1B4F9A 0%,#2563EB 60%,#38BDF8 100%);
  border-radius:var(--radius);padding:28px 32px;
  display:flex;align-items:center;gap:20px;
  margin-bottom:24px;color:#fff;
}
.welcome-banner-avatar{
  width:64px;height:64px;border-radius:14px;object-fit:cover;
  border:3px solid rgba(255,255,255,.4);flex-shrink:0;
}
.welcome-banner-name{font-size:1.3rem;font-weight:900;margin-bottom:4px;}
.welcome-banner-role{font-size:.82rem;opacity:.8;font-weight:500;}
.welcome-banner-right{margin-left:auto;text-align:right;}
.welcome-date{font-size:.88rem;opacity:.8;}

/* ── SHORTCUT CARDS ── */
.shortcut-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:14px;margin-bottom:28px;}
.shortcut-card{
  background:#fff;border-radius:var(--radius);padding:20px;
  border:1px solid var(--border);cursor:pointer;transition:all .2s;
}
.shortcut-card:hover{box-shadow:var(--shadow-md);border-color:var(--primary);transform:translateY(-2px);}
.shortcut-card-icon{
  width:44px;height:44px;border-radius:12px;
  display:flex;align-items:center;justify-content:center;
  margin-bottom:12px;font-size:1.1rem;
}
.shortcut-card-title{font-weight:700;font-size:.9rem;margin-bottom:3px;}
.shortcut-card-sub{font-size:.75rem;color:var(--text-sub);}

/* ── STAT CARDS ── */
.stats-row{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:24px;}
@media(max-width:900px){.stats-row{grid-template-columns:repeat(2,1fr);}}
.stat-card{
  background:#fff;border-radius:var(--radius);padding:22px 24px;
  border:1px solid var(--border);
}
.stat-card-icon{
  width:40px;height:40px;border-radius:10px;
  display:flex;align-items:center;justify-content:center;margin-bottom:12px;
}
.stat-card-val{font-size:1.6rem;font-weight:900;margin-bottom:2px;}
.stat-card-lbl{font-size:.78rem;color:var(--text-sub);font-weight:600;}

/* ── SECTION TITLE ── */
.section-title{
  font-weight:800;font-size:1rem;color:var(--text);
  margin-bottom:14px;display:flex;align-items:center;gap:8px;
}

/* ── CARD ── */
.app-card{
  background:#fff;border-radius:var(--radius);
  border:1px solid var(--border);box-shadow:var(--shadow);overflow:hidden;
}
.app-card-header{
  padding:18px 22px;border-bottom:1px solid var(--border);
  font-weight:800;font-size:.95rem;display:flex;align-items:center;gap:8px;
}

/* ── TABLE ── */
.app-table{width:100%;border-collapse:collapse;}
.app-table th{padding:10px 14px;text-align:left;font-size:.73rem;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--text-sub);background:#F8FAFF;border-bottom:2px solid var(--border);}
.app-table td{padding:13px 14px;border-bottom:1px solid #F1F5F9;vertical-align:middle;font-size:.88rem;}
.app-table tr:last-child td{border-bottom:none;}
.app-table tr:hover td{background:#F8FAFF;}

/* ── BADGE ── */
.badge{display:inline-flex;align-items:center;gap:4px;padding:3px 10px;border-radius:20px;font-size:.72rem;font-weight:700;}
.badge-blue{background:#DBEAFE;color:#1D4ED8;}
.badge-green{background:#DCFCE7;color:#15803D;}
.badge-yellow{background:#FEF9C3;color:#A16207;}
.badge-red{background:#FEE2E2;color:#DC2626;}
.badge-gray{background:#F1F5F9;color:#475569;}
.badge-purple{background:#EDE9FE;color:#6D28D9;}
.badge-orange{background:#FFEDD5;color:#C2410C;}

/* ── MODAL ── */
.modal-overlay{
  position:fixed;inset:0;background:rgba(0,0,0,.45);
  z-index:500;display:none;align-items:center;justify-content:center;padding:20px;
}
.modal-overlay.open{display:flex;}
.modal-box{
  background:#fff;border-radius:18px;padding:32px;max-width:560px;width:100%;
  max-height:90vh;overflow-y:auto;box-shadow:0 24px 60px rgba(0,0,0,.2);
  animation:modalIn .2s ease;
}
@keyframes modalIn{from{opacity:0;transform:scale(.96)}to{opacity:1;transform:scale(1)}}
.modal-title{font-weight:900;font-size:1.2rem;margin-bottom:18px;display:flex;align-items:center;gap:10px;}
.modal-footer{display:flex;gap:10px;justify-content:flex-end;margin-top:22px;padding-top:18px;border-top:1px solid var(--border);}

/* ── FORM ── */
.form-group{margin-bottom:16px;}
.form-label{display:block;font-size:.82rem;font-weight:700;color:var(--text-sub);margin-bottom:6px;}
.form-input,.form-select,.form-textarea{
  width:100%;padding:10px 14px;border:1.5px solid var(--border);border-radius:10px;
  font-family:var(--font);font-size:.9rem;outline:none;transition:border .15s;
  background:#fff;color:var(--text);
}
.form-input:focus,.form-select:focus,.form-textarea:focus{border-color:var(--primary);}
.form-textarea{min-height:80px;resize:vertical;}

/* ── BTN ── */
.btn{
  display:inline-flex;align-items:center;gap:7px;padding:9px 18px;
  border-radius:10px;font-family:var(--font);font-size:.88rem;font-weight:700;
  border:none;cursor:pointer;transition:all .15s;
}
.btn i{width:16px;height:16px;}
.btn-sm{padding:6px 12px;font-size:.8rem;}
.btn-block{width:100%;justify-content:center;}
.btn-primary{background:var(--primary);color:#fff;}
.btn-primary:hover{background:#1640,#7A;filter:brightness(1.1);}
.btn-success{background:var(--success);color:#fff;}
.btn-success:hover{filter:brightness(1.1);}
.btn-danger{background:var(--danger);color:#fff;}
.btn-outline{background:#fff;color:var(--text);border:1.5px solid var(--border);}
.btn-outline:hover{border-color:var(--primary);color:var(--primary);}
.btn-line{background:#06C755;color:#fff;}
.btn-line:hover{background:#05A847;}

/* ── STAR RATING ── */
.stars{display:inline-flex;gap:2px;}
.star{color:#FCD34D;font-size:1rem;}
.star.empty{color:#E2E8F0;}

/* ── CHAT ── */
.chat-box{display:flex;flex-direction:column;height:380px;}
.chat-messages{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:8px;}
.chat-bubble-row{display:flex;align-items:flex-end;gap:8px;}
.chat-bubble-row.mine{flex-direction:row-reverse;}
.chat-bubble{
  padding:9px 14px;border-radius:16px;max-width:70%;font-size:.88rem;line-height:1.5;
  background:#F1F5F9;color:var(--text);
}
.chat-bubble-row.mine .chat-bubble{background:var(--primary);color:#fff;}
.chat-input-row{display:flex;gap:8px;padding:12px 16px;border-top:1px solid var(--border);}
.chat-input{flex:1;padding:9px 14px;border:1.5px solid var(--border);border-radius:10px;font-family:var(--font);outline:none;}
.chat-input:focus{border-color:var(--primary);}
.chat-send-btn{padding:9px 18px;background:var(--primary);color:#fff;border:none;border-radius:10px;cursor:pointer;font-weight:700;}

/* ── PROFILE CARD (Researcher) ── */
.researcher-profile-header{
  background:linear-gradient(135deg,#1B4F9A,#2563EB);
  border-radius:14px;padding:28px;color:#fff;text-align:center;margin-bottom:20px;
}
.profile-avatar{
  width:80px;height:80px;border-radius:20px;border:3px solid rgba(255,255,255,.5);
  object-fit:cover;margin:0 auto 12px;display:block;
}
.profile-name{font-size:1.2rem;font-weight:900;margin-bottom:4px;}
.profile-verified{
  display:inline-flex;align-items:center;gap:6px;
  background:rgba(255,255,255,.2);border-radius:20px;padding:4px 12px;
  font-size:.78rem;font-weight:700;
}

/* ── EMPTY ── */
.empty-state{text-align:center;padding:48px 20px;color:var(--text-sub);}
.empty-state h3{font-size:1rem;font-weight:700;margin:12px 0 6px;}
.empty-state p{font-size:.85rem;}

/* ── LOADER ── */
.loader{width:20px;height:20px;border:2.5px solid #E2E8F0;border-top-color:var(--primary);border-radius:50%;animation:spin .7s linear infinite;display:inline-block;}
@keyframes spin{to{transform:rotate(360deg)}}
.loading-center{display:flex;align-items:center;justify-content:center;gap:10px;padding:40px;color:var(--text-sub);}

/* ── TOAST ── */
#toast-container{position:fixed;bottom:24px;right:24px;z-index:9999;display:flex;flex-direction:column;gap:8px;}
.toast{
  padding:12px 18px;border-radius:12px;font-weight:700;font-size:.88rem;
  box-shadow:0 8px 24px rgba(0,0,0,.15);
  animation:toastIn .3s ease;max-width:320px;
  display:flex;align-items:center;gap:10px;
}
@keyframes toastIn{from{opacity:0;transform:translateX(40px)}to{opacity:1;transform:translateX(0)}}
.toast-success{background:#15803D;color:#fff;}
.toast-error{background:#DC2626;color:#fff;}
.toast-info{background:#1B4F9A;color:#fff;}

/* ── RESPONSIVE ── */
@media(max-width:768px){
  .app-sidebar{width:200px;}
  .app-main{margin-left:200px;}
  .stats-row{grid-template-columns:1fr 1fr;}
  .app-content{padding:16px;}
}
@media(max-width:600px){
  .app-sidebar{display:none;}
  .app-main{margin-left:0;}
}
