/* Go.Do ERP — Portal (sys.godo-erp.com) */
:root {
  --bg: #0c0e14;
  --surface: #141824;
  --surface-2: #1c2233;
  --border: #2a3145;
  --text: #eef0f6;
  --muted: #8b93a7;
  --accent: #27ae60;
  --accent-2: #2ecc71;
  --accent-glow: rgba(46, 204, 113, 0.25);
  --danger: #e74c3c;
  --radius: 14px;
  --font: "Tajawal", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(to top, #52b788 0%, #b7e4c7 35%, #d8f3dc 65%, #f0fdf4 100%);
  display: flex; align-items: center; justify-content: center;
}
.loading-screen::before {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 30% 20%, rgba(255,255,255,0.55) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(39,174,96,0.12) 0%, transparent 65%);
}
.loading-screen .loader { position: relative; z-index: 1; }
.loading-screen #loading-msg { color: #2d6a4f; font-weight: 700; margin-top: 8px; }
.loading-screen[hidden] { display: none !important; }
.loader { text-align: center; }
.loader-logo-img {
  display: block; margin: 0 auto 12px;
  max-width: min(220px, 72vw); height: auto;
  background: transparent !important;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(39,174,96,0.2));
}
@keyframes pulse { 50% { transform: scale(1.05); opacity: 0.85; } }

.app-shell { min-height: 100vh; }

