/* ==========================================================================
   Base & Core Styles
   ========================================================================== */

body {
	font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html.dark body {
	background-color: #050507;
	background-image: radial-gradient(circle at 50% 0%, #13131f 0%, #050507 50%);
	background-attachment: fixed;
}

h1,
h2,
h3,
.font-heading {
	font-family: 'Outfit', 'Inter', system-ui, sans-serif;
}

/* ==========================================================================
   Scrollbars
   ========================================================================== */

::-webkit-scrollbar {
	width: 8px;
}

::-webkit-scrollbar-track {
	background: transparent;
}

::-webkit-scrollbar-thumb {
	background: #a1a1aa;
	border-radius: 10px;
	border: 2px solid #f8fafc;
}

html.dark ::-webkit-scrollbar-thumb {
	background: #27272a;
	border-color: #050507;
}

::-webkit-scrollbar-thumb:hover {
	background: #3f3f46;
}

.no-scrollbar::-webkit-scrollbar {
	display: none;
}

.no-scrollbar {
	-ms-overflow-style: none;
	scrollbar-width: none;
}

.custom-scrollbar::-webkit-scrollbar {
	width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.1);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
	background: #3f3f46;
	border-radius: 10px;
}

/* ==========================================================================
   Media Type & Status Colors
   ========================================================================== */

:root {
	--col-anime: #8b5cf6;
	--col-manga: #ec4899;
	--col-book: #3b82f6;
	--col-movie: #ef4444;
	--col-series: #f59e0b;
	--col-hidden: #f97316;

	--col-planning: #a1a1aa;
	--col-reading: #38bdf8;
	--col-readingwatching: #38bdf8;
	--col-dropped: #f87171;
	--col-onhold: #fb923c;
	--col-anticipating: #e879f9;
	--col-completed: #34d399;
}

.media-Anime {
	--theme-col: var(--col-anime);
}

.media-Manga {
	--theme-col: var(--col-manga);
}

.media-Book {
	--theme-col: var(--col-book);
}

.media-Movie {
	--theme-col: var(--col-movie);
}

.media-Series {
	--theme-col: var(--col-series);
}

/* ==========================================================================
   Media Cards
   ========================================================================== */

.media-card {
	transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
	position: relative;
	overflow: hidden;
	z-index: 1;
}

.media-card::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 12px;
	padding: 4px;
	background: linear-gradient(135deg, var(--theme-col), transparent 70%);
	-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	opacity: 1;
	pointer-events: none;
	z-index: 30;
	transition: padding 0.3s ease, background 0.3s ease;
}

