/* ====================================================================
   Masjid Ar-Royyaan Management Portal & TV Display — portal.css
   Modern, Clean, High-Contrast UI for Mosque Operations & Lobby TV Mode
   ==================================================================== */

:root {
  --portal-primary: #0F5132;
  --portal-primary-dark: #0A3622;
  --portal-primary-light: #157347;
  
  --portal-gold: #C59B27;
  --portal-gold-dark: #9A7B1C;
  --portal-gold-light: #F4E8C1;

  --portal-bg: #F1F5F9;
  --portal-card: #FFFFFF;
  --portal-sidebar: #0A3622;
  --portal-topbar: #FFFFFF;

  --portal-text: #1E293B;
  --portal-text-muted: #64748B;
  --portal-border: #E2E8F0;

  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #0284C7;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  
  --sidebar-width: 260px;
  --topbar-height: 4rem;
}

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

html, body {
  font-family: var(--font-sans);
  background-color: var(--portal-bg);
  color: var(--portal-text);
  line-height: 1.5;
  height: 100%;
}

#portalApp {
  min-height: 100vh;
}

/* Layout */
.portal-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.portal-sidebar {
  width: var(--sidebar-width);
  background-color: var(--portal-sidebar);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  text-decoration: none;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--portal-gold) 0%, var(--portal-gold-dark) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.sidebar-menu {
  list-style: none;
  padding: 1rem 0.75rem;
  flex: 1;
  overflow-y: auto;
}

.sidebar-item {
  margin-bottom: 0.35rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.sidebar-link:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}

.sidebar-link.active {
  background-color: var(--portal-primary-light);
  color: #FFFFFF;
  font-weight: 600;
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

/* Main Content Area */
.portal-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.portal-topbar {
  height: var(--topbar-height);
  background: var(--portal-topbar);
  border-bottom: 1px solid var(--portal-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--portal-primary-dark);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  background: var(--portal-gold-light);
  color: var(--portal-gold-dark);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Container & Pages */
.page-container {
  padding: 2rem;
  flex: 1;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Cards & Widgets */
.portal-card {
  background: var(--portal-card);
  border: 1px solid var(--portal-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.5rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--portal-card);
  border: 1px solid var(--portal-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: #E8F5E9;
  color: var(--portal-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--portal-primary-dark);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--portal-text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--portal-primary);
  color: #FFFFFF;
}

.btn-primary:hover {
  background-color: var(--portal-primary-light);
}

.btn-gold {
  background-color: var(--portal-gold);
  color: #FFFFFF;
}

.btn-gold:hover {
  background-color: var(--portal-gold-dark);
}

.btn-outline {
  border-color: var(--portal-border);
  background: #FFFFFF;
  color: var(--portal-text);
}

.btn-outline:hover {
  background: #F8FAFC;
  border-color: var(--portal-text-muted);
}

.btn-danger {
  background-color: var(--danger);
  color: #FFFFFF;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-green { background: #DEF7EC; color: #03543F; }
.badge-gold  { background: #FEF08A; color: #854D0E; }
.badge-red   { background: #FDE8E8; color: #9B1C1C; }
.badge-blue  { background: #E1EFFE; color: #1E429F; }

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--portal-text);
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--portal-border);
  font-size: 0.9rem;
  font-family: inherit;
  background-color: #FFFFFF;
  color: var(--portal-text);
}

.form-control:focus {
  outline: none;
  border-color: var(--portal-primary);
  box-shadow: 0 0 0 3px rgba(15, 81, 50, 0.15);
}

/* Table */
.portal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.portal-table th {
  background-color: #F8FAFC;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--portal-text-muted);
  border-bottom: 1px solid var(--portal-border);
}

.portal-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--portal-border);
  color: var(--portal-text);
}

.portal-table tr:hover td {
  background-color: #F8FAFC;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--portal-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 1.5rem;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--portal-border);
  background: #F8FAFC;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ====================================================================
   TV DISPLAY MODE (Widescreen 16:9 Mosque Lobby Terminal)
   ==================================================================== */
.tv-display-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 10%, #0A3622 0%, #051B11 100%);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  z-index: 9999;
  font-family: var(--font-sans);
  overflow: hidden;
  user-select: none;
}

.tv-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 3rem;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 2px solid var(--portal-gold);
}

.tv-mosque-name {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tv-clock-box {
  text-align: right;
}

.tv-clock-time {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.tv-clock-date {
  font-size: 1.25rem;
  color: var(--portal-gold-light);
  font-weight: 600;
  margin-top: 0.35rem;
}

/* TV Center Body (Rotating Slides) */
.tv-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 3rem;
  position: relative;
}

.tv-slide-card {
  width: 100%;
  max-width: 1100px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(197, 155, 39, 0.4);
  border-radius: var(--radius-xl);
  padding: 2.5rem 3.5rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: fadeInSlide 0.5s ease-in-out;
}

@keyframes fadeInSlide {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.tv-slide-badge {
  display: inline-block;
  padding: 0.4rem 1.25rem;
  background: var(--portal-gold);
  color: #0A3622;
  font-weight: 800;
  font-size: 1.1rem;
  border-radius: var(--radius-pill);
  margin-bottom: 1.25rem;
}

.tv-slide-title {
  font-size: 2.75rem;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.tv-slide-text {
  font-size: 1.6rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
}

/* TV Prayer Bar (5 Times + Iqomah Countdown) */
.tv-prayer-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1.25rem;
  padding: 1.25rem 3rem 1.5rem 3rem;
  background: rgba(0, 0, 0, 0.4);
}

.tv-prayer-box {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-align: center;
  transition: all 0.3s ease;
}

.tv-prayer-box.active {
  background: linear-gradient(135deg, var(--portal-gold) 0%, var(--portal-gold-dark) 100%);
  border-color: #FFFFFF;
  color: #0A3622;
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(197, 155, 39, 0.4);
}

.tv-prayer-box.active .tv-pname,
.tv-prayer-box.active .tv-ptime {
  color: #0A3622;
}

.tv-pname {
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--portal-gold-light);
  margin-bottom: 0.35rem;
}

.tv-ptime {
  font-size: 2.25rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #FFFFFF;
}

/* TV Running Marquee Text */
.tv-marquee {
  background: var(--portal-gold);
  color: #0A3622;
  padding: 0.85rem 0;
  font-size: 1.35rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.tv-marquee-inner {
  display: inline-block;
  padding-left: 100%;
  animation: marqueeAnim 35s linear infinite;
}

@keyframes marqueeAnim {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-100%, 0); }
}

/* Exit TV Button */
.tv-exit-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.5);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  cursor: pointer;
  z-index: 10000;
  opacity: 0.4;
  transition: opacity 0.2s;
}

.tv-exit-btn:hover {
  opacity: 1;
}
