/* ===== ITTDMR Portal — Global Styles ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-input: #1e293b;
  --bg-surface: #f8fafc;
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --accent: #06b6d4;
  --accent2: #8b5cf6;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dark: #1e293b;
  --text-dark-muted: #64748b;
  --border: #334155;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --gradient-1: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  --gradient-2: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --gradient-3: linear-gradient(135deg, #6366f1, #4f46e5);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.4);
  --shadow-glow: 0 0 20px rgba(99,102,241,.15);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== TOP NAV ===== */
.topnav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.topnav-brand {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.5px;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}

.topnav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topnav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  transition: all .2s;
}

.topnav-links a:hover {
  color: var(--text);
  background: rgba(99,102,241,.1);
}

.topnav-links a.active {
  color: var(--primary-light);
  background: rgba(99,102,241,.12);
}

.topnav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 16px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.topnav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.topnav-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.topnav-role {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.btn-logout {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all .2s;
  margin-left: 8px;
}

.btn-logout:hover {
  color: var(--danger);
  background: rgba(239,68,68,.1);
}

/* ===== PAGE CONTAINER ===== */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--text);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== CARDS ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all .25s ease;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-1);
  opacity: 0;
  transition: opacity .25s;
}

.card:hover {
  border-color: rgba(99,102,241,.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.card:hover::before { opacity: 1; }

.card-icon {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===== STAT CARDS ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-value {
  font-size: 36px;
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all .2s;
  font-family: inherit;
}

.btn-primary {
  background: var(--gradient-3);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99,102,241,.4);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.form-input::placeholder { color: var(--text-muted); opacity: .6; }

/* ===== TABLE ===== */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table-wrap th {
  background: rgba(99,102,241,.06);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table-wrap td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(51,65,85,.4);
  color: var(--text);
}

.table-wrap tr:last-child td { border-bottom: none; }

.table-wrap tr:hover td { background: rgba(99,102,241,.03); }

/* ===== BADGE ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
}

.badge-admin { background: rgba(99,102,241,.15); color: var(--primary-light); }
.badge-viewer { background: rgba(6,182,212,.15); color: var(--accent); }

/* ===== BACK LINK ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  transition: color .2s;
}

.back-link:hover { color: var(--primary-light); }

.back-link svg {
  width: 16px; height: 16px;
}

/* ===== ALERT ===== */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}

.alert-error {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.2);
  color: #fca5a5;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: .5; }
.empty-state-text { font-size: 15px; }

/* ===== IFRAME WRAPPER ===== */
.iframe-wrap {
  width: 100%;
  border-radius: 0;
  overflow: hidden;
  border: none;
  background: #fff;
}

.iframe-wrap iframe {
  width: 100%;
  
  border: none;
  display: block;
}

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(99,102,241,.12) 0%, transparent 70%);
  top: -200px; right: -200px;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(6,182,212,.08) 0%, transparent 70%);
  bottom: -150px; left: -150px;
}

.login-box {
  width: 100%;
  max-width: 400px;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-text {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: var(--gradient-3);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
  box-shadow: 0 4px 12px rgba(99,102,241,.3);
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,.4);
}

.login-footer {
  text-align: center;
  margin-top: 20px;
}

.login-footer a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  transition: color .2s;
}

.login-footer a:hover { color: var(--primary-light); }

/* ===== LANDING PAGE ===== */
.landing-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.landing-page::before {
  content: '';
  position: absolute;
  width: 800px; height: 800px;
  background: radial-gradient(circle, rgba(99,102,241,.08) 0%, transparent 70%);
  top: -300px; left: 50%; transform: translateX(-50%);
}

.landing-content {
  position: relative;
  z-index: 1;
}

.landing-title {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -1.5px;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.landing-desc {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 32px;
  max-width: 500px;
}

.landing-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .topnav { padding: 0 16px; }
  .page { padding: 20px 16px; }
  .card-grid { grid-template-columns: 1fr; }
  .landing-title { font-size: 32px; }
  .landing-desc { font-size: 15px; }
}