/* Login — نفس تدرج الداشبورد (أخضر فاتح → أخضر غني) */
.view-login {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 24px 80px;
  background: linear-gradient(to top, #52b788 0%, #b7e4c7 35%, #d8f3dc 65%, #f0fdf4 100%);
  position: relative;
}
.view-login::before {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 30% 20%, rgba(255,255,255,0.55) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(39,174,96,0.12) 0%, transparent 65%);
}
.login-panel {
  position: relative; z-index: 1;
  width: min(420px, 100%);
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(39,174,96,0.22);
  border-radius: calc(var(--radius) + 4px);
  padding: 32px;
  box-shadow: 0 20px 60px rgba(39,174,96,0.18), 0 4px 16px rgba(0,0,0,0.06);
  color: #1b4332;
}
.brand { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-bottom: 24px; text-align: center; }
.godo-logo-img {
  max-width: min(280px, 92vw);
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
  background: transparent !important;
  object-fit: contain;
}
.brand-text { width: 100%; }
.brand h1 { margin: 0; font-size: 1.35rem; color: #1b4332; }
.brand-sub { margin: 4px 0 0; color: #4a7c59; font-size: 0.85rem; }
.login-form h2 { margin: 0 0 6px; font-size: 1.25rem; color: #1b4332; }
.hint { color: #4a7c59; font-size: 0.9rem; margin: 0 0 20px; }
.login-form label { display: block; margin-bottom: 14px; }
.login-form label span { display: block; font-size: 0.85rem; color: #2d6a4f; font-weight: 700; margin-bottom: 6px; }
.view-login .login-form input {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid #b7dfbf; background: #f0faf4;
  color: #1b4332; font-family: inherit; font-size: 1rem;
}
.view-login .login-form input:focus {
  outline: none; border-color: #27ae60; background: #fff;
  box-shadow: 0 0 0 3px rgba(39,174,96,0.12);
}
.error-msg { color: #c0392b; font-size: 0.9rem; margin: 0 0 12px; }
.error-msg[hidden] { display: none; }
.auth-renewal-cta {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  background: rgba(212, 175, 55, 0.08);
}
.auth-renewal-cta .hint { margin: 0 0 10px; color: #5a5a72; font-size: 0.88rem; line-height: 1.5; }
.auth-renewal-cta[hidden] { display: none; }
.success-msg { color: var(--accent-2); font-size: 0.9rem; margin: 0 0 12px; }
.success-msg[hidden] { display: none; }
.portal-contact-footer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: center; flex-wrap: wrap; gap: 10px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.96);
  border-top: 1px solid rgba(39,174,96,0.28);
  box-shadow: 0 -4px 20px rgba(39,174,96,0.1);
}
.portal-contact-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 999px;
  font-size: 0.85rem; font-weight: 800; text-decoration: none; color: #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}
.portal-contact-link.web { background: linear-gradient(135deg, #6c5ce7, #a29bfe); }
.portal-contact-link.wa { background: linear-gradient(135deg, #128c7e, #25d366); }
.view-login .loader-logo-img {
  max-width: 120px; height: auto; margin-bottom: 12px;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 10px; border: none;
  font-family: inherit; font-weight: 700; font-size: 0.95rem;
  cursor: pointer; transition: transform 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { width: 100%; background: linear-gradient(135deg, var(--accent-2), #1e8449); color: #fff; }
.btn-accent { background: linear-gradient(135deg, #f39c12, #e67e22); color: #fff; }
.btn-accent.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }

/* Dashboard layout */
.view-dashboard { display: flex; min-height: 100vh; }
.view-dashboard[hidden], .view-login[hidden] { display: none !important; }

.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 16px;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; font-size: 1.1rem; flex-wrap: wrap; }
.sidebar-logo { max-width: 88px; max-height: 36px; width: auto; height: auto; object-fit: contain; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  padding: 10px 12px; border-radius: 10px; color: var(--muted);
  text-decoration: none; font-weight: 600; font-size: 0.92rem;
}
.nav-item.active { background: var(--surface-2); color: var(--accent-2); }
.nav-item.disabled { opacity: 0.45; pointer-events: none; }
.sidebar-user { border-top: 1px solid var(--border); padding-top: 16px; font-size: 0.9rem; }
.sidebar-user small { color: var(--muted); display: block; margin: 4px 0 10px; }

.main-content { flex: 1; padding: 24px 28px; overflow: auto; }
.topbar {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: 16px; margin-bottom: 24px;
}
.topbar h1 { margin: 0; font-size: 1.5rem; }
.muted { color: var(--muted); margin: 4px 0 0; font-size: 0.9rem; }
.topbar-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.badge {
  font-size: 0.75rem; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}

.launch-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 24px; margin-bottom: 24px; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(46,204,113,0.15), rgba(243,156,18,0.08));
  border: 1px solid rgba(46,204,113,0.35);
}
.launch-banner h2 { margin: 0 0 6px; font-size: 1.15rem; }
.launch-banner p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.grid-2 {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px; margin-bottom: 20px;
}
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.panel h2 { margin: 0 0 16px; font-size: 1.05rem; }

.notices-list { display: flex; flex-direction: column; gap: 12px; }
.notice-card {
  padding: 14px; border-radius: 10px; background: var(--surface-2);
  border-right: 3px solid var(--accent);
}
.notice-card.notice-warning { border-right-color: #f39c12; }
.notice-card.notice-metric { border-right-color: #3498db; }
.notice-card h3 { margin: 0 0 6px; font-size: 0.95rem; }
.notice-card p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.notice-card time { display: block; margin-top: 8px; font-size: 0.75rem; color: #666; }

.metrics-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px;
}
.metric-card {
  display: flex; gap: 10px; align-items: center;
  padding: 14px; border-radius: 10px; background: var(--surface-2);
}
.metric-icon { font-size: 1.4rem; }
.metric-label { display: block; font-size: 0.78rem; color: var(--muted); }
.metric-value { font-size: 1.1rem; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th, .data-table td {
  padding: 10px 12px; text-align: right;
  border-bottom: 1px solid var(--border);
}
.data-table th { color: var(--muted); font-weight: 600; }

/* Trial / demo panel (login) */
.trial-panel {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(52, 152, 219, 0.35);
  background: rgba(26, 47, 74, 0.55);
}
.trial-lead { margin: 0 0 10px; font-size: 0.9rem; color: #ecf0f1; }
.demo-form label { display: block; margin-bottom: 10px; }
.demo-form input {
  width: 100%; margin-top: 4px; padding: 10px 12px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-family: var(--font);
}
.demo-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.demo-success { color: var(--accent-2); font-size: 0.88rem; margin: 8px 0 0; }

.auth-switch { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.auth-register-prompt { margin: 16px 0 0; text-align: center; }
.btn-register-cta {
  display: block;
  width: 100%;
  margin: 0;
  padding: 12px 16px;
  background: transparent;
  border: 1px dashed var(--accent-2);
  border-radius: 10px;
  color: var(--accent-2);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-register-cta:hover {
  background: rgba(110, 231, 160, 0.12);
  color: var(--accent);
}
.field-hint { display: block; margin-top: 4px; font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.req { color: #e74c3c; font-style: normal; font-weight: 700; }
.btn-link {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent-2); font-family: var(--font); font-size: 0.92rem;
  font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}
.btn-link:hover { color: var(--accent); }

@media (max-width: 768px) {
  .view-dashboard { flex-direction: column; }
  .sidebar { width: 100%; border-left: none; border-bottom: 1px solid var(--border); }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .main-content { padding: 16px; }
  .view-login {
    padding: 16px 12px max(72px, calc(56px + env(safe-area-inset-bottom)));
    min-height: 100dvh;
    justify-content: flex-start;
    padding-top: max(16px, env(safe-area-inset-top));
  }
  .view-login .login-panel {
    width: min(420px, 100%);
    padding: clamp(16px, 4vw, 24px);
    margin: auto 0;
  }
  .view-login .login-form input { font-size: 16px; }
  .view-login .brand h1 { font-size: 1.15rem; }
  .portal-contact-footer { padding: 10px 12px; gap: 8px; }
}

/* RTL / LTR — portal layout mirrors with language */
html.godo-rtl .sidebar { border-left: 1px solid var(--border); border-right: none; }
html.godo-ltr .sidebar { border-right: 1px solid var(--border); border-left: none; }
html.godo-ltr .notice-card { border-right: none; border-left: 3px solid var(--accent); }
html.godo-ltr .notice-card.notice-warning { border-left-color: #f39c12; }
html.godo-ltr .notice-card.notice-metric { border-left-color: #3498db; }
html.godo-rtl .data-table th,
html.godo-rtl .data-table td { text-align: right; }
html.godo-ltr .data-table th,
html.godo-ltr .data-table td { text-align: left; }
html.godo-ltr .app-frame-bar { flex-direction: row; }
html.godo-rtl .lang-switch-row { flex-direction: row-reverse; }
html.godo-ltr .lang-switch-row { flex-direction: row; }

.sidebar-lang { margin-bottom: 12px; }
.lang-switch-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.lang-btn.active { border-color: var(--accent-2); color: var(--accent-2); }
.view-login .lang-switch-row { margin-bottom: 16px; }
