/* cpns.css - Premium Dedicated Style for CPNS Simulator & Dashboard */

/* Custom Scrollbar for elements */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Custom Scrollbar for sidebar container */
.sidebar-scroll::-webkit-scrollbar {
    width: 6px;
}
.sidebar-scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Glassmorphism Panels */
.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.dark .glass-panel {
    background: rgba(15, 23, 42, 0.85);
}

/* Interactive Option Card Transitions */
.option-card {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.option-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
}

/* CAT Grid Button States */
.question-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.question-btn.answered {
    background-color: #22c55e !important;
    color: white !important;
    border-color: #22c55e !important;
}
.question-btn.doubtful {
    background-color: #eab308 !important;
    color: white !important;
    border-color: #eab308 !important;
}
.question-btn.active {
    background-color: #facc15 !important;
    color: #1e293b !important;
    border-color: #facc15 !important;
    box-shadow: none !important;
    font-weight: 800 !important;
}

.category-tab {
    transition: all 0.25s ease;
}

/* Dashboard Progress Bar Threshold Line */
.progress-container {
    position: relative;
    width: 100%;
}
.threshold-line {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    background-color: #EF4444; /* BKN Red Alert Indicator */
    z-index: 20;
    pointer-events: none;
}
.threshold-line::after {
    content: attr(data-threshold-val);
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    font-weight: 800;
    color: #EF4444;
    white-space: nowrap;
    background: #FFE4E6;
    padding: 1px 4px;
    border-radius: 4px;
    border: 1px solid #FECDD3;
}
.dark .threshold-line::after {
    background: #4C0519;
    color: #FDA4AF;
    border-color: #881337;
}

/* Fade-out visual indicator for scrollable cards */
.scroll-fade-container {
    position: relative;
}
.scroll-fade-container::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 20px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.8), transparent);
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.3s;
}
.dark .scroll-fade-container::after {
    background: linear-gradient(to top, rgba(23, 32, 51, 0.8), transparent);
}

/* Premium Mobile Notch & Home-Indicator Safe Area Spacing on Dashboard */
.dashboard-header {
    padding-top: env(safe-area-inset-top, 0px) !important;
    height: calc(4rem + env(safe-area-inset-top, 0px)) !important;
}
.dashboard-main {
    padding-top: calc(5rem + env(safe-area-inset-top, 0px)) !important;
    padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px)) !important;
}

/* Custom offline alert toast */
#offline-toast {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 100;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    transform: translateY(150px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#offline-toast.show {
    transform: translateY(0);
}

/* Accordion Transitions */
.accordion-content {
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out, padding 0.3s ease-in-out;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}
.accordion-content.expanded {
    max-height: 500px;
    opacity: 1;
    padding-top: 0.75rem;
}
.accordion-icon {
    transition: transform 0.3s ease;
}
.accordion-icon.rotated {
    transform: rotate(180deg);
}

.btn-pejuang {
  --white: #fff;
  --brand-100: #fef3c7;
  --brand-200: #fde68a;
  --brand-300: #fbbf24;
  --brand-400: #f59e0b;
  --brand-500: #ea580c;
  --radius: 18px;

  border-radius: var(--radius);
  outline: none;
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
  background: transparent;
  letter-spacing: -0.5px;
  border: 0;
  position: relative;
  width: 100%;
  max-width: 340px;
  height: 60px;
  transform: rotate(358deg) skewX(2deg);
  margin: 10px auto;
  display: block;
}

.btn-pejuang .bg {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  filter: blur(1px);
}
.btn-pejuang .bg::before,
.btn-pejuang .bg::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: calc(var(--radius) * 1.1);
  background: var(--brand-500);
}
.btn-pejuang .bg::before {
  filter: blur(5px);
  transition: all 0.3s ease;
  box-shadow:
    -7px 6px 0 0 rgb(234 88 12 / 40%),
    -14px 12px 0 0 rgb(234 88 12 / 30%),
    -21px 18px 4px 0 rgb(234 88 12 / 25%),
    -28px 24px 8px 0 rgb(234 88 12 / 15%),
    -35px 30px 12px 0 rgb(234 88 12 / 12%);
}

