/* notes.css — notes grid + cards + revision */
.notes-grid{display:flex;flex-direction:column;gap:10px}
.note-card{
  background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:14px;
  display:flex;flex-direction:column;gap:8px;cursor:pointer;position:relative;
  transition:transform .15s,box-shadow .15s;width:100%;box-sizing:border-box;
}
.note-card:hover{transform:translateY(-2px);box-shadow:var(--shadow)}
.note-card.revision-due{border-color:var(--warn);box-shadow:0 0 0 2px rgba(217,119,6,.15)}
.note-card.revised-card{opacity:.75}
.note-card.favorited{border-color:#eab308;box-shadow:0 0 0 2px rgba(234,179,8,.15)}
.note-card.archived{opacity:.6;border-style:dashed}
.revision-indicator{position:absolute;top:8px;right:8px;width:8px;height:8px;border-radius:50%;background:var(--warn);box-shadow:0 0 0 3px rgba(217,119,6,.25)}
.note-card-top{display:flex;justify-content:space-between;align-items:flex-start;gap:8px}
.note-title{font-weight:700;font-size:.95rem;color:var(--text);line-height:1.3;flex:1;min-width:0;word-break:break-word;white-space:normal}
.note-actions{display:flex;gap:4px;flex-shrink:0}
.note-fav-btn{font-size:1rem;color:var(--text3);transition:color .15s}
.note-fav-btn.active,.note-fav-btn:hover{color:#eab308}
.note-content{font-size:.82rem;color:var(--text2);line-height:1.5;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.note-footer{display:flex;align-items:center;justify-content:space-between;font-size:.7rem;color:var(--text3);margin-top:auto}

/* Note detail modal extras */
.note-detail-subject{margin-bottom:0}
.note-detail-content{
  background:var(--surface);
  border:1px solid var(--accent);border-left:4px solid var(--accent);
  border-radius:12px;
  padding:16px 18px;font-size:.92rem;line-height:1.75;color:var(--text);white-space:pre-wrap;
  max-height:50vh;overflow-y:auto;
  box-shadow:0 2px 10px rgba(26,29,41,.08);
}
.note-detail-meta{display:flex;flex-wrap:wrap;gap:8px;font-size:.74rem;color:var(--text3);margin-top:10px}
.ai-thinking{display:inline-flex;align-items:center;gap:6px;font-size:.85rem;color:var(--accent2);padding:6px 10px;background:var(--surface2);border-radius:10px;margin-top:10px}
.thinking-dots{display:inline-flex;gap:3px}
.thinking-dots span{width:5px;height:5px;border-radius:50%;background:currentColor;animation:dot 1s ease-in-out infinite}
.thinking-dots span:nth-child(2){animation-delay:.15s}.thinking-dots span:nth-child(3){animation-delay:.3s}
@keyframes dot{0%,80%,100%{opacity:.2;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}
.ai-response{
  background:linear-gradient(135deg,rgba(0,105,107,.08),rgba(0,89,186,.06));
  border:1px solid var(--accent2);border-left:4px solid var(--accent2);
  border-radius:12px;padding:12px;
  font-size:.88rem;line-height:1.6;color:var(--text);white-space:pre-wrap;margin-top:10px;
}

/* === Detail modal redesign === */
.detail-modal{max-height:85vh;display:flex;flex-direction:column}
.detail-header{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:14px 18px;border-bottom:2px solid var(--accent);
  background:linear-gradient(135deg,rgba(44,114,217,.12),var(--surface2) 55%,var(--surface));
}
.detail-header-left{display:flex;align-items:center;gap:10px;min-width:0;flex:1}
.detail-header-left .note-detail-subject{margin:0}
.detail-title{font-size:1.05rem;font-weight:800;color:var(--accent);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.detail-body{padding:16px 18px;overflow-y:auto;flex:1}
.detail-footer{
  display:flex;align-items:center;justify-content:flex-end;gap:8px;
  padding:12px 18px;border-top:2px solid var(--accent);
  background:linear-gradient(135deg,var(--surface2),var(--surface));flex-wrap:wrap;
}

/* Action buttons grid */
.detail-actions-grid{
  display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:8px;margin:14px 0 0;
}
.detail-action-btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  padding:10px 12px;border-radius:10px;font-size:.82rem;font-weight:700;
  background:var(--surface);color:var(--text);border:1px solid var(--border);
  cursor:pointer;transition:all .15s ease;
}
.detail-action-btn:hover{background:var(--surface2);border-color:var(--accent);color:var(--accent);transform:translateY(-1px)}
.detail-action-btn .ico{width:16px;height:16px;flex-shrink:0}
.detail-action-ai{
  background:linear-gradient(135deg,#0e7490,#1d4ed8);
  color:#fff;border-color:transparent;box-shadow:0 2px 8px rgba(13,116,144,.3);
}
.detail-action-ai:hover{
  background:linear-gradient(135deg,#0f839f,#2563eb);
  color:#fff;border-color:transparent;box-shadow:0 4px 14px rgba(13,116,144,.38);
}
.detail-action-tts{
  background:linear-gradient(135deg,#9333ea,#a855f7);
  color:#fff;border-color:transparent;box-shadow:0 2px 8px rgba(147,51,234,.32);
}
.detail-action-tts:hover{
  background:linear-gradient(135deg,#a13cf0,#bd6bff);
  color:#fff;border-color:transparent;box-shadow:0 4px 14px rgba(147,51,234,.4);
}
.detail-action-tts.btn-loading{
  animation:pulse 1.5s ease-in-out infinite;
  color:#fff;background:linear-gradient(135deg,#ef4444,#dc2626);border-color:transparent;
}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.6}}

/* Visual & Image AI buttons */
#detail-visual-btn{
  background:linear-gradient(135deg,#f59e0b,#f97316);
  color:#fff;border-color:transparent;box-shadow:0 2px 8px rgba(245,158,11,.3);
}
#detail-visual-btn:hover{
  background:linear-gradient(135deg,#fbbf24,#fb923c);
  color:#fff;border-color:transparent;box-shadow:0 4px 14px rgba(245,158,11,.4);
}
#detail-image-btn{
  background:linear-gradient(135deg,#10b981,#059669);
  color:#fff;border-color:transparent;box-shadow:0 2px 8px rgba(16,185,129,.3);
}
#detail-image-btn:hover{
  background:linear-gradient(135deg,#34d399,#10b981);
  color:#fff;border-color:transparent;box-shadow:0 4px 14px rgba(16,185,129,.4);
}

/* TTS speed control */
.detail-action-tts-group{display:flex;flex-direction:column;gap:4px}
.tts-speed-control{
  display:flex;align-items:center;gap:6px;padding:5px 10px;
  background:linear-gradient(135deg,rgba(147,51,234,.12),var(--surface2));
  border:1px solid rgba(147,51,234,.4);border-radius:8px;
  font-size:.72rem;color:var(--text2);font-weight:600;
}
.tts-speed-control .ico{width:14px;height:14px;color:#8b5cf6;flex-shrink:0}
.tts-speed-slider{
  flex:1;height:4px;-webkit-appearance:none;appearance:none;
  background:linear-gradient(90deg,rgba(147,51,234,.4),rgba(168,85,247,.85));
  border-radius:2px;outline:none;cursor:pointer;
}
.tts-speed-slider::-webkit-slider-thumb{
  -webkit-appearance:none;width:16px;height:16px;border-radius:50%;
  background:#fff;cursor:pointer;border:2px solid #9333ea;
  box-shadow:0 1px 5px rgba(147,51,234,.4);
}
.tts-speed-slider::-moz-range-thumb{
  width:16px;height:16px;border-radius:50%;
  background:#fff;cursor:pointer;border:2px solid #9333ea;
}
.tts-speed-val{min-width:32px;text-align:right;font-weight:700;color:#8b5cf6;font-variant-numeric:tabular-nums}

/* Subject badge inline */
.subject-badge{
  display:inline-flex;align-items:center;gap:5px;padding:3px 10px;border-radius:99px;
  font-size:.72rem;font-weight:700;letter-spacing:.02em;white-space:nowrap;
}
.subject-badge .dot{width:6px;height:6px;border-radius:50%;background:currentColor}

/* Note quiz (generated from note via AI) */
.note-quiz-q{margin-bottom:14px}
.note-quiz-title{font-weight:700;color:var(--text);margin-bottom:6px}
.note-quiz-opts{display:flex;flex-direction:column;gap:6px}
.note-quiz-opt{
  display:flex;align-items:center;gap:8px;padding:8px 12px;border-radius:10px;
  border:1px solid var(--border);background:var(--surface);cursor:pointer;
  transition:background .15s,border-color .15s;font-size:.88rem;color:var(--text);
}
.note-quiz-opt:hover{background:var(--surface2);border-color:var(--accent)}
.note-quiz-feedback{font-size:.82rem;font-weight:700;margin-top:4px}
.note-quiz-explain{font-size:.82rem;color:var(--text2);margin-top:4px}

/* Revision panel */
.revision-panel{background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:14px;display:none}
.revision-header{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-bottom:8px}
.revision-title{font-weight:700;font-size:.92rem;color:var(--warn);min-width:0}
.revision-header .badge{margin-left:auto}
.revision-header .btn{flex-shrink:0}
@media(max-width:480px){
  .revision-header{gap:6px}
  .revision-title{font-size:.85rem}
  .revision-header .badge{margin-left:0;width:100%;text-align:right}
}
@media(max-width:600px){
  .revision-header{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    align-items:center;
  }
  .revision-header .btn{
    font-size:.7rem;
    padding:4px 8px;
    flex-shrink:0;
  }
  .revision-item{
    padding:8px 10px;
    gap:6px;
  }
  .revision-note-title{font-size:.82rem}
  .revision-note-subject{font-size:.66rem}
  .revision-due-text{font-size:.68rem}
}
.revision-list{display:flex;flex-direction:column;gap:8px}
.revision-item{display:flex;justify-content:space-between;align-items:center;background:var(--surface2);border-radius:10px;padding:10px 12px;gap:8px}
.revision-info{flex:1;min-width:0}
.revision-note-title{font-weight:700;color:var(--text);font-size:.88rem}
.revision-note-subject{font-size:.7rem;color:var(--text2)}
.revision-due-text{font-size:.72rem;color:var(--warn);margin-top:2px}

/* Subject tags */
.subject-tags{display:flex;flex-direction:column;gap:4px}
.subject-tag{display:flex;align-items:center;gap:6px;padding:7px 10px;border-radius:10px;font-size:.8rem;color:var(--text2);cursor:pointer;font-weight:600;transition:background .15s,color .15s}
.subject-tag:hover{background:var(--surface2)}
.subject-tag.active{background:var(--surface2);color:var(--text)}
.subject-tag .tag-dot{width:8px;height:8px;border-radius:50%}
.tag-count{margin-left:auto;font-size:.66rem;color:var(--text3);background:var(--surface);padding:1px 6px;border-radius:10px;font-weight:700}

/* ===== Note Form — Beautiful Input Design ===== */
.note-form-card{border:1px solid var(--border);border-radius:16px;padding:20px}
.note-input-wrap{position:relative;display:flex;align-items:center}
.note-input{
  width:100%;padding:10px 14px;border:1.5px solid var(--border);border-radius:10px;
  background:var(--surface);color:var(--text);font-size:.9rem;
  transition:border-color .2s,box-shadow .2s;outline:none;
}
.note-input:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(0,89,186,.12)}
.note-input::placeholder{color:var(--text3)}
textarea.note-input{min-height:100px;resize:vertical;line-height:1.5}
.note-textarea-wrap{flex-direction:column;align-items:stretch}
.note-input-actions{display:flex;gap:4px;padding:4px 8px;justify-content:flex-end}
.note-input-icon{
  display:grid;place-items:center;width:32px;height:32px;border-radius:8px;
  border:none;background:transparent;color:var(--text3);cursor:pointer;
  transition:background .15s,color .15s;
}
.note-input-icon:hover{background:var(--surface2);color:var(--accent)}
.note-input-icon .ico{width:16px;height:16px}

/* Upload area */
.note-upload-area{
  display:flex;align-items:center;justify-content:center;
  border:2px dashed var(--border);border-radius:12px;padding:16px;
  cursor:pointer;transition:border-color .2s,background .2s;min-height:60px;
}
.note-upload-area:hover{border-color:var(--accent);background:rgba(0,89,186,.03)}
.note-upload-content{display:flex;flex-direction:column;align-items:center;gap:4px;color:var(--text3);font-size:.82rem}

/* Circle progress animation */
.upload-circle{width:36px;height:36px;transform:rotate(-90deg)}
.upload-circle-bg{fill:none;stroke:var(--border);stroke-width:2.5}
.upload-circle-fill{
  fill:none;stroke:var(--accent);stroke-width:2.5;
  stroke-dasharray:100;stroke-dashoffset:100;
  stroke-linecap:round;transition:stroke-dashoffset .3s;
}

/* Subject manager panel (onboarding / settings) */
.subject-manager{display:flex;flex-direction:column;gap:12px}
.subject-manager-list{display:flex;flex-wrap:wrap;gap:6px}
.subject-chip{
  display:inline-flex;align-items:center;gap:6px;padding:5px 10px;
  border-radius:999px;background:var(--surface);border:1px solid var(--border);
  font-size:.82rem;font-weight:600;color:var(--text);
}
.subject-chip-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0}
.subject-chip-name{max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.subject-chip-del{
  border:none;background:transparent;color:var(--text3);cursor:pointer;
  font-size:1rem;line-height:1;padding:0 2px;
}
.subject-chip-del:hover{color:var(--danger)}
.subject-color-pick{width:24px;height:24px;border:none;border-radius:6px;cursor:pointer;padding:0;background:transparent}
.subject-add-row{display:flex;gap:6px;align-items:center}
.subject-add-input{flex:1;padding:6px 10px;border:1px solid var(--border);border-radius:8px;font-size:.85rem}

/* Note AI buttons on cards */
.note-chat-btn,.note-visual-btn,.note-image-btn{opacity:0;transition:opacity .15s}
.note-card:hover .note-chat-btn,.note-card:hover .note-visual-btn,.note-card:hover .note-image-btn{opacity:1}
/* Touch phones have no hover, so hover-only buttons were invisible and
 * unreachable there — always show them on coarse pointers / small screens. */
@media (hover:none),(max-width:640px){
  .note-chat-btn,.note-visual-btn,.note-image-btn{opacity:1}
}

/* AI area for visual/image results */
#ai-area{margin-top:12px}
