@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Nunito:wght@300;400;500;600;700&display=swap');

:root {
  --a-primary: #8B5E3C;
  --a-primary-dark: #6B4423;
  --a-primary-light: #C9A96E;
  --a-sidebar: #1E0F08;
  --a-sidebar-hover: #2C1810;
  --a-bg: #F5EDD9;
  --a-white: #FFFFFF;
  --a-border: #E8D5B7;
  --a-text: #4A3728;
  --a-text-light: #7A6258;
  --a-success: #5B8C5A;
  --a-error: #C0392B;
  --a-warning: #D68A16;
  --a-info: #2980B9;
  --a-sidebar-w: 250px;
  --a-radius: 12px;
  --a-topbar: 64px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Nunito', sans-serif; color: var(--a-text); background: var(--a-bg); line-height: 1.6; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input, textarea, select { font-family: inherit; outline: none; }
img { max-width: 100%; display: block; }
h1,h2,h3,h4 { font-family: 'Playfair Display', serif; color: var(--a-text); line-height: 1.3; }

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

/* SIDEBAR */
.admin-sidebar {
  width: var(--a-sidebar-w); background: var(--a-sidebar);
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
  overflow-y: auto; overflow-x: hidden; transition: transform 0.3s ease;
  display: flex; flex-direction: column;
}
.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-track { background: transparent; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.sidebar-logo { padding: 1.2rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,0.07); display: flex; flex-direction: column; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.sidebar-logo-img { height: 52px; width: auto; object-fit: contain; filter: brightness(0) invert(1); }
.sidebar-logo .s-role { font-size: 0.62rem; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.08em; }

.sidebar-nav { padding: 0.75rem 0; flex: 1; }
.sidebar-section { padding: 0.75rem 1.25rem 0.25rem; font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.18em; color: rgba(255,255,255,0.25); margin-top: 0.5rem; }
.sidebar-nav a { display: flex; align-items: center; gap: 0.7rem; padding: 0.65rem 1.25rem; color: rgba(255,255,255,0.6); font-size: 0.85rem; font-weight: 500; transition: all 0.2s; border-left: 3px solid transparent; }
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.9); border-left-color: rgba(201,169,110,0.4); }
.sidebar-nav a.active { background: rgba(139,94,60,0.22); color: white; border-left-color: var(--a-primary); }
.sidebar-nav a .s-icon-sm { width: 18px; text-align: center; font-size: 0.9rem; flex-shrink: 0; }

.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,0.07); flex-shrink: 0; }
.sidebar-footer a { display: flex; align-items: center; gap: 0.7rem; color: rgba(255,255,255,0.45); font-size: 0.82rem; padding: 0.4rem 0; transition: color 0.2s; }
.sidebar-footer a:hover { color: rgba(255,255,255,0.8); }
.sidebar-footer a + a { margin-top: 0.25rem; }