.btn-pejuang .wrap {
  border-radius: inherit;
  overflow: hidden;
  height: 100%;
  transform: translate(4px, -4px);
  padding: 3px;
  background: linear-gradient(
    to bottom,
    var(--brand-300) 0%,
    var(--brand-500) 100%
  );
  position: relative;
  transition: all 0.3s ease;
}

.btn-pejuang .outline {
  position: absolute;
  overflow: hidden;
  inset: 0;
  opacity: 0;
  outline: none;
  border-radius: inherit;
  transition: all 0.4s ease;
}
.btn-pejuang .outline::before {
  content: "";
  position: absolute;
  inset: 2px;
  width: 120px;
  height: 300px;
  margin: auto;
  background: linear-gradient(
    to right,
    transparent 0%,
    white 50%,
    transparent 100%
  );
  animation: spin 3s linear infinite;
  animation-play-state: paused;
}

.btn-pejuang .content {
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  position: relative;
  height: 100%;
  gap: 12px;
  border-radius: calc(var(--radius) * 0.85);
  font-weight: 800;
  transition: all 0.3s ease;
  background: linear-gradient(
    to bottom,
    var(--brand-400) 0%,
    var(--brand-500) 100%
  );
  box-shadow:
    inset -2px 12px 11px -5px var(--brand-300),
    inset 1px -3px 11px 0px rgb(0 0 0 / 35%);
}
.btn-pejuang .content::before {
  content: "";
  inset: 0;
  position: absolute;
  z-index: 10;
  width: 80%;
  top: 45%;
  bottom: 35%;
  opacity: 0.7;
  margin: auto;
  background: linear-gradient(to bottom, transparent, var(--brand-500));
  filter: brightness(1.3) blur(5px);
}

