/* Naver-Style Stock Market Widget
   ------------------------------------------------------------------ */
.nsw-card{
  --nsw-up: #eb5757;          /* Korean convention: red = up */
  --nsw-up-bg: #fdecec;
  --nsw-down: #3182f6;        /* blue = down */
  --nsw-down-bg: #eaf2fe;
  --nsw-green: #03c75a;       /* Naver brand green, used for the add-stock accent */
  --nsw-text: #1f1f1f;
  --nsw-muted: #8b8b8b;
  --nsw-border: #ececec;

  box-sizing: border-box;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--nsw-border);
  border-radius: 14px;
  padding: 18px 20px 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", Roboto, sans-serif;
  color: var(--nsw-text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.nsw-card *{ box-sizing: border-box; }

.nsw-card__head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--nsw-border);
}
.nsw-card__title{
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nsw-info{
  color: #c2c2c2;
  display: inline-flex;
  cursor: default;
}
.nsw-card__meta{
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--nsw-muted);
  font-size: 12.5px;
}
.nsw-refresh{
  background: none;
  border: 0;
  color: var(--nsw-muted);
  cursor: pointer;
  display: inline-flex;
  padding: 2px;
  border-radius: 50%;
  transition: transform .3s ease, color .15s ease;
}
.nsw-refresh:hover{ color: var(--nsw-text); }
.nsw-refresh.is-spinning{ animation: nsw-spin .6s linear; }
@keyframes nsw-spin{ to{ transform: rotate(360deg); } }

.nsw-card__body{
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

/* -- Index block ---------------------------------------------------- */
.nsw-index{ flex: 1 1 55%; min-width: 0; }
.nsw-index__label{
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--nsw-muted);
}
.nsw-index__value{
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.nsw-index__change{
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
}
.nsw-index__change .nsw-percent{ font-weight: 600; }
.nsw-index__change.nsw-is-up{ color: var(--nsw-up); }
.nsw-index__change.nsw-is-down{ color: var(--nsw-down); }
.nsw-index__change.nsw-is-flat{ color: var(--nsw-muted); }

.nsw-arrow{ width: 0; height: 0; display: inline-block; }
.nsw-is-up .nsw-arrow{
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 6px solid var(--nsw-up);
}
.nsw-is-down .nsw-arrow{
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid var(--nsw-down);
}
.nsw-is-flat .nsw-arrow{
  width: 8px; height: 2px;
  background: var(--nsw-muted);
}

.nsw-chart{ width: 100%; height: 52px; }
.nsw-chart svg{ display: block; width: 100%; height: 100%; overflow: visible; }

/* -- Watchlist block -------------------------------------------------- */
.nsw-watchlist{
  flex: 1 1 45%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  padding-top: 6px;
}
.nsw-watchlist__empty p{
  margin: 0 0 2px;
  font-size: 12.5px;
  color: var(--nsw-muted);
  line-height: 1.5;
}
.nsw-watchlist__list{
  width: 100%;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  text-align: left;
}
.nsw-watchlist__item{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--nsw-border);
  font-size: 12.5px;
}
.nsw-watchlist__item:last-child{ border-bottom: 0; }
.nsw-item-name{ font-weight: 600; }
.nsw-item-price{ color: var(--nsw-muted); }
.nsw-item-change.nsw-is-up{ color: var(--nsw-up); }
.nsw-item-change.nsw-is-down{ color: var(--nsw-down); }
.nsw-item-remove{
  background: none;
  border: 0;
  color: #c2c2c2;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
}
.nsw-item-remove:hover{ color: var(--nsw-up); }

.nsw-add-btn{
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--nsw-green);
  background: #fff;
  color: var(--nsw-green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: 8px;
  transition: background .15s ease, color .15s ease;
}
.nsw-add-btn:hover{ background: var(--nsw-green); color: #fff; }

.nsw-add-form{
  width: 100%;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nsw-symbol-input{
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--nsw-border);
  border-radius: 8px;
  font-size: 13px;
}
.nsw-symbol-input:focus{
  outline: none;
  border-color: var(--nsw-green);
}
.nsw-add-form__actions{ display: flex; gap: 8px; }
.nsw-add-confirm, .nsw-add-cancel{
  flex: 1;
  padding: 7px 0;
  border-radius: 8px;
  border: 1px solid var(--nsw-border);
  background: #fff;
  font-size: 12.5px;
  cursor: pointer;
}
.nsw-add-confirm{
  background: var(--nsw-green);
  border-color: var(--nsw-green);
  color: #fff;
  font-weight: 600;
}
.nsw-add-confirm:hover{ opacity: .9; }
.nsw-add-cancel:hover{ background: #f7f7f7; }

@media (max-width: 380px){
  .nsw-card__body{ flex-direction: column; }
  .nsw-watchlist{ align-items: flex-start; text-align: left; padding-top: 12px; border-top: 1px solid var(--nsw-border); }
  .nsw-watchlist__empty{ text-align: left; }
}
