/* =====================================================
 * ブラウザメモ [多機能] - Browser Memo [Multi]
 * ===================================================== */

.browser-memo-app {
	max-width: 780px;
	margin: 0 auto;
}

.browser-memo-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	padding: 10px 0;
}

.browser-memo-header-right {
	display: flex;
	align-items: center;
	gap: 8px;
}

.browser-memo-search-button {
	border-radius: 50%;
	height: 40px;
	width: 40px;
	background-color: #898989 !important;
	color: #fff !important;
	border: none !important;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	flex-shrink: 0;
}

.browser-memo-search-button svg {
	pointer-events: none;
}

.browser-memo-search-container {
	width: 100%;
	max-width: 740px;
	display: none;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	background-color: #fff !important;
	border: 1px solid #e0e0e0 !important;
	border-radius: 24px !important;
	box-sizing: border-box;
	z-index: 10;
}

.browser-memo-search-container.fixed {
	position: fixed;
	top: var(--browser-memo-fixed-top, 8px);
	left: 50%;
	transform: translateX(-50%);
	width: calc(100% - 16px);
	max-width: 740px;
	z-index: 999;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.browser-memo-search-placeholder {
	display: none;
}

.browser-memo-search-input {
	flex: 1;
	min-width: 0;
	padding: 8px 4px;
	font-size: 14px;
	box-shadow: none !important;
	border: none !important;
	border-radius: 0 !important;
	background: transparent !important;
	outline: none;
}

.browser-memo-search-controls {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
}

.browser-memo-search-nav {
	width: 28px;
	height: 28px;
	border-radius: 50% !important;
	background: none !important;
	color: #999 !important;
	border: none !important;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background-color 0.2s, color 0.2s;
}

.browser-memo-search-nav:hover {
	background-color: #f0f0f0 !important;
	color: #333 !important;
}

.browser-memo-search-nav svg {
	pointer-events: none;
}

.browser-memo-search-result-info {
	font-size: 12px;
	color: #999;
	white-space: nowrap;
}

.browser-memo-main {
	max-width: 780px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
}

/* 目次 */
.browser-memo-toc-container {
	width: 100%;
	max-width: 740px;
	margin: 20px 0;
	padding: 14px 16px;
	background-color: #fff;
	border-radius: 8px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
	position: relative;
	box-sizing: border-box;
}

.browser-memo-toc-container .browser-memo-toc-title {
	margin: 0 0 10px 0;
	padding: 0;
	font-size: 16px;
	color: #333;
	text-align: left;
	display: inline-block;
	border: none;
	background: none;
	line-height: 1.4;
}

.browser-memo-toc-container .browser-memo-toc-title::before,
.browser-memo-toc-container .browser-memo-toc-title::after {
	content: none;
	display: none;
}

.browser-memo-note-count {
	position: absolute;
	top: 10px;
	right: 10px;
	background-color: #ccc;
	color: #fff;
	border-radius: 50%;
	padding: 5px 10px;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
}

.browser-memo-toc {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/* 目次タグ: ピル型デザイン */
.browser-memo-toc a {
	display: inline-block;
	padding: 4px 12px;
	border: 1px solid #ccc;
	color: #555;
	border-radius: 20px;
	text-decoration: none;
	font-size: 12px;
	text-align: center;
	transition: background-color 0.2s, color 0.2s, border-color 0.2s;
	cursor: move;
}

.browser-memo-toc a:hover {
	background-color: #3d3c35;
	color: white;
	border-color: #3d3c35;
}

/* 色ラベル付き目次タグ */
.browser-memo-toc a[data-color]::before {
	content: "";
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	margin-right: 6px;
	vertical-align: middle;
}

.browser-memo-toc a[data-color="gray"]::before { display: none; }
.browser-memo-toc a[data-color="red"]::before { background-color: #e57373; }
.browser-memo-toc a[data-color="blue"]::before { background-color: #64b5f6; }
.browser-memo-toc a[data-color="green"]::before { background-color: #81c784; }
.browser-memo-toc a[data-color="yellow"]::before { background-color: #ffd54f; }
.browser-memo-toc a[data-color="purple"]::before { background-color: #ba68c8; }

/* メモカード */
.browser-memo-notepad-container {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
	padding: 0;
	box-sizing: border-box;
}

.browser-memo-app .notepad {
	position: relative;
	width: 100%;
	max-width: 740px;
	margin: 8px 0;
	padding: 0;
	background-color: #fff;
	border-radius: 8px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 色ラベルの左ボーダー */
.browser-memo-app .notepad[data-color="red"] { border-left: 4px solid #e57373; }
.browser-memo-app .notepad[data-color="blue"] { border-left: 4px solid #64b5f6; }
.browser-memo-app .notepad[data-color="green"] { border-left: 4px solid #81c784; }
.browser-memo-app .notepad[data-color="yellow"] { border-left: 4px solid #ffd54f; }
.browser-memo-app .notepad[data-color="purple"] { border-left: 4px solid #ba68c8; }

/* textareaスタイル: フラットな線のみ */
.browser-memo-app .notepad textarea {
	width: 100%;
	min-height: 120px;
	margin: 0 !important;
	border: 1px solid #e0e0e0 !important;
	border-left: none !important;
	border-right: none !important;
	padding: 16px 20px !important;
	background-color: #fff !important;
	color: #333 !important;
	outline: none;
	resize: none !important;
	overflow: hidden !important;
	box-sizing: border-box;
	border-radius: 0 !important;
	box-shadow: none !important;
}

/* 折りたたみ時のtextarea非表示 */
.browser-memo-app .notepad.collapsed textarea {
	display: none;
}

.browser-memo-app .notepad.collapsed .browser-memo-notepad-footer {
	display: none;
}

/* タイトル行 */
.browser-memo-notepad-title-row {
	display: flex;
	align-items: center;
	padding: 14px 20px 8px;
	gap: 8px;
}

.browser-memo-app .notepad input[type="text"] {
	flex: 1;
	min-width: 0;
	border: none !important;
	padding: 0 !important;
	background-color: #fff !important;
	box-shadow: none !important;
	color: #333;
	outline: none;
	box-sizing: border-box;
	font-size: 18px;
}

.browser-memo-app .notepad input[type="text"]::placeholder {
	color: #ccc;
}

@media (max-width: 600px) {
	.browser-memo-app .notepad input[type="text"] {
		font-size: 14px;
	}
}

/* 折りたたみトグル */
.browser-memo-collapse-toggle {
	width: 24px;
	height: 24px;
	border: none !important;
	background: none !important;
	color: #bbb;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	flex-shrink: 0;
	padding: 0;
	transition: transform 0.2s, color 0.2s;
}

.browser-memo-collapse-toggle:hover {
	color: #666;
}

.browser-memo-app .notepad.collapsed .browser-memo-collapse-toggle {
	transform: rotate(-90deg);
}

/* フッター行: カラーセレクタ + 文字数カウント */
.browser-memo-notepad-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 20px 10px;
}

.browser-memo-color-selector {
	display: flex;
	gap: 8px;
	overflow: hidden;
	max-width: 16px;
	transition: max-width 0.3s ease;
}

.browser-memo-color-selector.open {
	max-width: 160px;
}

.browser-memo-color-dot {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	border: 1.5px solid transparent;
	cursor: pointer;
	padding: 0;
	flex-shrink: 0;
	transition: border-color 0.2s, transform 0.2s;
}

.browser-memo-color-selector.open .browser-memo-color-dot:not(.active):hover {
	transform: scale(1.2);
}

.browser-memo-color-dot[data-color="gray"] { background-color: #ccc; }
.browser-memo-color-dot[data-color="red"] { background-color: #e57373; }
.browser-memo-color-dot[data-color="blue"] { background-color: #64b5f6; }
.browser-memo-color-dot[data-color="green"] { background-color: #81c784; }
.browser-memo-color-dot[data-color="yellow"] { background-color: #ffd54f; }
.browser-memo-color-dot[data-color="purple"] { background-color: #ba68c8; }

/* 操作ボタン: ホバー/タップで表示 */
.browser-memo-notepad-actions {
	position: absolute;
	top: 10px;
	right: 10px;
	display: flex;
	gap: 4px;
	opacity: 0;
	transition: opacity 0.2s;
	pointer-events: none;
	z-index: 2;
}

.browser-memo-app .notepad:hover .browser-memo-notepad-actions,
.browser-memo-app .notepad:focus-within .browser-memo-notepad-actions {
	opacity: 1;
	pointer-events: auto;
}

/* モバイルではタッチ後に表示されるようにする */
@media (hover: none) {
	.browser-memo-notepad-actions {
		opacity: 1;
		pointer-events: auto;
	}
}

.browser-memo-notepad-actions button {
	width: 32px;
	height: 32px;
	border-radius: 50% !important;
	background-color: rgba(255, 255, 255, 0.9) !important;
	color: #999 !important;
	border: 1px solid #e0e0e0 !important;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.browser-memo-notepad-actions button:hover {
	background-color: #f5f5f5 !important;
	color: #333 !important;
	border-color: #ccc !important;
}

/* フッター右側（更新日時 + 文字数） */
.browser-memo-footer-right {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-left: auto;
}

.browser-memo-updated-at {
	font-size: 11px;
	color: #bbb;
}

.browser-memo-char-count {
	font-size: 11px;
	color: #bbb;
}

.browser-memo-button-box {
	display: flex;
	justify-content: flex-end;
	width: 100%;
	margin: 20px 0;
}

.browser-memo-add-button-container {
	display: flex;
	justify-content: flex-end;
	width: 100%;
	margin-bottom: 20px;
}

.browser-memo-add-button {
	margin: 0 20px;
	width: 50px;
	height: 50px;
	border-radius: 50% !important;
	background-color: #3d3c35 !important;
	color: white !important;
	border: none !important;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
}

.browser-memo-add-button:hover {
	opacity: 0.8;
}

/* 保存トグル: SWELLのcheckbox競合をリセット */
.browser-memo-toggle-switch {
	position: relative;
	display: inline-block;
	width: 50px;
	height: 26px;
}

.browser-memo-toggle-switch input {
	opacity: 0;
	width: 0;
	height: 0;
	position: absolute;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	margin: 0;
	padding: 0;
}

.browser-memo-slider {
	position: absolute;
	cursor: pointer;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: #ccc !important;
	transition: .4s;
	border-radius: 34px;
}

.browser-memo-slider:before {
	position: absolute;
	content: "" !important;
	height: 18px;
	width: 18px;
	left: 2px;
	bottom: 4px;
	background-color: white !important;
	transition: .4s;
	border-radius: 50% !important;
	transform: none;
}

.browser-memo-toggle-switch input:checked + .browser-memo-slider {
	background-color: #85b1d5 !important;
}

.browser-memo-toggle-switch input:focus + .browser-memo-slider {
	box-shadow: 0 0 1px #85b1d5;
}

.browser-memo-toggle-switch input:checked + .browser-memo-slider:before {
	transform: translateX(26px) !important;
}

.browser-memo-app .anchor-offset {
	position: relative;
	top: -40px;
	visibility: hidden;
}

.browser-memo-app .notepad.browser-memo-search-active {
	box-shadow: 0 0 0 2px #64b5f6 !important;
}

.browser-memo-app .highlight {
	background-color: yellow !important;
}

.browser-memo-app .focus-highlight {
	background-color: orange !important;
}

.browser-memo-right-aligned {
	justify-content: flex-end;
}

.browser-memo-check-box {
	display: flex;
	align-items: center;
}

.browser-memo-toggle-label {
	margin-right: 7px;
	cursor: pointer;
}

/* エクスポート/インポートボタン */
.browser-memo-io-buttons {
	display: flex;
	align-items: center;
	gap: 4px;
}

.browser-memo-io-button {
	width: 32px;
	height: 32px;
	border-radius: 50% !important;
	background-color: transparent !important;
	color: #898989 !important;
	border: 1px solid #ccc !important;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background-color 0.2s, color 0.2s;
}

.browser-memo-io-button:hover {
	background-color: #f5f5f5 !important;
	color: #333 !important;
}

.browser-memo-io-button svg {
	pointer-events: none;
}

.browser-memo-import-input {
	display: none !important;
	width: 0 !important;
	height: 0 !important;
	position: absolute !important;
	overflow: hidden !important;
}

/* モーダル */
.browser-memo-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.3);
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.browser-memo-modal {
	background-color: #fff !important;
	border-radius: 12px !important;
	padding: 24px !important;
	max-width: 360px;
	width: 90%;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}

.browser-memo-modal-message {
	margin: 0 0 20px;
	font-size: 14px;
	color: #333;
	line-height: 1.6;
}

.browser-memo-modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

.browser-memo-modal-btn {
	padding: 8px 20px;
	font-size: 14px;
	border-radius: 6px !important;
	cursor: pointer;
	border: none !important;
	transition: background-color 0.2s;
}

.browser-memo-modal-btn-cancel {
	background-color: #f0f0f0 !important;
	color: #666 !important;
}

.browser-memo-modal-btn-cancel:hover {
	background-color: #e0e0e0 !important;
}

.browser-memo-modal-btn-ok {
	background-color: #3d3c35 !important;
	color: #fff !important;
}

.browser-memo-modal-btn-ok:hover {
	background-color: #555 !important;
}
