/* ============================================================
   DEEKO HOSTING PORTAL — CSS
   Gmail-inspired layout
   ============================================================ */

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

:root {
  --navy:    #1a3a5c;
  --navy2:   #0f2540;
  --green:   #059669;
  --blue:    #2563eb;
  --red:     #dc2626;
  --gold:    #d97706;
  --bg:      #f6f8fc;
  --white:   #ffffff;
  --bdr:     #e2e8f0;
  --text:    #0f172a;
  --muted:   #64748b;
  --light:   #f1f5f9;
  --sidebar-w: 220px;
  --topbar-h:  58px;
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; }

/* ── TOPBAR ─────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: var(--white); border-bottom: 1px solid var(--bdr);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  z-index: 100; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; width: var(--sidebar-w); flex-shrink: 0; }
.topbar-brand-logo { width: 32px; height: 32px; background: var(--navy); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; }
.topbar-brand-name { font-size: 15px; font-weight: 700; color: var(--navy); }
.topbar-brand-sub  { font-size: 10px; color: var(--muted); }
.topbar-search {
  flex: 1; max-width: 600px;
  background: var(--light); border: 1px solid var(--bdr); border-radius: 24px;
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
}
.topbar-search input { border: none; background: transparent; outline: none; font-size: 14px; width: 100%; color: var(--text); }
.topbar-search-icon { color: var(--muted); font-size: 16px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-user { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.topbar-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.topbar-username { font-size: 13px; font-weight: 600; color: var(--text); }
.topbar-domain { font-size: 11px; color: var(--muted); }

/* ── LAYOUT ──────────────────────────────────────────────── */
.layout { display: flex; height: 100vh; padding-top: var(--topbar-h); }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--white); border-right: 1px solid var(--bdr);
  display: flex; flex-direction: column;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; padding: 12px 0;
}
.sidebar-compose {
  margin: 8px 16px 16px;
  background: var(--blue); color: #fff;
  border: none; border-radius: 24px;
  padding: 10px 20px; font-size: 14px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; gap: 8px;
  text-decoration: none; justify-content: center;
  transition: background .15s;
}
.sidebar-compose:hover { background: #1d4ed8; }
.sidebar-section { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; padding: 12px 20px 4px; }
.sidebar-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; margin: 1px 8px; border-radius: 20px;
  text-decoration: none; color: var(--text); font-size: 13px; font-weight: 500;
  transition: background .1s; cursor: pointer;
}
.sidebar-item:hover { background: var(--light); }
.sidebar-item.active { background: #dbeafe; color: var(--blue); font-weight: 700; }
.sidebar-item .icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-item .label { flex: 1; }
.sidebar-item .badge {
  background: var(--blue); color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 12px; min-width: 20px; text-align: center;
}
.sidebar-item .badge.red { background: var(--red); }
.sidebar-divider { border: none; border-top: 1px solid var(--bdr); margin: 8px 16px; }
.sidebar-storage { margin: 12px 16px; padding: 12px; background: var(--light); border-radius: 12px; }
.sidebar-storage-label { font-size: 11px; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; }
.sidebar-storage-bar { height: 4px; background: var(--bdr); border-radius: 2px; overflow: hidden; margin-bottom: 4px; }
.sidebar-storage-fill { height: 100%; border-radius: 2px; transition: width .3s; }
.sidebar-storage-text { font-size: 11px; color: var(--muted); }

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main {
  flex: 1; overflow-y: auto;
  height: calc(100vh - var(--topbar-h));
}

/* ── WEBMAIL 3-COLUMN ─────────────────────────────────────── */
.webmail-layout { display: flex; height: 100%; }
.email-list-panel {
  width: 340px; flex-shrink: 0;
  border-right: 1px solid var(--bdr);
  height: 100%; overflow-y: auto;
  background: var(--white);
}
.email-reader-panel { flex: 1; height: 100%; overflow-y: auto; background: var(--white); }

/* Email list toolbar */
.email-list-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-bottom: 1px solid var(--bdr);
  background: var(--white); position: sticky; top: 0; z-index: 10;
}
.email-list-toolbar-title { font-size: 16px; font-weight: 700; color: var(--text); flex: 1; }
.icon-btn { background: none; border: none; cursor: pointer; padding: 6px; border-radius: 50%; color: var(--muted); font-size: 16px; transition: background .1s; }
.icon-btn:hover { background: var(--light); }

