@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* 
   * FundingOptimal Official Color Scheme
   * Ngjyrat e sakta nga fundingoptimal.com
   */
  
  /* Primary Colors - Ngjyra kryesore */
  --primary: #010201;              /* Primary Color - rgb(1, 2, 1) */
  --primary-dark: #000000;         /* Version i errët i primary */
  --primary-light: #345C41;        /* Version i çelët - përdor Secondary si light */
  
  /* Secondary Colors - Ngjyra e dytë */
  --secondary: #345C41;            /* Secondary Color - rgb(52, 92, 65) */
  --secondary-dark: #2a4a35;       /* Version i errët i secondary */
  --secondary-light: #A0E5C2;      /* Tertiary / Soft - rgb(160, 229, 194) */
  
  /* Accent Colors - Për akcente dhe highlight */
  --accent: #0DFE5A;               /* Accent / Highlight - rgb(13, 254, 90) */
  --accent-hover: #0be04f;         /* Version i errët i accent për hover */
  --accent-light: #A0E5C2;         /* Tertiary / Soft për backgrounds */
  
  /* Background Colors */
  --bg: #F7FEFB;                   /* Light Background - rgb(247, 254, 251) */
  --bg-gradient: linear-gradient(135deg, #345C41 0%, #0DFE5A 100%);
  --card: #ffffff;
  
  /* Text Colors */
  --text: #010201;                 /* Primary për tekst */
  --text-light: #345C41;           /* Secondary për tekst të çelët */
  --muted: #747480;                /* Gray / Neutral - rgb(116, 116, 128) */
  
  /* Border Colors */
  --border: #A0E5C2;               /* Tertiary / Soft për borders */
  --border-light: #F7FEFB;         /* Light Background për borders të çelët */
  
  /* Status Colors */
  --danger: #ef4444;               /* Mbetet e njëjtë për error messages */
  --success: #16A044;              /* Support / Success Green - rgb(22, 160, 68) */
  --warning: #f59e0b;              /* Mbetet e njëjtë për warnings */
  
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(52, 92, 65, 0.15);
  --shadow-xl: 0 20px 40px rgba(1, 2, 1, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(52, 92, 65, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(13, 254, 90, 0.05) 0%, transparent 50%);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 60px 20px;
}

/* Centered layout for the applicant info form (index.php) */
body.center-page {
  min-height: 100vh;
  display: flex;
}

body.center-page .container {
  width: 100%;
  margin: auto;
  padding: 40px 20px;
}

/* Flags background (index.php) */
body.flags-bg {
  position: relative;
  overflow: hidden;
}

.bg-flags {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

body.flags-bg .container {
  position: relative;
  z-index: 1;
}

body.flags-bg .bg-flag {
  position: absolute;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  /* Hexagon shape using clip-path */
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%) !important;
  -webkit-clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%) !important;
  background: transparent !important; /* Remove background so flag fills the hexagon */
  border: 2px solid rgba(13, 254, 90, 0.4) !important;
  box-shadow: 0 8px 22px rgba(1, 2, 1, 0.15), 0 0 20px rgba(13, 254, 90, 0.15) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transform: translate(-50%, -50%);
  animation-name: bg-flag-float;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  will-change: transform;
  font-size: 24px;
  line-height: 1;
  width: 60px !important;
  height: 60px !important;
  aspect-ratio: 1 / 1 !important;
  /* Comprehensive emoji font stack for all platforms - prioritize Windows emoji fonts */
  font-family: 
    "Segoe UI Emoji",
    "Segoe UI Symbol",
    "Apple Color Emoji",
    "Noto Color Emoji",
    "Noto Emoji",
    "EmojiOne Color",
    "EmojiOne Mozilla",
    "Twemoji Mozilla",
    "Android Emoji",
    "EmojiSymbols",
    "EmojiSymbols-Regular",
    "Symbola",
    sans-serif;
  font-style: normal;
  font-weight: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-feature-settings: "liga", "calt", "zero";
  font-feature-settings: "liga", "calt", "zero";
  font-variant-emoji: emoji;
  -webkit-font-variant-emoji: emoji;
  -moz-font-feature-settings: "emoji";
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  /* Force emoji rendering */
  unicode-bidi: normal;
  direction: ltr;
  /* Prevent font inheritance from body */
  font-variant: normal;
  text-transform: none;
  /* Ensure perfect circle */
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  /* Force hardware acceleration for better rendering */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

body.flags-bg .bg-flag > span {
  display: inline-block !important;
  line-height: 1 !important;
  font-size: inherit !important;
  font-family: inherit !important;
  font-variant-emoji: emoji !important;
  -webkit-font-variant-emoji: emoji !important;
  -moz-font-feature-settings: "emoji" !important;
  text-rendering: optimizeLegibility !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

/* Flag images for better desktop compatibility */
body.flags-bg .bg-flag img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important; /* Cover fills the hexagon completely */
  object-position: center !important;
  display: block !important;
  /* Hexagon shape using clip-path to match container */
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%) !important;
  -webkit-clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%) !important;
  image-rendering: -webkit-optimize-contrast !important;
  image-rendering: crisp-edges !important;
  image-rendering: high-quality !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  pointer-events: none !important;
}

@keyframes bg-flag-float {
  0%, 100% { transform: translate(-50%, -50%) translateY(0px); }
  50% { transform: translate(-50%, -50%) translateY(-10px); }
}

