/* ─────────────────────────────────────────────
   Realcore Guide Portal — Shared Styles
   ───────────────────────────────────────────── */

/* === Brand Variables === */
:root {
  --navy:        #0d1b6e;
  --navy-dark:   #091254;
  --navy-light:  #1a2d8f;
  --blue:        #1a56db;
  --blue-hover:  #1648c0;
  --blue-light:  #e8f0fe;
  --white:       #ffffff;
  --bg:          #f5f7fb;
  --text:        #1e293b;
  --text-muted:  #64748b;
  --border:      #e2e8f0;
  --card-shadow: 0 2px 12px rgba(13, 27, 110, 0.08);
  --card-radius: 12px;
  --transition:  0.18s ease;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
img { max-width: 100%; display: block; }

/* === Site Header === */
.site-header {
  background: var(--navy);
  padding: 0 32px;
  height: 100px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.header-inner {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
}

.logo img {
  height: 44px;
  width: auto;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-text .brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--white);
}

.logo-text .brand-sub {
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
}

.logo-star {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.85);
  margin-right: 2px;
}

.header-badge {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
}

/* === Page Wrapper === */
.page-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px;
}

/* === Ornament background on inner pages === */
body:not(.auth-page) {
  background-color: var(--bg);
  background-image: url('images/ornament.svg');
  background-repeat: no-repeat;
  background-size: 110% auto;
  background-position: center -60px;
  background-attachment: fixed;
}

/* === Auth Page (Login) === */
.auth-page {
  background-color: var(--navy-dark);
  /* Drop images/hero-bg.jpg here to show a photo behind the overlay */
  background-image: url('images/hero-bg.jpg');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  min-height: 100vh;
  position: relative;
}

/* Dark overlay so login card stays legible over any background */
.auth-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(9, 18, 84, 0.90) 0%,
    rgba(13, 27, 110, 0.82) 60%,
    rgba(26, 45, 143, 0.78) 100%
  );
  z-index: 0;
}

.auth-page .site-header {
  position: relative;
  z-index: 2;
  background: rgba(7, 14, 66, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.auth-main {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 72px);
  padding: 40px 24px;
}

.auth-card {
  background: var(--white);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  text-align: center;
}

.auth-card h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 32px;
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.auth-form input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
  text-align: center;
  letter-spacing: 0.08em;
}

.auth-form input:focus {
  border-color: var(--blue);
}

.auth-form input.shake {
  animation: shake 0.5s ease;
  border-color: #ef4444;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
  width: 100%;
  transition: background var(--transition), transform var(--transition);
}

.btn-primary:hover {
  background: var(--blue-hover);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.auth-error {
  color: #ef4444;
  font-size: 0.875rem;
  font-weight: 500;
  height: 20px;
  opacity: 0;
  transition: opacity var(--transition);
}

.auth-error.visible {
  opacity: 1;
}

/* === Role Color Themes === */
:root {
  --role-accounting:       #059669;
  --role-accounting-light: #d1fae5;
  --role-broker:           #d97706;
  --role-broker-light:     #fef3c7;
  --role-management:       #7c3aed;
  --role-management-light: #ede9fe;
  --role-admin:            #0891b2;
  --role-admin-light:      #cffafe;
}

/* Role card accents */
.role-card.accounting:hover  { border-color: var(--role-accounting); }
.role-card.accounting .role-icon { background: var(--role-accounting-light); }
.role-card.accounting .role-icon svg { color: var(--role-accounting); }
.role-card.accounting .role-arrow  { color: var(--role-accounting); }

.role-card.broker:hover      { border-color: var(--role-broker); }
.role-card.broker .role-icon { background: var(--role-broker-light); }
.role-card.broker .role-icon svg { color: var(--role-broker); }
.role-card.broker .role-arrow    { color: var(--role-broker); }

.role-card.management:hover      { border-color: var(--role-management); }
.role-card.management .role-icon { background: var(--role-management-light); }
.role-card.management .role-icon svg { color: var(--role-management); }
.role-card.management .role-arrow    { color: var(--role-management); }

.role-card.admin:hover      { border-color: var(--role-admin); }
.role-card.admin .role-icon { background: var(--role-admin-light); }
.role-card.admin .role-icon svg { color: var(--role-admin); }
.role-card.admin .role-arrow    { color: var(--role-admin); }

/* Video page role badge (icon + title row) */
.role-page-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.role-page-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.role-page-icon svg {
  width: 24px;
  height: 24px;
}

.video-page-header.accounting h1 { color: var(--role-accounting); }
.video-page-header.accounting .role-page-icon { background: var(--role-accounting-light); color: var(--role-accounting); }

.video-page-header.broker h1 { color: var(--role-broker); }
.video-page-header.broker .role-page-icon { background: var(--role-broker-light); color: var(--role-broker); }

.video-page-header.management h1 { color: var(--role-management); }
.video-page-header.management .role-page-icon { background: var(--role-management-light); color: var(--role-management); }

.video-page-header.admin h1 { color: var(--role-admin); }
.video-page-header.admin .role-page-icon { background: var(--role-admin-light); color: var(--role-admin); }

/* === Roles Page === */
.roles-header {
  text-align: center;
  margin-bottom: 48px;
}

.roles-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
}

