/* 
  ipss.css — One Dark Pro Theme for Calculators
  Unified with WordPress Child Theme
*/

@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap");

:root {
  /* One Dark Pro Color Palette */
  --bg: #282c34; /* Main Background */
  --surface: #21252b; /* Card Background */
  --text-main: #f3f4f6; /* Main Text (Bright) */
  --text-muted: #9ca3af; /* Muted Text */

  /* Primary Hue (One Dark Blue #61AFEF) approx 207, 82%, 66% */
  --primary-h: 207;
  --primary-s: 82%;
  --primary-l: 66%;
  --primary: #61afef;
  --primary-light: #2c313a; /* Slightly lighter bg for hover */
  --primary-dark: #3b82f6;

  /* Accent Hue (One Dark Purple #C678DD) approx 286, 60%, 67% */
  --accent-h: 286;
  --accent-s: 60%;
  --accent-l: 67%;
  --accent: #c678dd;

  --success: #98c379; /* One Dark Green */
  --warning: #e5c07b; /* One Dark Yellow */
  --danger: #e06c75; /* One Dark Red */

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.5);

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-color: #3e4451;
}

/* Base Styles */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg);
  color: var(--text-main);
  font-family: "Noto Sans KR", sans-serif;
  line-height: 1.5; /* Compact line height */
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  /* iframe 내에서 전체 폭 활용 */
  width: 100%;
  min-height: 100vh;
}

/* Calculator Container - COMPACT MODE */
.ipss-calculator {
  max-width: 960px; /* 680px → 960px로 확대하여 넓게 표시 */
  margin: 30px auto; /* Reduced from 40px */
  padding: 24px; /* Reduced from 40px */
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-premium);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.ipss-calculator::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

/* Header */
.ipss-title {
  font-family: "Noto Sans KR", sans-serif;
  text-align: center;
  font-size: 1.5rem; /* Slightly smaller title */
  font-weight: 800;
  margin: 0 0 6px;
  color: #ffffff;
  background: none;
  -webkit-text-fill-color: initial;
}

.ipss-subtitle {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 20px; /* Reduced from 32px */
}

.ipss-separator {
  height: 1px;
  border: none;
  background: radial-gradient(circle, var(--border-color) 0%, transparent 100%);
  margin: 16px 0; /* Reduced from 24px */
}

/* Progress Bar */
.progress-container {
  width: 100%;
  height: 6px;
  background: #2c313a;
  border-radius: var(--radius-full);
  margin-bottom: 24px; /* Reduced from 32px */
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.4s ease;
}

/* Question Styling - COMPACT MODE */
.adam-q,
.question-group,
.fsfi-section,
.cpsi-section {
  margin-bottom: 16px; /* Reduced from 24px */
  padding: 16px; /* Reduced from 24px */
  background: #2c313a;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: var(--transition);
}

.adam-q:hover,
.question-group:hover,
.fsfi-section:hover,
.cpsi-section:hover {
  background: #323842;
  border-color: var(--primary);
  transform: translateY(-1px);
}

.adam-q p,
.question-group p,
.fsfi-section h4,
.q-text {
  font-weight: 600;
  font-size: 1rem; /* Reduced from 1.05rem */
  margin-bottom: 12px; /* Reduced from 16px */
  color: var(--text-main);
}

.fsfi-section h4 {
  font-size: 1.1rem;
  color: var(--primary);
  margin-top: 0;
}

/* Custom Select Box */
.form-select {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 16px; /* Reduced padding */
  padding-right: 40px;
  font-size: 0.95rem; /* Slightly smaller text */
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}

.form-select:hover {
  border-color: var(--primary);
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(97, 175, 239, 0.2);
}

/* Options Interaction */
.adam-opts,
.options-row,
.options-column {
  display: flex;
  gap: 8px; /* Reduced from 12px */
  flex-wrap: wrap;
}

.options-column {
  flex-direction: column;
}