.container-wide {
  max-width: 1400px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

h1, h2, h3 {
  margin: 0 0 16px 0;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

h1 {
  font-size: 36px;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: 30px;
  color: var(--text);
}

h3 {
  font-size: 24px;
  color: var(--text);
}

p {
  margin: 0 0 16px 0;
  color: var(--text-light);
  line-height: 1.7;
}

label {
  display: block;
  margin-top: 24px;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

label:first-child {
  margin-top: 0;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 254, 90, 0.1);
  transform: translateY(-1px);
}

button {
  margin-top: 32px;
  padding: 16px 40px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius);
  border: none;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
  color: var(--primary);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(52, 92, 65, 0.3);
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

button:hover::before {
  left: 100%;
}

button:hover {
  background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13, 254, 90, 0.4);
  color: var(--primary);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(52, 92, 65, 0.3);
}

fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

legend {
  padding: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.option input {
  width: auto;
}

.alert {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid #fed7d7;
  background: #fff5f5;
  color: var(--danger);
  font-size: 14px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  background: var(--card);
}

.table thead {
  background: #f8f9fa;
}

.table th,
.table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.table th:first-child,
.table td:first-child {
  min-width: 140px;
  max-width: 220px;
}

.table th:nth-child(2),
.table td:nth-child(2) {
  min-width: 200px;
  max-width: 320px;
}

.table th:nth-child(3),
.table td:nth-child(3) {
  width: 90px;
  min-width: 90px;
  text-align: center;
}

.table th:nth-child(4),
.table td:nth-child(4),
.table th:nth-child(5),
.table td:nth-child(5) {
  min-width: 160px;
  max-width: 200px;
  font-size: 13px;
}

.table th:last-child,
.table td:last-child {
  min-width: 150px;
  max-width: 180px;
  text-align: center;
}

.table th {
  background: #f8f9fa;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover {
  background: #f8f9fa;
}

a {
  color: var(--secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
}

a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 0;
  background: var(--accent);
  transition: width 0.3s ease;
}

a:hover {
  color: var(--accent);
}

a:hover::after {
  width: 100%;
}

hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 32px 0;
}

/* Progress info styling */
#progress-info {
  text-align: center;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: opacity 0.3s ease;
}

/* Timer display */
#timer-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 32px auto;
}

#timer-progress-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(
    from -90deg,
    #10b981 0deg,
    #10b981 var(--timer-green-end, 0deg),
    #ea580c var(--timer-green-end, 0deg),
    #ea580c var(--timer-orange-end, 0deg),
    #dc2626 var(--timer-orange-end, 0deg),
    #dc2626 var(--timer-red-end, 0deg),
    #f3f4f6 var(--timer-red-end, 0deg),
    #f3f4f6 360deg
  );
  transition: background 0.3s ease;
  z-index: 1;
}

#timer-progress-ring.pulse-light {
  animation: pulseLight 1.5s ease-in-out infinite;
}

#timer-progress-ring.pulse-strong {
  animation: pulseStrong 0.8s ease-in-out infinite;
}

#timer-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  border-radius: 50%;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  font-weight: 700;
  font-family: 'Courier New', 'Monaco', 'Menlo', 'Consolas', monospace;
  color: var(--text);
  letter-spacing: 0;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: color 0.3s ease;
}

#timer-display.warning {
  color: #ea580c;
  box-shadow: 0 2px 12px rgba(234, 88, 12, 0.3);
}

#timer-display.critical {
  color: #dc2626;
  animation: pulse 1s infinite;
  box-shadow: 0 2px 12px rgba(220, 38, 38, 0.4);
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes pulseLight {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.02);
  }
}

@keyframes pulseStrong {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

/* Question fieldset styling */
.question-fieldset {
  margin-bottom: 0;
}

.question-fieldset legend {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 32px;
  line-height: 1.5;
}

.question-fieldset label {
  display: flex;
  align-items: flex-start;
  margin: 0 0 12px 0;
  padding: 18px 20px;
  cursor: pointer;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: var(--card);
  transition: border-color 0.2s ease;
  font-weight: 400;
  font-size: 15px;
  color: var(--text-light);
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

.question-fieldset input[type="radio"] {
  width: 20px;
  height: 20px;
  margin-right: 16px;
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--border);
}

.question-fieldset input[type="radio"]:checked ~ * {
  color: var(--text);
}

.question-fieldset label:has(input[type="radio"]:checked),
.question-fieldset label.selected {
  background: var(--card);
  border-color: #e2e8f0;
  color: var(--text);
  font-weight: 500;
}

.question-fieldset label.selected.correct-answer {
  background: var(--card) !important;
  border-color: #10b981 !important;
  border-width: 2px !important;
  color: var(--text) !important;
  font-weight: 500 !important;
}

.question-fieldset label.selected.correct-answer input[type="radio"] {
  accent-color: #10b981 !important;
  outline: none !important;
  border: 2px solid #10b981 !important;
  box-shadow: none !important;
  border-radius: 50% !important;
}

.question-fieldset label.selected.incorrect-answer {
  background: var(--card) !important;
  border-color: #ef4444 !important;
  border-width: 2px !important;
  color: var(--text) !important;
  font-weight: 500 !important;
}

.question-fieldset label.selected.incorrect-answer input[type="radio"] {
  accent-color: #ef4444 !important;
  outline: none !important;
  border: 2px solid #ef4444 !important;
  box-shadow: none !important;
  border-radius: 50% !important;
}

.hidden {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .container {
    padding: 40px 16px;
  }

  .card {
    padding: 32px 24px;
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 24px;
  }

  #timer-display {
    font-size: 42px;
    width: 120px;
    height: 120px;
    line-height: 120px;
    margin: 24px auto;
  }

  .question-fieldset label {
    padding: 16px;
  }
}