.roles-header p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.role-card {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--card-radius);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
}

.role-card:hover {
  border-color: var(--blue);
  box-shadow: var(--card-shadow);
  transform: translateY(-2px);
}

.role-icon {
  width: 52px;
  height: 52px;
  background: var(--blue-light);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.role-icon svg {
  width: 26px;
  height: 26px;
  color: var(--blue);
}

.role-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
}

.role-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.role-card .role-arrow {
  margin-top: auto;
  color: var(--blue);
  font-size: 1.2rem;
  font-weight: 600;
}

/* === Video Pages === */
.video-page-header {
  margin-bottom: 40px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 20px;
  transition: gap var(--transition);
}

.back-link:hover { gap: 10px; }
.back-link svg { width: 16px; height: 16px; }

.video-page-header h1 {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.video-page-header p {
  color: var(--text-muted);
  font-size: 0.975rem;
}

.videos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.video-card {
  background: var(--white);
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition), transform var(--transition);
}

.video-card:hover {
  box-shadow: 0 8px 24px rgba(13, 27, 110, 0.12);
  transform: translateY(-2px);
}

.video-wrapper {
  position: relative;
  width: 100%;
  background: var(--navy-dark);
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Placeholder shown when no video is loaded */
.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(255,255,255,0.4);
  font-size: 0.8rem;
  pointer-events: none;
}

.video-placeholder svg {
  width: 36px;
  height: 36px;
  opacity: 0.4;
}

.video-has-src .video-placeholder {
  display: none;
}

.video-info {
  padding: 20px 22px;
}

.video-info h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
  line-height: 1.35;
}

.video-info p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.video-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.video-number {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-light);
  border-radius: 4px;
  padding: 2px 7px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.video-date {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}

.video-date svg {
  width: 12px;
  height: 12px;
  opacity: 0.6;
}

/* === Empty state (no videos yet) === */
.videos-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}

.videos-empty svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  opacity: 0.3;
}

.videos-empty h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.videos-empty p {
  font-size: 0.9rem;
}

/* === Animations === */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%       { transform: translateX(-8px); }
  30%       { transform: translateX(8px); }
  45%       { transform: translateX(-6px); }
  60%       { transform: translateX(6px); }
  75%       { transform: translateX(-3px); }
  90%       { transform: translateX(3px); }
}

/* === Responsive === */
@media (max-width: 768px) {
  .roles-grid {
    grid-template-columns: 1fr;
  }

  .videos-grid {
    grid-template-columns: 1fr;
  }

  .roles-header h1 {
    font-size: 1.5rem;
  }

  .video-page-header h1 {
    font-size: 1.5rem;
  }

  .auth-card {
    padding: 36px 24px;
  }

  .page-wrapper {
    padding: 32px 16px;
  }
}

@media (max-width: 480px) {
  .auth-card h1 {
    font-size: 1.35rem;
  }
}
