/* ============================
   PHISHING SIMULATOR - STYLES
   Outlook-inspired email client
   ============================ */

:root {
  --bg-primary: #f4f4f4;
  --bg-sidebar: #ffffff;
  --bg-main: #ffffff;
  --bg-topbar: #191e1e;
  --bg-topbar-dark: #0f1313;
  --text-primary: #191e1e;
  --text-secondary: #4b4f4f;
  --text-muted: #7a7f7f;
  --text-white: #ffffff;
  --border: #e1e1e1;
  --border-light: #ededed;
  --accent: #ff4000;
  --accent-hover: #d93600;
  --safe-green: #79992b;
  --safe-green-bg: #e9f1d4;
  --safe-green-hover: #6b8a25;
  --danger-red: #ff4000;
  --danger-red-bg: #ffe3d8;
  --danger-red-hover: #d93600;
  --warning-orange: #ff8a50;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.15);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition: 0.2s ease;
}

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

html,
body {
  height: 100%;
  font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow: hidden;
}

/* ===== SCREEN MANAGEMENT ===== */
.screen {
  display: none;
  width: 100%;
  height: 100%;
}

.screen.active {
  display: flex;
}

/* ===== WELCOME SCREEN ===== */
.welcome-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 15% 15%, rgba(0, 195, 215, 0.35), transparent 35%),
    radial-gradient(circle at 85% 10%, rgba(255, 64, 0, 0.25), transparent 40%),
    linear-gradient(135deg, #0f1313 0%, #191e1e 55%, #0b0d0d 100%);
  padding: 20px;
}

.welcome-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 50px 55px;
  max-width: 580px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.welcome-icon {
  margin-bottom: 20px;
}

.welcome-icon svg {
  color: var(--accent);
}

.welcome-card h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.welcome-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 25px;
}

.welcome-description {
  text-align: left;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 25px;
}

.welcome-description p {
  margin-bottom: 15px;
}

.welcome-tips {
  background: #f7f7f7;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px 20px;
  margin: 15px 0;
}

.welcome-tips h3 {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.welcome-tips ul {
  list-style: none;
  padding: 0;
}

.welcome-tips li {
  padding: 4px 0;
  padding-left: 20px;
  position: relative;
  font-size: 13px;
}

.welcome-tips li::before {
  content: '•';
  position: absolute;
  left: 6px;
  color: var(--text-primary);
  font-weight: bold;
}

.welcome-challenge {
  background: #f3f3f3;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 15px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  font-size: 13px;
}

.welcome-name-section {
  margin-bottom: 25px;
  text-align: left;
}

.welcome-name-section label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.welcome-name-section input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: inherit;
  transition: border-color var(--transition);
  outline: none;
}

.welcome-name-section input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 64, 0, 0.12);
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-large {
  padding: 14px 40px;
  font-size: 16px;
}

/* ===== OUTLOOK APP LAYOUT ===== */
.outlook-app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}

/* Top Bar */
.outlook-topbar {
  background: var(--bg-topbar);
  color: white;
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 56px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
}

.topbar-left svg {
  opacity: 0.9;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  opacity: 0.95;
}

.topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 20px;
}

.progress-bar-container {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 300px;
}

.progress-text {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0.9;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #60cdff;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.topbar-right {
  display: flex;
  align-items: center;
  min-width: 280px;
  justify-content: flex-end;
}

.verdict-buttons {
  display: flex;
  gap: 10px;
}