.btn-pejuang .char {
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-pejuang .char span {
  display: block;
  color: transparent;
  position: relative;
}
.btn-pejuang .char.state-1 span {
  animation: charAppear 1.2s ease backwards calc(var(--i) * 0.1s);
}
.btn-pejuang .char.state-1 span::before,
.btn-pejuang .char span::after {
  content: attr(data-label);
  position: absolute;
  color: var(--white);
  text-shadow: -1px 1px 2px var(--brand-500);
  left: 0;
}
.btn-pejuang .char span::before {
  opacity: 0;
  transform: translateY(-100%);
}
.btn-pejuang .char.state-2 {
  position: absolute;
  left: 60px;
}
.btn-pejuang .char.state-2 span::after {
  opacity: 1;
}

.btn-pejuang .icon {
  animation: resetArrow 0.8s cubic-bezier(0.7, -0.5, 0.3, 1.2) forwards;
  z-index: 10;
}
.btn-pejuang .icon div,
.btn-pejuang .icon div::before,
.btn-pejuang .icon div::after {
  height: 3px;
  border-radius: 1px;
  background-color: var(--white);
}
.btn-pejuang .icon div::before,
.btn-pejuang .icon div::after {
  content: "";
  position: absolute;
  right: 0;
  transform-origin: center right;
  width: 10px;
  border-radius: 15px;
  transition: all 0.3s ease;
}
.btn-pejuang .icon div {
  position: relative;
  width: 18px;
  box-shadow: -2px 2px 5px var(--brand-500);
  transform: scale(0.9);
  background: linear-gradient(to bottom, var(--white), var(--brand-100));
  animation: swingArrow 1s ease-in-out infinite;
  animation-play-state: paused;
}
.btn-pejuang .icon div::before {
  transform: rotate(44deg);
  top: 1px;
  box-shadow: 1px -2px 3px -1px var(--brand-500);
  animation: rotateArrowLine 1s linear infinite;
  animation-play-state: paused;
}
.btn-pejuang .icon div::after {
  bottom: 1px;
  transform: rotate(316deg);
  box-shadow: -2px 2px 3px 0 var(--brand-500);
  background: linear-gradient(200deg, var(--white), var(--brand-100));
  animation: rotateArrowLine2 1s linear infinite;
  animation-play-state: paused;
}

.btn-pejuang .path {
  position: absolute;
  z-index: 12;
  bottom: 0;
  left: 0;
  right: 0;
  stroke-dasharray: 150 480;
  stroke-dashoffset: 150;
  pointer-events: none;
  width: 100%;
}

.btn-pejuang .splash {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  stroke-dasharray: 60 60;
  stroke-dashoffset: 60;
  transform: translate(-17%, -31%);
  stroke: var(--brand-300);
  width: 120%;
}

/** STATES */

.btn-pejuang:hover .words {
  opacity: 1;
}
.btn-pejuang:hover .words span {
  animation-play-state: running;
}

.btn-pejuang:hover .char.state-1 span::before {
  animation: charAppear 0.7s ease calc(var(--i) * 0.1s);
}

.btn-pejuang:hover .char.state-1 span::after {
  opacity: 1;
  animation: charDisappear 0.7s ease calc(var(--i) * 0.1s);
}

.btn-pejuang:hover .wrap {
  transform: translate(6px, -6px);
}

.btn-pejuang:hover .outline {
  opacity: 1;
}

.btn-pejuang:hover .outline::before,
.btn-pejuang:hover .icon div::before,
.btn-pejuang:hover .icon div::after,
.btn-pejuang:hover .icon div {
  animation-play-state: running;
}

.btn-pejuang:active .bg::before {
  filter: blur(5px);
  opacity: 0.7;
  box-shadow:
    -7px 6px 0 0 rgb(234 88 12 / 40%),
    -14px 12px 0 0 rgb(234 88 12 / 25%);
}
.btn-pejuang:active .content {
  box-shadow:
    inset -1px 12px 8px -5px rgba(154, 52, 18, 0.4),
    inset 0px -3px 8px 0px var(--brand-400);
}

.btn-pejuang:active .words,
.btn-pejuang:active .outline {
  opacity: 0;
}

.btn-pejuang:active .wrap {
  transform: translate(2px, -2px);
}

.btn-pejuang:active .splash {
  animation: splash 0.8s cubic-bezier(0.3, 0, 0, 1) forwards 0.05s;
}

.btn-pejuang:focus .path {
  animation: path 1.6s ease forwards 0.2s;
}

.btn-pejuang:focus .icon {
  animation: arrow 1s cubic-bezier(0.7, -0.5, 0.3, 1.5) forwards;
}

.btn-pejuang .char.state-2 span::after,
.btn-pejuang:focus .char.state-1 span {
  animation: charDisappear 0.5s ease forwards calc(var(--i) * 0.1s);
}

.btn-pejuang:focus .char.state-2 span::after {
  animation: charAppear 1s ease backwards calc(var(--i) * 0.1s);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes charAppear {
  0% { transform: translateY(50%); opacity: 0; filter: blur(20px); }
  20% { transform: translateY(70%); opacity: 1; }
  50% { transform: translateY(-15%); opacity: 1; filter: blur(0); }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes charDisappear {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-70%); opacity: 0; filter: blur(3px); }
}

@keyframes arrow {
  0% { opacity: 1; }
  50% { transform: translateX(60px); opacity: 0; }
  51% { transform: translateX(-200px); opacity: 0; }
  100% { transform: translateX(-128px); opacity: 1; }
}

@keyframes swingArrow {
  50% { transform: translateX(5px) scale(0.9); }
}

@keyframes rotateArrowLine {
  50% { transform: rotate(30deg); }
  80% { transform: rotate(55deg); }
}

@keyframes rotateArrowLine2 {
  50% { transform: rotate(330deg); }
  80% { transform: rotate(300deg); }
}

@keyframes resetArrow {
  0% { transform: translateX(-128px); }
  100% { transform: translateX(0); }
}

@keyframes path {
  from { stroke: white; }
  to { stroke-dashoffset: -480; stroke: #fde68a; }
}

@keyframes splash {
  to { stroke-dasharray: 2 60; stroke-dashoffset: -60; }
}

.card-pejuang {
  --brand-100: #fef3c7;
  --brand-200: #fde68a;
  --brand-300: #fbbf24;
  --brand-400: #f59e0b;
  --brand-500: #ea580c;
  
  background: linear-gradient(135deg, var(--brand-400) 0%, var(--brand-500) 100%);
  border-radius: 24px;
  box-shadow:
    -4px 4px 0 0 rgb(234 88 12 / 60%),
    -8px 8px 0 0 rgb(234 88 12 / 40%),
    -12px 12px 4px 0 rgb(234 88 12 / 25%),
    -16px 16px 8px 0 rgb(234 88 12 / 15%);
  border: 1px solid var(--brand-200);
  color: #fff;
  position: relative;
  margin-left: 16px;
  margin-top: 16px;
  transform: translate(0, 0);
  transition: all 0.3s ease;
}
.card-pejuang::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: inherit;
  box-shadow: inset -2px 12px 11px -5px rgba(255, 255, 255, 0.3), inset 1px -3px 11px 0px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.card-pejuang-transparent {
  --brand-100: #fef3c7;
  --brand-200: #fde68a;
  --brand-300: #fbbf24;
  --brand-400: #f59e0b;
  --brand-500: #ea580c;
  
  background: transparent;
  border-radius: 24px;
  border: 2px solid var(--brand-500);
  box-shadow:
    -4px 4px 0 0 rgb(234 88 12 / 60%),
    -8px 8px 0 0 rgb(234 88 12 / 40%),
    -12px 12px 0 0 rgb(234 88 12 / 20%);
  transform: rotate(358deg) skewX(2deg);
  transition: all 0.3s ease;
}
.card-pejuang-transparent:hover {
  transform: rotate(358deg) skewX(2deg) translate(4px, -4px);
  box-shadow:
    -6px 6px 0 0 rgb(234 88 12 / 60%),
    -12px 12px 0 0 rgb(234 88 12 / 40%),
    -18px 18px 0 0 rgb(234 88 12 / 20%);
}
.text-3d-effect {
  text-shadow: 
    1px 1px 0px #fbbf24,
    2px 2px 0px #f59e0b,
    3px 3px 0px #ea580c,
    4px 4px 0px #c2410c,
    5px 5px 2px rgba(0,0,0,0.3);
}

.btn-pejuang.secondary {
    --brand-100: #f1f5f9;
    --brand-200: #e2e8f0;
    --brand-300: #cbd5e1;
    --brand-400: #94a3b8;
    --brand-500: #475569;
}
.btn-pejuang.secondary .bg::before {
    box-shadow:
      -7px 6px 0 0 rgb(71 85 105 / 40%),
      -14px 12px 0 0 rgb(71 85 105 / 30%),
      -21px 18px 4px 0 rgb(71 85 105 / 25%),
      -28px 24px 8px 0 rgb(71 85 105 / 15%),
      -35px 30px 12px 0 rgb(71 85 105 / 12%);
}
.btn-pejuang.secondary:active .bg::before {
    box-shadow:
      -7px 6px 0 0 rgb(71 85 105 / 40%),
      -14px 12px 0 0 rgb(71 85 105 / 25%);
}
.btn-pejuang.secondary:active .content {
    box-shadow:
      inset -1px 12px 8px -5px rgba(30, 41, 59, 0.4),
      inset 0px -3px 8px 0px var(--brand-400);
}
.btn-pejuang .icon-down {
    transform: rotate(90deg);
}

/* Responsive adjustments for tables, MathJax, and text wrapping */
#text-question-text table, 
#text-options-container table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

#text-question-text th, 
#text-question-text td,
#text-options-container th,
#text-options-container td {
    padding: 0.4rem;
    border: 1px solid #cbd5e1;
    font-size: 11.5px;
}
@media (min-width: 768px) {
    #text-question-text th, 
    #text-question-text td,
    #text-options-container th,
    #text-options-container td {
        padding: 0.5rem;
        font-size: 15px;
    }
}

.mjx-chtml, .MathJax_SVG, .MathJax {
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

#text-options-container span, #text-question-text span {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Custom Mobile-Specific Enhancements */
@media (max-width: 639px) {
    /* Question navigation grid buttons layout adjustments */
    .question-btn {
        height: 2.125rem !important; /* h-8.5 */
        font-size: 10.5px !important;
        border-radius: 6px !important;
    }
    
    /* Make option container grid gap tighter */
    #text-options-container {
        gap: 0.5rem !important;
    }
    
    /* Option Badge active highlight size and padding fixes */
    .option-card span:first-child.bg-blue-500 {
        border-color: #3b82f6 !important;
        background-color: #3b82f6 !important;
        color: #ffffff !important;
    }
    
    /* Avoid scroll/layout overflow issues in modals */
    #alert-modal > div, #finishConfirmModal > div {
        max-width: 320px !important;
        padding: 1.25rem !important;
    }
}