/* TOPBAR */
.admin-topbar {
  position: fixed; top: 0; left: var(--a-sidebar-w); right: 0; height: var(--a-topbar);
  background: white; border-bottom: 1px solid var(--a-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.75rem; gap: 1rem; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-toggle { display: none; background: none; padding: 0.4rem; border-radius: 6px; }
.topbar-toggle:hover { background: var(--a-bg); }
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--a-text); font-family: 'Nunito', sans-serif; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-site-link { font-size: 0.8rem; color: var(--a-primary); border: 1px solid var(--a-border); padding: 0.35rem 0.9rem; border-radius: 6px; transition: all 0.2s; display: flex; align-items: center; gap: 0.4rem; }
.topbar-site-link:hover { background: var(--a-bg); }
.topbar-user { display: flex; align-items: center; gap: 0.6rem; font-size: 0.82rem; color: var(--a-text-light); }
.topbar-user .t-avatar { width: 32px; height: 32px; background: var(--a-primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 0.8rem; font-weight: 700; }

/* MAIN */
.admin-main { margin-left: var(--a-sidebar-w); padding-top: var(--a-topbar); min-height: 100vh; display: flex; flex-direction: column; }
.admin-content { padding: 1.75rem; flex: 1; }

/* ===== STAT CARDS ===== */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-bottom: 1.75rem; }
.stat-card { background: white; border-radius: var(--a-radius); padding: 1.4rem; border: 1px solid var(--a-border); display: flex; align-items: center; gap: 1rem; transition: box-shadow 0.2s; }
.stat-card:hover { box-shadow: 0 6px 20px rgba(44,24,16,0.08); }
.stat-card .sc-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.stat-card.brown .sc-icon { background: rgba(139,94,60,0.1); color: var(--a-primary); }
.stat-card.green .sc-icon { background: rgba(91,140,90,0.1); color: var(--a-success); }
.stat-card.blue .sc-icon { background: rgba(41,128,185,0.1); color: var(--a-info); }
.stat-card.orange .sc-icon { background: rgba(214,138,22,0.1); color: var(--a-warning); }
.stat-card .sc-info .sc-num { font-family: 'Playfair Display', serif; font-size: 1.75rem; font-weight: 700; color: var(--a-text); line-height: 1; margin-bottom: 0.2rem; }
.stat-card .sc-info .sc-label { font-size: 0.75rem; color: var(--a-text-light); text-transform: uppercase; letter-spacing: 0.07em; }

/* ===== TABLE ===== */
.admin-card { background: white; border-radius: var(--a-radius); border: 1px solid var(--a-border); overflow: hidden; margin-bottom: 1.5rem; }
.admin-card-header { padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--a-border); display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.admin-card-header h3 { font-size: 0.95rem; font-family: 'Nunito', sans-serif; color: var(--a-text); font-weight: 700; }
.admin-card-body { padding: 1.5rem; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { background: #F9F5F0; text-align: left; padding: 0.7rem 1.1rem; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--a-text-light); border-bottom: 1px solid var(--a-border); white-space: nowrap; }
.admin-table td { padding: 0.85rem 1.1rem; font-size: 0.855rem; border-bottom: 1px solid #F5EDD9; color: var(--a-text); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #FDFAF5; }
.admin-table .td-actions { display: flex; align-items: center; gap: 0.5rem; }
.admin-table img.table-img { width: 48px; height: 36px; object-fit: cover; border-radius: 4px; }

/* ===== BADGES ===== */
.abadge { display: inline-flex; align-items: center; padding: 0.2rem 0.65rem; border-radius: 50px; font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.abadge-success { background: rgba(91,140,90,0.12); color: var(--a-success); }
.abadge-error { background: rgba(192,57,43,0.12); color: var(--a-error); }
.abadge-warning { background: rgba(214,138,22,0.12); color: var(--a-warning); }
.abadge-info { background: rgba(41,128,185,0.12); color: var(--a-info); }
.abadge-default { background: rgba(74,55,40,0.1); color: var(--a-text); }

/* ===== BUTTONS ===== */
.abtn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 1.1rem; border-radius: 8px; font-size: 0.82rem; font-weight: 600; transition: all 0.2s; cursor: pointer; border: none; font-family: 'Nunito', sans-serif; }
.abtn-primary { background: var(--a-primary); color: white; }
.abtn-primary:hover { background: var(--a-primary-dark); transform: translateY(-1px); }
.abtn-success { background: var(--a-success); color: white; }
.abtn-success:hover { background: #4A7A49; }
.abtn-danger { background: var(--a-error); color: white; }
.abtn-danger:hover { background: #A93226; }
.abtn-warning { background: var(--a-warning); color: white; }
.abtn-warning:hover { background: #B8760D; }
.abtn-info { background: var(--a-info); color: white; }
.abtn-info:hover { background: #1A6A96; }
.abtn-outline { background: transparent; color: var(--a-text); border: 1.5px solid var(--a-border); }
.abtn-outline:hover { background: var(--a-bg); border-color: var(--a-primary); color: var(--a-primary); }
.abtn-ghost { background: var(--a-bg); color: var(--a-text); border: 1px solid var(--a-border); }
.abtn-ghost:hover { background: var(--a-border); }
.abtn-sm { padding: 0.38rem 0.8rem; font-size: 0.75rem; }
.abtn-lg { padding: 0.75rem 1.5rem; font-size: 0.9rem; }

/* ===== FORM ===== */
.aform-group { margin-bottom: 1.2rem; }
.aform-label { display: block; font-size: 0.75rem; font-weight: 700; color: var(--a-text-light); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.4rem; }
.aform-input {
  width: 100%; padding: 0.7rem 0.9rem; border: 1.5px solid var(--a-border);
  border-radius: 8px; font-size: 0.87rem; color: var(--a-text); background: white;
  font-family: 'Nunito', sans-serif; transition: border-color 0.2s, box-shadow 0.2s;
}
.aform-input:focus { border-color: var(--a-primary); box-shadow: 0 0 0 3px rgba(139,94,60,0.1); }
.aform-input::placeholder { color: rgba(122,98,88,0.5); }
textarea.aform-input { resize: vertical; min-height: 110px; }
select.aform-input { cursor: pointer; }
.aform-hint { font-size: 0.75rem; color: var(--a-text-light); margin-top: 0.3rem; }
.aform-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.aform-check { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.88rem; }
.aform-check input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--a-primary); cursor: pointer; }

/* ===== UPLOAD ===== */
.upload-drop {
  border: 2px dashed var(--a-border); border-radius: var(--a-radius);
  padding: 3rem 2rem; text-align: center; cursor: pointer;
  transition: all 0.2s; position: relative;
}
.upload-drop:hover, .upload-drop.drag { border-color: var(--a-primary); background: rgba(139,94,60,0.04); }
.upload-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-drop .ud-icon { font-size: 2.5rem; color: var(--a-primary); opacity: 0.5; margin-bottom: 0.75rem; }
.upload-drop p { color: var(--a-text-light); font-size: 0.88rem; margin: 0; }
.upload-drop .ud-sub { font-size: 0.75rem; color: rgba(122,98,88,0.6); margin-top: 0.3rem; }

/* ===== CALENDAR (ADMIN) ===== */
.admin-cal { background: white; border-radius: var(--a-radius); border: 1px solid var(--a-border); overflow: hidden; }
.admin-cal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.5rem; background: var(--a-primary); color: white; }
.admin-cal-head h3 { color: white; font-size: 0.95rem; font-family: 'Nunito', sans-serif; font-weight: 700; margin: 0; }
.admin-cal-head button { background: rgba(255,255,255,0.2); color: white; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: background 0.2s; font-size: 0.85rem; }
.admin-cal-head button:hover { background: rgba(255,255,255,0.35); }
.acal-day-names { display: grid; grid-template-columns: repeat(7,1fr); background: #FDF8F0; }
.acal-day-name { text-align: center; padding: 0.5rem; font-size: 0.65rem; font-weight: 700; color: var(--a-text-light); text-transform: uppercase; letter-spacing: 0.06em; }
.acal-days { display: grid; grid-template-columns: repeat(7,1fr); gap: 1px; background: var(--a-border); }
.acal-day {
  background: white; min-height: 52px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; cursor: pointer;
  transition: background 0.15s; font-size: 0.85rem; position: relative;
  user-select: none;
}
.acal-day:hover:not(.empty) { background: var(--a-bg); }
.acal-day.empty { background: #F9F5F0; cursor: default; }
.acal-day.today { font-weight: 700; }
.acal-day.today .acal-num { color: var(--a-primary); background: rgba(139,94,60,0.12); border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.acal-day.available { background: rgba(91,140,90,0.1); }
.acal-day.available .acal-num { color: var(--a-success); font-weight: 600; }
.acal-day.busy { background: rgba(192,57,43,0.1); }
.acal-day.busy .acal-num { color: var(--a-error); font-weight: 600; }
.acal-day.holiday { background: rgba(201,169,110,0.15); }
.acal-day.holiday .acal-num { color: #B07D2A; font-weight: 600; }
.acal-dot { width: 5px; height: 5px; border-radius: 50%; margin-top: 3px; }
.acal-dot.available { background: var(--a-success); }
.acal-dot.busy { background: var(--a-error); }
.acal-dot.holiday { background: #C9A96E; }
.acal-legend { display: flex; gap: 1.25rem; padding: 0.9rem 1.5rem; border-top: 1px solid var(--a-border); flex-wrap: wrap; }
.acal-legend-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: var(--a-text-light); }
.acal-legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.acal-legend-dot.available { background: var(--a-success); }
.acal-legend-dot.busy { background: var(--a-error); }
.acal-legend-dot.holiday { background: #C9A96E; }
.acal-actions { display: flex; gap: 0.75rem; padding: 0.9rem 1.5rem; border-top: 1px solid var(--a-border); flex-wrap: wrap; }

/* ===== VIDEO CARDS ===== */
.video-page-card { background: white; border-radius: var(--a-radius); border: 1px solid var(--a-border); padding: 1.25rem; margin-bottom: 1rem; transition: border-color 0.2s; }
.video-page-card:hover { border-color: var(--a-primary-light); }
.video-page-card .vpc-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.9rem; }
.video-page-card .vpc-name { font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; gap: 0.5rem; }
.video-page-card .vpc-preview { background: #F0E8D8; border-radius: 6px; overflow: hidden; margin-top: 0.75rem; }
.video-page-card .vpc-preview iframe { width: 100%; height: 160px; border: none; display: block; }
.video-page-card .no-video { padding: 1.5rem; text-align: center; color: var(--a-text-light); font-size: 0.82rem; }

/* ===== PATIENT FILES ===== */
.patient-card { background: white; border-radius: var(--a-radius); border: 1px solid var(--a-border); overflow: hidden; margin-bottom: 1rem; }
.patient-card .pc-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--a-border); }
.patient-card .pc-user { display: flex; align-items: center; gap: 0.75rem; }
.patient-card .pc-avatar { width: 36px; height: 36px; background: var(--a-bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--a-primary); font-weight: 700; font-size: 0.9rem; flex-shrink: 0; }
.patient-card .pc-name { font-weight: 700; font-size: 0.88rem; }
.patient-card .pc-email { font-size: 0.75rem; color: var(--a-text-light); }
.patient-card .pc-files { padding: 0.75rem 1.25rem; }
.patient-file-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0; border-bottom: 1px solid #F5EDD9; }
.patient-file-row:last-child { border-bottom: none; }
.patient-file-row .pf-icon { width: 34px; height: 34px; background: rgba(192,57,43,0.1); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.patient-file-row .pf-name { font-size: 0.82rem; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.patient-file-row .pf-date { font-size: 0.72rem; color: var(--a-text-light); white-space: nowrap; }

/* ===== ALERT & TOAST ===== */
.aalert { padding: 0.8rem 1.1rem; border-radius: 8px; font-size: 0.85rem; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.aalert-success { background: rgba(91,140,90,0.1); border: 1px solid rgba(91,140,90,0.3); color: var(--a-success); }
.aalert-error { background: rgba(192,57,43,0.1); border: 1px solid rgba(192,57,43,0.3); color: var(--a-error); }
.aalert-info { background: rgba(139,94,60,0.08); border: 1px solid rgba(139,94,60,0.25); color: var(--a-primary); }

.a-toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.6rem; }
.a-toast { background: var(--a-sidebar); color: white; padding: 0.8rem 1.25rem; border-radius: 10px; font-size: 0.85rem; box-shadow: 0 8px 25px rgba(0,0,0,0.2); animation: aToastIn 0.3s ease; display: flex; align-items: center; gap: 0.5rem; min-width: 240px; }
.a-toast.success { background: var(--a-success); }
.a-toast.error { background: var(--a-error); }
.a-toast.warning { background: var(--a-warning); }
@keyframes aToastIn { from{opacity:0;transform:translateX(16px)} to{opacity:1;transform:translateX(0)} }

/* ===== MODAL ===== */
.a-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 1.5rem; backdrop-filter: blur(3px); }
.a-modal-overlay.active { display: flex; }
.a-modal { background: white; border-radius: var(--a-radius); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; box-shadow: 0 25px 70px rgba(0,0,0,0.25); animation: aModalIn 0.3s ease; }
@keyframes aModalIn { from{opacity:0;transform:scale(0.93)} to{opacity:1;transform:scale(1)} }
.a-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--a-border); }
.a-modal-head h3 { font-size: 1rem; font-family: 'Nunito', sans-serif; font-weight: 700; margin: 0; }
.a-modal-close { width: 32px; height: 32px; background: var(--a-bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: background 0.2s; font-size: 1rem; }
.a-modal-close:hover { background: var(--a-border); }
.a-modal-body { padding: 1.5rem; }

/* ===== MISC ===== */
.atext-center { text-align: center; }
.aempty { text-align: center; padding: 3rem; color: var(--a-text-light); }
.aempty .ae-icon { font-size: 3rem; opacity: 0.3; margin-bottom: 0.75rem; }
.aempty p { font-size: 0.88rem; }

/* ===== LOGIN PAGE ===== */
.admin-login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1E0F08 0%, #3D2414 100%); padding: 1.5rem; }
.admin-login-card { background: white; border-radius: 18px; padding: 2.75rem; width: 100%; max-width: 420px; box-shadow: 0 30px 80px rgba(0,0,0,0.4); }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo .ll-icon { width: 64px; height: 64px; background: linear-gradient(135deg, #C9A96E, #8B5E3C); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: white; margin: 0 auto 1rem; }
.login-logo h2 { font-size: 1.4rem; margin-bottom: 0.3rem; }
.login-logo p { font-size: 0.83rem; color: var(--a-text-light); font-family: 'Nunito', sans-serif; margin: 0; }
.login-back { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: rgba(255,255,255,0.5); margin-bottom: 2rem; transition: color 0.2s; }
.login-back:hover { color: white; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .aform-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.4); }
  .admin-main { margin-left: 0; }
  .admin-topbar { left: 0; }
  .topbar-toggle { display: flex; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .admin-content { padding: 1rem; }
  .admin-topbar { padding: 0 1rem; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 199; display: none; }
  .sidebar-overlay.active { display: block; }
  .takvim-grid { grid-template-columns: 1fr !important; }
  .acal-day { min-height: 40px; }
  .acal-num { font-size: 0.72rem; }
  .topbar-right .topbar-user span:last-child { display: none; }
}
@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
  .admin-login-card { padding: 2rem 1.5rem; }
  .acal-day { min-height: 34px; font-size: 0.7rem; }
  .admin-topbar { gap: 0.5rem; }
}