/* Email list items */
.email-item {
  display: flex; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid #f8fafc; cursor: pointer;
  transition: background .1s; position: relative;
}
.email-item:hover { background: var(--light); }
.email-item.unread { background: #f0f7ff; }
.email-item.active { background: #dbeafe; }
.email-item.unread .email-item-subject { font-weight: 700; }
.email-star { font-size: 14px; cursor: pointer; flex-shrink: 0; color: #d1d5db; padding-top: 2px; }
.email-star.starred { color: #f59e0b; }
.email-item-body { flex: 1; min-width: 0; }
.email-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.email-item-from { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.email-item-time { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.email-item-subject { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.email-item-preview { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-unread-dot { width: 8px; height: 8px; background: var(--blue); border-radius: 50%; flex-shrink: 0; margin-top: 6px; }

/* Email reader */
.email-reader-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--muted); gap: 12px;
}
.email-reader-empty-icon { font-size: 56px; opacity: .3; }
.email-reader-toolbar {
  display: flex; align-items: center; gap: 6px; padding: 10px 20px;
  border-bottom: 1px solid var(--bdr); background: var(--white);
  position: sticky; top: 0; z-index: 10;
}
.email-reader-subject { font-size: 22px; font-weight: 700; color: var(--text); padding: 16px 24px 8px; }
.email-reader-meta {
  display: flex; align-items: center; gap: 12px; padding: 0 24px 14px;
  border-bottom: 1px solid var(--bdr);
}
.email-reader-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; flex-shrink: 0; }
.email-reader-from { font-size: 13px; font-weight: 700; color: var(--text); }
.email-reader-from-email { font-size: 12px; color: var(--muted); }
.email-reader-time { margin-left: auto; font-size: 12px; color: var(--muted); }
.email-reader-body { padding: 20px 24px; font-size: 14px; line-height: 1.8; color: var(--text); }
.email-reader-body p { margin-bottom: 12px; }
.email-attachments { padding: 0 24px 16px; border-top: 1px solid var(--bdr); padding-top: 16px; }
.email-attachments-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.email-attachment-list { display: flex; gap: 10px; flex-wrap: wrap; }
.email-attachment {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px; border: 1px solid var(--bdr); border-radius: 10px;
  width: 130px; cursor: pointer; transition: all .1s;
}
.email-attachment:hover { border-color: var(--blue); background: #f0f7ff; }
.email-attachment-icon { font-size: 28px; }
.email-attachment-name { font-size: 11px; font-weight: 600; color: var(--text); text-align: center; word-break: break-all; }
.email-attachment-size { font-size: 10px; color: var(--muted); }
.email-attachment-actions { display: flex; gap: 8px; }
.email-attachment-actions button { background: none; border: none; font-size: 16px; cursor: pointer; color: var(--muted); }
.email-reply-bar {
  display: flex; gap: 10px; padding: 16px 24px;
  border-top: 1px solid var(--bdr);
}
.btn-reply { display: flex; align-items: center; gap: 6px; padding: 9px 20px; border: 1px solid var(--bdr); border-radius: 8px; background: var(--white); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .1s; }
.btn-reply:hover { background: var(--light); }
.btn-reply.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-reply.primary:hover { background: #1d4ed8; }

/* ── COMPOSE MODAL ───────────────────────────────────────── */
.compose-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 500; display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 0 24px 24px; pointer-events: none; opacity: 0; transition: opacity .2s;
}
.compose-overlay.show { pointer-events: all; opacity: 1; }
.compose-modal {
  width: 520px; background: var(--white); border-radius: 12px 12px 0 0;
  box-shadow: 0 8px 40px rgba(0,0,0,.2); overflow: hidden;
  transform: translateY(100%); transition: transform .25s;
}
.compose-overlay.show .compose-modal { transform: translateY(0); }
.compose-header {
  background: var(--navy); color: #fff; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 600; cursor: move;
}
.compose-header-actions { display: flex; gap: 8px; }
.compose-header-actions button { background: rgba(255,255,255,.2); border: none; color: #fff; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-size: 14px; }
.compose-field { display: flex; align-items: center; border-bottom: 1px solid var(--bdr); padding: 8px 16px; gap: 10px; }
.compose-field label { font-size: 12px; color: var(--muted); width: 30px; flex-shrink: 0; }
.compose-field input { border: none; outline: none; font-size: 13px; flex: 1; }
.compose-body { width: 100%; min-height: 200px; border: none; outline: none; padding: 12px 16px; font-size: 13px; font-family: 'Inter', sans-serif; resize: none; }
.compose-footer { padding: 10px 16px; border-top: 1px solid var(--bdr); display: flex; align-items: center; gap: 10px; }
.compose-send { background: var(--blue); color: #fff; border: none; border-radius: 20px; padding: 8px 24px; font-size: 13px; font-weight: 700; cursor: pointer; }
.compose-send:hover { background: #1d4ed8; }
.compose-attach { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }

/* ── DASHBOARD / GENERAL PAGES ───────────────────────────── */
.page { padding: 24px; }
.page-title { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.page-sub { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border: 1px solid var(--bdr); border-radius: 14px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.stat-val { font-size: 28px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-lbl { font-size: 12px; color: var(--muted); }
.stat-sub { font-size: 11px; color: #94a3b8; margin-top: 3px; }
.card { background: var(--white); border: 1px solid var(--bdr); border-radius: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.04); margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--bdr); }
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-body { padding: 20px; }
.table { width: 100%; border-collapse: collapse; }
.table th { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--bdr); }
.table td { padding: 12px 14px; font-size: 13px; border-bottom: 1px solid #f8fafc; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--light); }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; border: 1px solid transparent; transition: all .15s; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #047857; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: var(--white); color: var(--text); border-color: var(--bdr); }
.btn-outline:hover { background: var(--light); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 10px; font-size: 11px; border-radius: 6px; }

/* ── FORMS ────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .5px; }
.form-control { width: 100%; padding: 9px 12px; border: 1.5px solid var(--bdr); border-radius: 8px; font-size: 13px; outline: none; transition: border .15s; font-family: 'Inter',sans-serif; }
.form-control:focus { border-color: var(--blue); }

/* ── BADGES ───────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* ── ALERTS ──────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ── LOGIN PAGE ──────────────────────────────────────────── */
.login-page { min-height: 100vh; background: linear-gradient(135deg,#0f2540,#1a3a5c); display: flex; align-items: center; justify-content: center; overflow: auto; }
.login-box { background: var(--white); border-radius: 20px; padding: 40px; width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon { width: 60px; height: 60px; background: var(--navy); border-radius: 16px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 28px; margin: 0 auto 12px; }
.login-logo-title { font-size: 20px; font-weight: 800; color: var(--text); }
.login-logo-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.login-footer { text-align: center; margin-top: 20px; font-size: 12px; color: var(--muted); }

/* ── QUOTA BAR ───────────────────────────────────────────── */
.quota-bar { height: 8px; background: var(--bdr); border-radius: 4px; overflow: hidden; margin: 6px 0; }
.quota-fill { height: 100%; border-radius: 4px; transition: width .4s; }
.quota-green { background: var(--green); }
.quota-gold { background: var(--gold); }
.quota-red { background: var(--red); }

/* ── LOADING ─────────────────────────────────────────────── */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--bdr); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state { display: flex; align-items: center; justify-content: center; padding: 40px; gap: 12px; color: var(--muted); font-size: 14px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 400; display: flex; align-items: center; justify-content: center; }
.modal { background: var(--white); border-radius: 16px; width: 480px; max-width: calc(100vw - 40px); box-shadow: 0 20px 60px rgba(0,0,0,.2); overflow: hidden; }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--bdr); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 20px; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--bdr); display: flex; gap: 10px; justify-content: flex-end; }

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .webmail-layout .email-reader-panel { display: none; }
  .webmail-layout .email-reader-panel.show { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 50; }
}
