/* 
 * RRB NTPC Result Checker Widget Stylesheet
 * Premium Glassmorphic Design System
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette */
  --bg-primary: #f8fafc;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-bg-hover: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(15, 23, 42, 0.08);
  --glass-border-focus: rgba(99, 102, 241, 0.4);
  
  --primary: #6366f1; /* Indigo */
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.15);
  
  --success: #059669; /* Emerald */
  --success-glow: rgba(5, 150, 105, 0.15);
  --success-bg: rgba(5, 150, 105, 0.08);
  
  --error: #dc2626; /* Rose */
  --error-glow: rgba(220, 38, 38, 0.15);
  --error-bg: rgba(220, 38, 38, 0.08);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Layout */
  --radius-lg: 20px;
  --radius-md: 12px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-glow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

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

body {
  font-family: var(--font-sans);
  background: transparent; /* Allows transparency in iframe */
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 16px;
  overflow: hidden;
}

/* Background mesh fallback if embedded without backdrop */
.widget-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-glow);
  background: var(--bg-primary);
  border: 1px solid var(--glass-border);
}

/* Glowing background blur blobs */
.glow-blob {
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  z-index: 0;
  pointer-events: none;
}
.blob-1 {
  top: -50px;
  left: -50px;
  background: var(--primary);
}
.blob-2 {
  bottom: -50px;
  right: -50px;
  background: #a855f7; /* Purple */
}

/* Main glass card container */
.glass-card {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 32px 28px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  transition: var(--transition-smooth);
}

/* Header */
.widget-header {
  text-align: center;
  margin-bottom: 28px;
}
.widget-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  color: var(--primary);
  font-size: 24px;
}
.widget-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #0f172a 40%, #4f46e5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}
.widget-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Form Fields */
.form-group {
  margin-bottom: 20px;
  position: relative;
}
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 16px;
  color: var(--text-secondary);
  font-size: 18px;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.form-control {
  width: 100%;
  padding: 14px 16px 14px 46px;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 400;
  outline: none;
  transition: var(--transition-smooth);
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(255, 255, 255, 0.85);
}
/* Select dropdown overrides */
select.form-control {
  appearance: none;
  cursor: pointer;
}
.select-arrow {
  position: absolute;
  right: 16px;
  color: var(--text-secondary);
  pointer-events: none;
  font-size: 12px;
}

/* Specific select dropdown styles for options */
select.form-control option {
  background-color: #ffffff;
  color: var(--text-primary);
}

/* Validation helper */
.validation-error {
  font-size: 0.75rem;
  color: var(--error);
  margin-top: 4px;
  display: none;
  align-items: center;
  gap: 4px;
}

/* Button primary */
.btn-primary {
  width: 100%;
  padding: 15px;
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  transition: var(--transition-smooth);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Loading spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Views swapping */
.view-state {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}
.view-state.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* Congratulations & Not Qualified screens */
.result-screen {
  text-align: center;
  padding: 10px 0;
}
.result-icon-container {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.success-container {
  background: var(--success-bg);
  border: 1px solid rgba(16, 185, 129, 0.2);
  box-shadow: 0 0 24px var(--success-glow);
}
.error-container {
  background: var(--error-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  box-shadow: 0 0 24px var(--error-glow);
}

/* Custom checkmark animations */
.checkmark {
  width: 48px;
  height: 48px;
  stroke: var(--success);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.checkmark-circle {
  stroke-dasharray: 157;
  stroke-dashoffset: 157;
  animation: drawCircle 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.checkmark-check {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: drawCheck 0.4s 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes drawCircle {
  to { stroke-dashoffset: 0; }
}
@keyframes drawCheck {
  to { stroke-dashoffset: 0; }
}

/* Custom cross animation */
.cross-icon {
  width: 42px;
  height: 42px;
  stroke: var(--error);
  stroke-width: 4;
  stroke-linecap: round;
  fill: none;
}
.cross-line1 {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: drawLine 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.cross-line2 {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: drawLine 0.4s 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}

/* Results Content */
.result-badge {
  display: inline-block;
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 50px;
  margin-bottom: 16px;
}
.badge-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.result-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}
.title-success {
  background: linear-gradient(135deg, #065f46 40%, #059669 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.title-error {
  background: linear-gradient(135deg, #991b1b 40%, #dc2626 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.result-message {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}
.result-message strong {
  color: var(--text-primary);
}

.candidate-summary {
  background: rgba(15, 23, 42, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 28px;
  text-align: left;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.875rem;
}
.summary-row:last-child {
  margin-bottom: 0;
}
.summary-label {
  color: var(--text-secondary);
}
.summary-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* Secondary Button */
.btn-secondary {
  width: 100%;
  padding: 14px;
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-secondary:hover {
  background: rgba(15, 23, 42, 0.08);
  border-color: var(--text-secondary);
}

/* Canvas Confetti overlay */
#confetti-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Responsive adjustment */
@media (max-width: 480px) {
  body {
    padding: 0;
  }
  .widget-wrapper {
    max-width: 100%;
    border-radius: 0;
    min-height: 100vh;
    border: none;
  }
  .glass-card {
    border-radius: 0;
    min-height: 100vh;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}