.media-card:hover {
	transform: translateY(-6px) scale(1.02);
	box-shadow: 0 15px 40px -10px var(--theme-col, #6366f1);
	z-index: 30;
}

.media-card:hover::before {
	padding: 5px;
	background: linear-gradient(135deg, var(--theme-col), transparent 30%);
}

.media-card.list-card-mode:hover {
	transform: translateY(-2px) scale(1);
	box-shadow: 0 4px 12px -2px var(--theme-col, #6366f1);
}

.media-badge {
	background: rgba(255, 255, 255, 0.95);
	border: 1px solid var(--theme-col);
	color: var(--theme-col);
	box-shadow: 0 2px 10px -2px rgba(0, 0, 0, 0.05);
}

html.dark .media-badge {
	background: rgba(20, 20, 25, 0.9);
	color: var(--theme-col);
	border: 1px solid var(--theme-col);
	box-shadow: 0 2px 10px -2px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeUp {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.animate-enter {
	animation: fadeUp 0.4s ease-out forwards;
}

@keyframes slideInRight {
	from {
		transform: translateX(100%);
		opacity: 0;
	}

	to {
		transform: translateX(0);
		opacity: 1;
	}
}

@keyframes slideOutLeft {
	from {
		transform: translateX(0);
		opacity: 1;
	}

	to {
		transform: translateX(-100%);
		opacity: 0;
	}
}

@keyframes slideInLeft {
	from {
		transform: translateX(-100%);
		opacity: 0;
	}

	to {
		transform: translateX(0);
		opacity: 1;
	}
}

@keyframes slideOutRight {
	from {
		transform: translateX(0);
		opacity: 1;
	}

	to {
		transform: translateX(100%);
		opacity: 0;
	}
}

.wizard-step {
	transition: all 0.4s ease-in-out;
	backface-visibility: hidden;
}

.step-enter-right {
	animation: slideInRight 0.4s forwards;
}

.step-exit-left {
	animation: slideOutLeft 0.4s forwards;
}

.step-enter-left {
	animation: slideInLeft 0.4s forwards;
}

.step-exit-right {
	animation: slideOutRight 0.4s forwards;
}

/* ==========================================================================
   Modals & Interaction
   ========================================================================== */

.selection-card {
	transition: all 0.2s;
	cursor: pointer;
}

.selection-card.selected {
	border-color: var(--theme-col, #6366f1);
	box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

html:not(.dark) .selection-card.selected {
	background: #18181b;
	color: var(--theme-col, #6366f1);
}

html.dark .selection-card.selected {
	background: #ffffff;
	color: var(--theme-col, #6366f1);
}

.full-screen-modal {
	width: 60rem !important;
	max-width: 95vw !important;
	height: 90vh !important;
	max-height: 90vh !important;
}

#editSidebar {
	width: 16rem;
	flex-shrink: 0;
}

.sidebar-link {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	border-radius: 0.75rem;
	font-size: 0.875rem;
	font-weight: 600;
	color: #71717a;
	transition: all 0.2s;
	width: 100%;
	text-align: left;
}

html.dark .sidebar-link {
	color: #a1a1aa;
}

.sidebar-link:hover {
	background-color: #f4f4f5;
	color: #18181b;
}

html.dark .sidebar-link:hover {
	background-color: #18181b;
	color: #fff;
}

.sidebar-link.active {
	background-color: #18181b;
	color: #fff;
}

html.dark .sidebar-link.active {
	background-color: #fff;
	color: #000;
}

/* ==========================================================================
   Scroll Mode Overrides (Edit Mode)
   ========================================================================== */

.scroll-mode .wizard-step {
	position: relative !important;
	inset: auto !important;
	display: flex !important;
	flex-direction: column !important;
	height: auto !important;
	opacity: 1 !important;
	transform: none !important;
	padding: 0 0 3rem 0 !important;
	border-bottom: 1px solid #e4e4e7;
	margin-bottom: 2rem;
}

.scroll-mode .wizard-step.hidden {
	display: none !important;
}

html.dark .scroll-mode .wizard-step {
	border-bottom-color: #27272a;
}

.scroll-mode .wizard-step:last-child {
	border-bottom: none;
	margin-bottom: 0;
}

.scroll-mode .edit-only-header {
	display: block !important;
}

/* ==========================================================================
   Calendar Styles
   ========================================================================== */

.calendar-day-cell {
	min-height: 4rem;
}

#calendarDayDetail {
	box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
}

html.dark #calendarDayDetail {
	box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
}

#monthYearPicker {
	animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@media (max-width: 640px) {
	#calendarModalContent .px-6 {
		padding-left: 1rem;
		padding-right: 1rem;
	}

	.calendar-day-cell {
		min-height: 4rem;
		padding: 0.25rem;
	}

	.calendar-day-cell span {
		font-size: 0.7rem;
	}
}

.calendar-cover-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	grid-template-rows: repeat(2, 1fr);
	gap: 2px;
	width: 100%;
	height: 100%;
	overflow: hidden;
	border-radius: 0.5rem;
	margin-top: 2px;
}

.calendar-cover-preview {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 0.125rem;
	transition: opacity 0.2s;
}

.calendar-cover-preview:hover {
	opacity: 0.8;
}

#addEventSuggestions::-webkit-scrollbar {
	width: 6px;
}

#addEventSuggestions::-webkit-scrollbar-track {
	background: transparent;
}

#addEventSuggestions::-webkit-scrollbar-thumb {
	background-color: rgba(161, 161, 170, 0.3);
	border-radius: 3px;
}

html.dark #addEventSuggestions::-webkit-scrollbar-thumb {
	background-color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Quick Add Mode
   ========================================================================== */

body.quick-add-mode header,
body.quick-add-mode main,
body.quick-add-mode #dbSelectModal {
	display: none !important;
}

body.quick-add-mode #modal {
	display: flex !important;
	opacity: 1 !important;
	visibility: visible !important;
	background: transparent !important;
	backdrop-filter: none !important;
	padding: 0 !important;
}

body.quick-add-mode #modalContent {
	transform: none !important;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	border-radius: 0 !important;
	border: none !important;
	box-shadow: none !important;
	background: transparent !important;
}

body.quick-add-mode {
	background-color: #ffffff;
}

html.dark body.quick-add-mode {
	background-color: #09090b;
}

body.quick-add-mode #closeModalBtn,
body.quick-add-mode #modalContent > div.border-b {
	display: none !important;
}

body.quick-add-mode #formScrollWrapper {
	background: transparent !important;
}

/* ==========================================================================
   Advanced Sidebar Filters & Polish
   ========================================================================== */

#advancedSidebar:not(.hidden) {
	display: block !important;
}

#gridContainer {
	transition: all 0.3s ease-in-out;
}

.glow-indigo {
	box-shadow: 0 0 15px 2px rgba(79, 70, 229, 0.4);
	border-color: rgba(99, 102, 241, 0.6);
}

.glow-red {
	box-shadow: 0 0 15px 2px rgba(239, 68, 68, 0.4);
	border-color: rgba(239, 68, 68, 0.6);
}

input::placeholder {
	transition: opacity 0.3s ease;
}

input:focus::placeholder {
	opacity: 0.5;
}

/* ==========================================================================
   Mobile, Touch & Safe-Area Ergonomics
   ========================================================================== */

.pb-safe {
	padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

button,
[role="button"],
a {
	-webkit-tap-highlight-color: transparent;
}

@media (max-width: 767px) {
	input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
	select,
	textarea {
		font-size: 16px !important;
	}
}