label {
  display: flex;
  align-items: center;
  gap: 8px; /* Reduced gap */
  padding: 10px 16px; /* Reduced padding */
  background: var(--bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 0.9rem; /* Reduced font size */
  font-weight: 500;
  transition: var(--transition);
  -webkit-user-select: none;
  user-select: none;
  color: var(--text-main);
}

label:hover {
  border-color: var(--primary);
  background: #323842;
}

input[type="radio"],
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  margin: 0;
}

label.selected,
label:has(input:checked) {
  background: var(--primary);
  color: #21252b;
  border-color: var(--primary);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(97, 175, 239, 0.4);
}

/* Buttons */
.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px; /* Reduced from 40px */
}

.calculate-btn {
  flex: 2;
  padding: 14px 20px; /* Reduced padding */
  background: var(--primary);
  color: #21252b;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.calculate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.calculate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #3e4451;
  color: #9ca3af;
}

.reset-btn {
  flex: 1;
  padding: 14px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.reset-btn:hover {
  background: #2c313a;
  color: #ffffff;
  border-color: #ffffff;
}

/* Result Area */
.result-area {
  margin-top: 24px;
  padding: 24px;
  border-radius: var(--radius-md);
  text-align: center;
  display: none;
  animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  background: #2c313a;
  border: 1px solid var(--border-color);
}

.result-area.show {
  display: block;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.result-badge {
  font-size: 2.5rem;
  line-height: 1;
}

.grade-display {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  color: #ffffff;
}

.score-display {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 8px 0;
}

.advice-display {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

/* Result Severity Colors */
.result-area.positive,
.result-area.severe {
  background: rgba(224, 108, 117, 0.1);
  border: 1px solid rgba(224, 108, 117, 0.3);
}
.result-area.positive .grade-display,
.result-area.severe .grade-display {
  color: var(--danger);
}

.result-area.negative,
.result-area.normal {
  background: rgba(152, 195, 121, 0.1);
  border: 1px solid rgba(152, 195, 121, 0.3);
}
.result-area.negative .grade-display,
.result-area.normal .grade-display {
  color: var(--success);
}

.result-area.moderate {
  background: rgba(229, 192, 123, 0.1);
  border: 1px solid rgba(229, 192, 123, 0.3);
}
.result-area.moderate .grade-display {
  color: var(--warning);
}

/* Theme Toggles (HIDDEN) */
.theme-toggle {
  display: none;
}

/* Actions */
.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.action-btn svg {
  width: 18px;
  height: 18px;
}

.action-btn:hover {
  background: #323842;
  border-color: var(--primary);
  color: #ffffff;
}

/* Responsive */
@media (max-width: 640px) {
  .ipss-calculator {
    margin: 8px 4px; /* 좌우 여백 최소화하여 넓게 */
    padding: 14px;
    border-radius: 8px;
  }

  .ipss-title {
    font-size: 1.3rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .calculate-btn,
  .reset-btn {
    width: 100%;
  }

  .adam-q,
  .question-group {
    padding: 12px;
  }

  .result-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .action-btn {
    justify-content: center;
  }
}

/* Header Actions Layout */
.calc-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.calc-header-actions .home-btn,
.calc-header-actions .theme-toggle {
  margin-bottom: 0; /* Override default margin */
}

/* Home Button */
.home-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin-bottom: 20px;
  background-color: rgba(255, 255, 255, 0.05); /* Subtle background */
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}

.home-btn:hover {
  background-color: var(--primary);
  color: #21252b; /* Dark text on bright button */
  border-color: var(--primary);
  transform: translateY(-2px);
}

.home-btn svg {
  width: 16px;
  height: 16px;
}

/* --- Inline Style Replacements --- */
/* Kakao share button */
.kakao-btn {
  background-color: #f7e600 !important;
  color: #3a1d1d !important;
}

/* Sub-section title in specific questionnaires */
.section-subtitle {
  font-size: 1rem !important;
  margin-top: 1.5rem !important;
}

/* Screening tool notes */
.screening-notice {
  font-size: 0.8rem !important;
  margin-top: 0.5rem !important;
  opacity: 0.7 !important;
}
