/* Dashboard styles — dashboard/style.css */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=DM+Sans:wght@300;400;500;600&display=swap');

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

:root {
  --brand-primary:  #0A2540;
  --brand-accent:   #D4A843;
  --brand-secondary:#1B4F8A;
  --brand-light:    #EEF4FB;
  --sidebar-width:  240px;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Playfair Display', serif;
}

body {
  font-family: var(--font-body);
  background: #F0F4F9;
  color: #1E293B;
  min-height: 100vh;
  display: flex;
  font-size: 14px;
}

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--brand-primary);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}
.sidebar-logo-tag { font-size: 10px; color: var(--brand-accent); letter-spacing: 0.1em; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 16px 0; }
.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 12px 20px 6px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.sidebar-link i { width: 16px; text-align: center; font-size: 14px; }
.sidebar-link:hover { color: #fff; background: rgba(255,255,255,0.05); }
.sidebar-link.active { color: #fff; background: rgba(212,168,67,0.12); border-left-color: var(--brand-accent); }
.sidebar-link.active i { color: var(--brand-accent); }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  background: var(--brand-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--brand-primary);
  flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #fff; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,0.4); }
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: rgba(255,255,255,0.4);
  font-size: 12px;
  text-decoration: none;
  transition: color 0.15s;
}
.sidebar-logout:hover { color: #f87171; }

/* === MAIN === */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar-dash {
  background: #fff;
  border-bottom: 1px solid #E2E8F0;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 90;
}
.topbar-title { font-size: 16px; font-weight: 700; color: var(--brand-primary); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #FEF3C7;
  color: #92400E;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.btn-dash {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  font-family: var(--font-body);
}
.btn-dash-primary { background: var(--brand-primary); color: #fff; }
.btn-dash-primary:hover { background: var(--brand-secondary); }
.btn-dash-outline { background: #fff; color: var(--brand-primary); border: 1.5px solid #CBD5E1; }
.btn-dash-outline:hover { border-color: var(--brand-secondary); color: var(--brand-secondary); }
.btn-dash-danger { background: #FEE2E2; color: #DC2626; border: 1.5px solid #FCA5A5; }
.btn-dash-danger:hover { background: #DC2626; color: #fff; }
.btn-dash-success { background: #DCFCE7; color: #15803D; border: 1.5px solid #86EFAC; }
.btn-dash-success:hover { background: #15803D; color: #fff; }

.content { padding: 24px; flex: 1; }

/* === STATS GRID === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon-blue   { background: #DBEAFE; color: #1D4ED8; }
.stat-icon-yellow { background: #FEF3C7; color: #D97706; }
.stat-icon-green  { background: #DCFCE7; color: #15803D; }
.stat-icon-purple { background: #EDE9FE; color: #7C3AED; }

.stat-num { font-size: 28px; font-weight: 700; color: var(--brand-primary); line-height: 1; }
.stat-label { font-size: 12px; color: #94A3B8; margin-top: 2px; font-weight: 500; }

/* === TABLE === */
.table-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
  overflow: hidden;
}
.table-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.table-card-title { font-size: 15px; font-weight: 700; color: var(--brand-primary); }
.table-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-input {
  padding: 6px 12px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font-body);
  outline: none;
  color: #334155;
  background: #F8FAFC;
  transition: border-color 0.15s;
}
.filter-input:focus { border-color: var(--brand-secondary); }

table { width: 100%; border-collapse: collapse; }
thead tr { background: #F8FAFC; }
th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748B;
  white-space: nowrap;
}
td {
  padding: 12px 16px;
  border-top: 1px solid #F1F5F9;
  font-size: 13px;
  color: #334155;
}
tbody tr:hover { background: #F8FAFC; }
.td-name { font-weight: 600; color: var(--brand-primary); }
.td-email { color: #64748B; font-size: 12px; }
.td-date { color: #94A3B8; font-size: 12px; }
.td-actions { display: flex; gap: 6px; }

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.status-new     { background: #DBEAFE; color: #1E40AF; }
.status-read    { background: #FEF3C7; color: #92400E; }
.status-replied { background: #DCFCE7; color: #15803D; }
.status-closed  { background: #F1F5F9; color: #64748B; }

/* === MODAL === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,37,64,0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(10,37,64,0.25);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #E2E8F0;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--brand-primary); }
.modal-close { background: #F1F5F9; border: none; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px; color: #64748B; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.modal-close:hover { background: #E2E8F0; color: #1E293B; }
.modal-body { padding: 24px; }
.modal-field { margin-bottom: 16px; }
.modal-field-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #94A3B8; margin-bottom: 4px; }
.modal-field-value { font-size: 14px; color: #1E293B; line-height: 1.6; }
.modal-message-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  color: #475569;
  line-height: 1.7;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #E2E8F0;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #94A3B8;
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 15px; font-weight: 500; }

/* === LOGIN PAGE === */
.login-page {
  min-height: 100vh;
  background: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  margin: 0;
  width: 100%;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.25);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--brand-primary); margin-bottom: 6px; }
.login-sub { font-size: 13px; color: #64748B; }
.login-form { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.login-form label { font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 6px; display: block; }
.login-form input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.login-form input:focus { border-color: var(--brand-secondary); }
.login-btn {
  width: 100%;
  background: var(--brand-primary);
  color: #fff;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}
.login-btn:hover { background: var(--brand-secondary); }
.login-error { background: #FEE2E2; color: #DC2626; border-radius: 8px; padding: 10px 14px; font-size: 13px; font-weight: 500; display: none; }
.login-error.show { display: block; }

/* === PAGINATION === */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid #E2E8F0;
  font-size: 13px;
  color: #64748B;
}
.pagination-links { display: flex; gap: 4px; }
.page-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1.5px solid #E2E8F0;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  transition: all 0.15s;
  background: #fff;
  cursor: pointer;
}
.page-btn:hover, .page-btn.active { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }

/* === NOTES TEXTAREA === */
.notes-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  resize: vertical;
  min-height: 80px;
  outline: none;
}
.notes-textarea:focus { border-color: var(--brand-secondary); }

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .content { padding: 16px; }
  .topbar-dash { padding: 0 16px; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card  { padding: 14px; gap: 10px; }
  .stat-num   { font-size: 22px; }
  table thead { display: none; }
  table tr    { display: block; padding: 10px 16px; border-top: 1px solid #E2E8F0; }
  table td    { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border: none; font-size: 13px; }
  table td::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94A3B8;
    flex-shrink: 0;
    margin-right: 8px;
  }
  .td-actions { justify-content: flex-end; }
  .table-card-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .table-filters { width: 100%; }
  .filter-input { width: 100% !important; }
  .modal { border-radius: 12px 12px 0 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: 100%; max-height: 92vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}
