/* ==========================================
   Calq (캘큐) - Premium Glassmorphism Design System
   ========================================== */

/* Font Import */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700;900&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* CSS Variables */
:root {
  --bg-color: #0b0c10;
  --bg-gradient: radial-gradient(circle at 50% 0%, #1a1c29 0%, #0b0c10 70%);
  --panel-bg: rgba(26, 29, 41, 0.45);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-highlight: rgba(255, 255, 255, 0.12);
  
  --primary-color: #7b2cbf;
  --primary-glow: rgba(123, 44, 191, 0.4);
  --secondary-color: #00f2fe;
  --secondary-glow: rgba(0, 242, 254, 0.4);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-highlight: #ffffff;
  
  --accent-green: #00e676;
  --accent-red: #ff3860;
  --accent-orange: #ff9f43;

  --font-sans: 'Noto Sans KR', sans-serif;
  --font-num: 'Outfit', sans-serif;
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 16px;
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 60px;
  line-height: 1.6;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Typography Helpers */
.font-num {
  font-family: var(--font-num);
}

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header Section */
header {
  padding: 40px 0 20px;
  text-align: center;
  position: relative;
}

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 8px 24px var(--primary-glow);
}

h1.logo-text {
  font-family: var(--font-num);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #9ca3af);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

header p {
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 400;
}

/* Search and Filters */
.search-filter-section {
  margin: 30px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 600px;
}

.search-input {
  width: 100%;
  padding: 16px 20px 16px 52px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 30px;
  color: var(--text-main);
  font-size: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition-normal);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.search-input:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 15px var(--secondary-glow);
}

.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
}

.category-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.category-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  padding: 8px 18px;
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.category-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.category-btn.active {
  background: linear-gradient(135deg, var(--primary-color), rgba(123, 44, 191, 0.6));
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-highlight);
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* Calculator Grid */
.calculator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 20px;
}

.calc-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.calc-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  opacity: 0;
  transition: var(--transition-fast);
}

.calc-card:hover {
  transform: translateY(-5px);
  border-color: var(--panel-highlight);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 2px rgba(255,255,255,0.1) inset;
}

.calc-card:hover::before {
  opacity: 1;
}

.calc-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
  color: var(--secondary-color);
  transition: var(--transition-fast);
}

.calc-card:hover .calc-card-icon {
  background: linear-gradient(135deg, rgba(123, 44, 191, 0.2), rgba(0, 242, 254, 0.2));
  color: var(--text-highlight);
}

.calc-card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-highlight);
}

.calc-card-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  flex-grow: 1;
  height: 44px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.calc-card-btn {
  font-size: 14px;
  font-weight: 600;
  color: var(--secondary-color);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
}

.calc-card-btn i {
  transition: var(--transition-fast);
}

.calc-card:hover .calc-card-btn i {
  transform: translateX(4px);
}

/* Ad Slot Placeholder */
.ad-slot-card {
  grid-column: span 1;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  min-height: 200px;
  position: relative;
}

.ad-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1px 4px;
  border-radius: 4px;
}

.ad-slot-content {
  color: rgba(255, 255, 255, 0.25);
  font-size: 14px;
  text-align: center;
  font-weight: 500;
}

/* Modal Layout (Calculator Interface) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 11, 15, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: rgba(21, 24, 38, 0.95);
  border: 1px solid var(--panel-highlight);
  border-radius: 20px;
  width: 90%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  transform: scale(0.95);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .modal-container {
  transform: scale(1);
}

.modal-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: rgba(21, 24, 38, 0.98);
  z-index: 10;
}

.modal-title-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon {
  font-size: 20px;
  color: var(--secondary-color);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-highlight);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  transition: var(--transition-fast);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-highlight);
}

.modal-body {
  padding: 28px;
  overflow-y: auto;
}

/* Forms & UI Elements inside Calculators */
.form-group {
  margin-bottom: 20px;
}

.form-group-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 15px;
  transition: var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 8px rgba(0, 242, 254, 0.2);
}

/* Input suffix unit (e.g. 원, 평, %) */
.input-unit {
  position: absolute;
  right: 16px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
}

.form-control.has-unit {
  padding-right: 48px;
  text-align: right;
  font-family: var(--font-num);
  font-weight: 500;
}

.select-control {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px;
}

/* Buttons */
.btn-calc {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--primary-color), #5e17eb);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  margin-top: 10px;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-calc:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

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

/* Results Display Card */
.results-panel {
  margin-top: 28px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 24px;
  display: none; /* JS will toggle show */
}

.results-panel.active {
  display: block;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.results-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--secondary-color);
  margin-bottom: 16px;
  border-left: 3px solid var(--secondary-color);
  padding-left: 8px;
}

.results-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 16px;
}

.results-summary-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}

.results-summary-val {
  font-family: var(--font-num);
  font-size: 24px;
  font-weight: 800;
  color: var(--accent-green);
}

.results-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 12px;
}

.results-detail-row:last-child {
  margin-bottom: 0;
}

.results-detail-label {
  color: var(--text-muted);
}

.results-detail-val {
  font-family: var(--font-num);
  font-weight: 600;
  color: var(--text-main);
}

/* Sub-items in results for breaks */
.results-detail-subrow {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 8px;
  padding-left: 12px;
  opacity: 0.8;
}

/* Segmented Control / Tab inside Modals */
.segmented-control {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  margin-bottom: 20px;
}

.segmented-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.segmented-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-highlight);
}

/* Army-specific: Progress bar styles */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  width: 0%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* Footer Section */
footer {
  margin-top: 60px;
  border-top: 1px solid var(--panel-border);
  padding-top: 30px;
  text-align: center;
  color: var(--text-muted);
}

footer .footer-text {
  font-size: 13px;
  margin-bottom: 8px;
}

footer .footer-disclaimer {
  font-size: 11px;
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.2);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Custom info alerts */
.info-alert {
  background: rgba(0, 242, 254, 0.04);
  border: 1px solid rgba(0, 242, 254, 0.15);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.info-alert i {
  color: var(--secondary-color);
  margin-top: 2px;
}