.btn-safe,
.btn-malicious {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-safe {
  background: var(--safe-green);
  color: white;
  border-color: var(--safe-green);
}

.btn-safe:hover {
  background: var(--safe-green-hover);
  border-color: var(--safe-green-hover);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(16, 124, 16, 0.3);
}

.btn-safe:active {
  transform: translateY(0);
}

.btn-malicious {
  background: var(--danger-red);
  color: white;
  border-color: var(--danger-red);
}

.btn-malicious:hover {
  background: var(--danger-red-hover);
  border-color: var(--danger-red-hover);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(209, 52, 56, 0.3);
}

.btn-malicious:active {
  transform: translateY(0);
}

.btn-safe.disabled,
.btn-malicious.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== OUTLOOK BODY ===== */
.outlook-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Sidebar */
.outlook-sidebar {
  width: 340px;
  min-width: 340px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.email-count {
  font-size: 12px;
  color: var(--text-muted);
  background: #f0f0f0;
  padding: 3px 10px;
  border-radius: 12px;
}

.email-list {
  flex: 1;
  overflow-y: auto;
}

.email-list-item {
  display: flex;
  flex-direction: column;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}

.email-list-item:hover {
  background: #f5f5f5;
}

.email-list-item.active {
  background: #e8f0fe;
  border-left: 3px solid var(--accent);
  padding-left: 17px;
}

.email-list-item.answered {
  opacity: 0.6;
}

.email-list-item.answered::after {
  content: '';
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.email-list-from {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.email-list-subject {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-list-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-list-date {
  font-size: 11px;
  color: var(--text-muted);
  position: absolute;
  right: 15px;
  top: 14px;
}

.email-list-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-answered-safe {
  background: var(--safe-green);
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.badge-answered-phishing {
  background: var(--danger-red);
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.verdict-badge.safe {
  background: var(--safe-green-bg);
  color: var(--safe-green);
}

.verdict-badge.phishing {
  background: var(--danger-red-bg);
  color: var(--danger-red);
}

/* ===== EMAIL VIEWER ===== */
.outlook-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-main);
}

.email-viewer {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.email-header {
  padding: 25px 35px 20px;
  border-bottom: 1px solid var(--border-light);
}

.email-subject-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.email-priority-icon {
  display: none;
}

.email-priority-icon.high {
  display: inline-flex;
  color: var(--danger-red);
}

.email-subject {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.email-meta {
  /* sender info block */
}

.sender-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.sender-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

.sender-info {
  flex: 1;
  min-width: 0;
}

.sender-name-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.sender-name {
  font-size: 15px;
  color: var(--text-primary);
}

.sender-email {
  font-size: 13px;
  color: var(--text-secondary);
}

.recipient-line,
.cc-line {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.meta-label {
  color: var(--text-muted);
  margin-right: 4px;
}

.meta-value {
  margin-right: 4px;
}

.meta-email {
  color: var(--text-muted);
  font-size: 12px;
}

.email-date {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 2px;
}

.email-attachment-bar {
  margin-top: 15px;
  padding: 10px 14px;
  background: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.attachment-name {
  color: var(--accent);
  font-weight: 500;
}

/* Email Body */
.email-body {
  padding: 25px 35px 40px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}

.email-body p {
  margin-bottom: 12px;
}

.email-body ul,
.email-body ol {
  margin: 10px 0;
  padding-left: 25px;
}

.email-body li {
  margin-bottom: 5px;
}

.email-body a {
  color: #0066cc;
  text-decoration: underline;
  cursor: pointer;
  position: relative;
}

.email-body a:hover {
  color: #004499;
}

.email-body table {
  margin: 10px 0;
}

/* Link Tooltip */
.link-tooltip {
  position: fixed;
  background: #333;
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: 'Courier New', monospace;
  pointer-events: none;
  z-index: 10000;
  display: none;
  max-width: 500px;
  word-break: break-all;
  box-shadow: var(--shadow-md);
}

.link-tooltip.visible {
  display: block;
}

/* ===== RESULTS SCREEN ===== */
.results-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 10%, rgba(0, 195, 215, 0.28), transparent 38%),
    radial-gradient(circle at 80% 5%, rgba(255, 64, 0, 0.22), transparent 42%),
    linear-gradient(135deg, #0f1313 0%, #191e1e 55%, #0b0d0d 100%);
  padding: 20px;
  overflow-y: auto;
}

.results-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 45px 50px;
  max-width: 700px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: fadeInUp 0.6s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.results-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.results-header .results-emoji {
  font-size: 56px;
  margin-bottom: 15px;
  display: block;
}

.results-header .subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.results-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 25px 0;
}

.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: var(--shadow-md);
}

.score-circle .score-num {
  font-size: 42px;
  line-height: 1;
}

.score-circle .score-label {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.8;
}

.score-circle.perfect {
  background: linear-gradient(135deg, #6b8a25, #79992b);
  color: white;
}

.score-circle.good {
  background: linear-gradient(135deg, #ff4000, #ff6a3d);
  color: white;
}

.score-circle.medium {
  background: linear-gradient(135deg, #00a5b6, #00c3d7);
  color: white;
}

.score-circle.low {
  background: linear-gradient(135deg, #3a3f3f, #191e1e);
  color: white;
}

.results-time {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 25px;
}

.results-breakdown {
  text-align: left;
  margin: 25px 0;
}

.results-breakdown h2 {
  font-size: 18px;
  margin-bottom: 15px;
  color: var(--text-primary);
}

.result-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  overflow: hidden;
  transition: all var(--transition);
}

.result-item.correct {
  border-left: 4px solid var(--safe-green);
}

.result-item.incorrect {
  border-left: 4px solid var(--danger-red);
}

.result-item-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background var(--transition);
}

.result-item-header:hover {
  background: #f8f8f8;
}

.result-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.result-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.result-icon.correct {
  background: var(--safe-green-bg);
  color: var(--safe-green);
}

.result-icon.incorrect {
  background: var(--danger-red-bg);
  color: var(--danger-red);
}

.result-subject {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-tags {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.result-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-tag.actual-safe {
  background: var(--safe-green-bg);
  color: var(--safe-green);
}

.result-tag.actual-phishing {
  background: var(--danger-red-bg);
  color: var(--danger-red);
}

.result-tag.difficulty {
  background: #f0f0f0;
  color: #666;
}

.result-expand-icon {
  color: var(--text-muted);
  transition: transform var(--transition);
  flex-shrink: 0;
  margin-left: 8px;
}

.result-item.expanded .result-expand-icon {
  transform: rotate(180deg);
}

.result-item-details {
  display: none;
  padding: 0 16px 16px;
  font-size: 13px;
  line-height: 1.6;
}

.result-item.expanded .result-item-details {
  display: block;
}

.result-explanation {
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.result-indicators {
  list-style: none;
  padding: 0;
}

.result-indicators li {
  padding: 4px 0 4px 20px;
  position: relative;
  color: var(--text-secondary);
  font-size: 12px;
}

.result-indicators li::before {
  content: '→';
  position: absolute;
  left: 2px;
  color: var(--accent);
  font-weight: bold;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a0a0a0;
}

/* ===== ANIMATIONS ===== */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.email-viewer {
  animation: slideIn 0.3s ease;
}

/* ===== CONFETTI CANVAS ===== */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .outlook-sidebar {
    width: 260px;
    min-width: 260px;
  }

  .topbar-center {
    display: none;
  }

  .email-header {
    padding: 20px 20px 15px;
  }

  .email-body {
    padding: 20px 20px 30px;
  }

  .email-subject {
    font-size: 18px;
  }
}

@media (max-width: 700px) {
  .outlook-sidebar {
    width: 220px;
    min-width: 220px;
  }

  .verdict-buttons {
    gap: 6px;
  }

  .btn-safe span,
  .btn-malicious span {
    display: none;
  }

  .btn-safe,
  .btn-malicious {
    padding: 8px 12px;
  }
}

/* Transition for screen switching */
.screen {
  transition: opacity 0.3s ease;
}

/* Pulse animation for verdict buttons */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(15, 108, 189, 0.4);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(15, 108, 189, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(15, 108, 189, 0);
  }
}

.btn-safe:not(.disabled),
.btn-malicious:not(.disabled) {
  animation: pulse 2s infinite;
}

.btn-safe:not(.disabled) {
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 124, 16, 0.3);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(16, 124, 16, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(16, 124, 16, 0);
  }
}

.btn-malicious:not(.disabled) {
  animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(209, 52, 56, 0.3);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(209, 52, 56, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(209, 52, 56, 0);
  }
}

/* Winner banner */
.winner-banner {
  background: linear-gradient(135deg, #6b8a25, #79992b);
  color: white;
  padding: 15px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 15px;
}

.winner-banner h2 {
  font-size: 22px;
  margin-bottom: 5px;
}

/* Loser message */
.try-again-msg {
  background: #f0f0f0;
  padding: 15px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  color: var(--text-secondary);
  font-size: 14px;
}