/**
 * Cart Drawer Styles
 *
 * Modern AJAX cart drawer with animations and smooth transitions.
 *
 * @package Arptreme_Theme_10
 * @since 1.0.0
 */

/* ========================================
   CART DRAWER OVERLAY
   ======================================== */

.cart-drawer-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	z-index: 9998;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cart-drawer-overlay.active {
	opacity: 1;
	visibility: visible;
}

/* ========================================
   CART DRAWER
   ======================================== */

.cart-drawer {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	max-width: 450px;
	background: #fff;
	box-shadow: -4px 0 30px rgba(0, 0, 0, 0.2);
	z-index: 9999;
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-drawer.active {
	transform: translateX(0);
}

/* ========================================
   CART DRAWER HEADER
   ======================================== */

.cart-drawer-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1.5rem 1.5rem;
	border-bottom: 1px solid #e5e5e5;
	background: #fafafa;
}

.cart-drawer-title {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 700;
	color: #1a1a1a;
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.cart-drawer-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 28px;
	height: 28px;
	padding: 0 8px;
	background: #FF5722;
	color: #fff;
	font-size: 0.875rem;
	font-weight: 700;
	border-radius: 14px;
}

.cart-drawer-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: none;
	background: #fff;
	border-radius: 50%;
	cursor: pointer;
	transition: all 0.3s ease;
	color: #666;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cart-drawer-close:hover {
	background: #f5f5f5;
	color: #1a1a1a;
	transform: rotate(90deg);
}

/* ========================================
   CART DRAWER CONTENT
   ======================================== */

.cart-drawer-content {
	flex: 1;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
}

/* ========================================
   EMPTY CART
   ======================================== */

.cart-drawer-empty {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 3rem 1.5rem;
	text-align: center;
}

.cart-drawer-empty svg {
	color: #ddd;
	margin-bottom: 1.5rem;
	animation: floatAnimation 3s ease-in-out infinite;
}

@keyframes floatAnimation {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-10px); }
}

.cart-drawer-empty p {
	font-size: 1.125rem;
	color: #666;
	margin-bottom: 1.5rem;
	font-weight: 500;
}

.cart-drawer-shop-btn {
	display: inline-block;
	padding: 0.875rem 1.75rem;
	background: #1a1a1a;
	color: #fff;
	text-decoration: none;
	border-radius: 50px;
	font-weight: 600;
	transition: all 0.3s ease;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cart-drawer-shop-btn:hover {
	background: #333;
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* ========================================
   CART ITEMS
   ======================================== */

.cart-drawer-items {
	flex: 1;
	padding: 1rem 1.5rem;
	overflow-y: auto;
}

.cart-drawer-item {
	display: grid;
	grid-template-columns: 90px 1fr auto;
	gap: 1rem;
	padding: 1.25rem 0;
	border-bottom: 1px solid #f0f0f0;
	position: relative;
	animation: slideIn 0.3s ease;
}

@keyframes slideIn {
	from {
		opacity: 0;
		transform: translateX(20px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

.cart-drawer-item:last-child {
	border-bottom: none;
}

.cart-drawer-item-image {
	flex-shrink: 0;
	width: 90px;
	height: 90px;
	border-radius: 12px;
	overflow: hidden;
	background: #f5f5f5;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	transition: transform 0.3s ease;
}

.cart-drawer-item-image:hover {
	transform: scale(1.05);
}

.cart-drawer-item-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.cart-drawer-item-image:hover img {
	transform: scale(1.1);
}

.cart-drawer-item-details {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	min-width: 0;
}

.cart-drawer-item-name {
	font-size: 0.95rem;
	font-weight: 600;
	color: #1a1a1a;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cart-drawer-item-name a {
	color: inherit;
	text-decoration: none;
	transition: color 0.3s ease;
}

.cart-drawer-item-name a:hover {
	color: #FF5722;
}

.cart-drawer-item-price {
	font-size: 0.9rem;
	font-weight: 600;
	color: #FF5722;
}

.cart-drawer-item-subtotal {
	font-size: 1rem;
	font-weight: 700;
	color: #1a1a1a;
	margin-top: auto;
}

/* ========================================
   QUANTITY CONTROLS
   ======================================== */

.cart-drawer-item-quantity {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	background: #f5f5f5;
	border-radius: 50px;
	padding: 0.25rem;
	width: fit-content;
}

.quantity-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: none;
	background: #fff;
	border-radius: 50%;
	cursor: pointer;
	transition: all 0.3s ease;
	color: #666;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.quantity-btn:hover {
	background: #1a1a1a;
	color: #fff;
	transform: scale(1.1);
}

.quantity-btn:active {
	transform: scale(0.95);
}

.quantity-input {
	width: 40px;
	height: 32px;
	border: none;
	background: transparent;
	text-align: center;
	font-size: 0.95rem;
	font-weight: 600;
	color: #1a1a1a;
	pointer-events: none;
}

/* Remove spinner arrows */
.quantity-input::-webkit-inner-spin-button,
.quantity-input::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.quantity-input[type=number] {
	-moz-appearance: textfield;
}

/* ========================================
   REMOVE BUTTON
   ======================================== */

.cart-drawer-item-remove {
	position: absolute;
	top: 1rem;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: none;
	background: #fff;
	border-radius: 50%;
	cursor: pointer;
	transition: all 0.3s ease;
	color: #999;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cart-drawer-item-remove:hover {
	background: #fef2f2;
	color: #ef4444;
	transform: rotate(90deg) scale(1.1);
}

.cart-drawer-item-remove:active {
	transform: rotate(90deg) scale(0.95);
}

/* ========================================
   CART FOOTER
   ======================================== */

.cart-drawer-footer {
	border-top: 2px solid #e5e5e5;
	padding: 1.5rem;
	background: #fafafa;
}

.cart-drawer-subtotal {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1.5rem;
	padding: 1rem;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.cart-drawer-subtotal-label {
	font-weight: 600;
	font-size: 1rem;
	color: #666;
}

.cart-drawer-subtotal-amount {
	font-weight: 800;
	font-size: 1.5rem;
	color: #1a1a1a;
}

.cart-drawer-actions {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.cart-drawer-btn {
	display: block;
	padding: 1rem;
	text-align: center;
	text-decoration: none;
	border-radius: 50px;
	font-weight: 700;
	font-size: 1rem;
	transition: all 0.3s ease;
	position: relative;
	overflow: hidden;
	z-index: 1;
}

.cart-drawer-btn::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(255, 255, 255, 0.1);
	opacity: 0;
	transition: opacity 0.3s ease;
	z-index: -1;
	border-radius: 50px;
}

.cart-drawer-btn:hover::before {
	opacity: 1;
}

.cart-drawer-btn-view {
	background: #fff;
	color: #1a1a1a;
	border: 2px solid #e5e5e5;
}

.cart-drawer-btn-view::before {
	background: #4a4a4a;
}

.cart-drawer-btn-view:hover {
	border-color: #4a4a4a;
	color: #fff;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.cart-drawer-btn-checkout {
	background: #007bff;
	color: #fff;
	border: 2px solid #007bff;
	box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.cart-drawer-btn-checkout::before {
	background: #0056b3;
}

.cart-drawer-btn-checkout:hover {
	border-color: #0056b3;
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

/* ========================================
   LOADING STATE
   ======================================== */

.cart-drawer-loading {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(255, 255, 255, 0.9);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cart-drawer-loading.active {
	opacity: 1;
	visibility: visible;
}

.cart-drawer-spinner {
	width: 50px;
	height: 50px;
	border: 4px solid #f3f3f3;
	border-top: 4px solid #FF5722;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

.cart-drawer-content::-webkit-scrollbar,
.cart-drawer-items::-webkit-scrollbar {
	width: 8px;
}

.cart-drawer-content::-webkit-scrollbar-track,
.cart-drawer-items::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 4px;
}

.cart-drawer-content::-webkit-scrollbar-thumb,
.cart-drawer-items::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 4px;
	transition: background 0.3s ease;
}

.cart-drawer-content::-webkit-scrollbar-thumb:hover,
.cart-drawer-items::-webkit-scrollbar-thumb:hover {
	background: #999;
}

/* ========================================
   PREVENT BODY SCROLL
   ======================================== */

body.cart-drawer-open {
	overflow: hidden;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 480px) {
	.cart-drawer {
		max-width: 100%;
	}

	.cart-drawer-header {
		padding: 1rem;
	}

	.cart-drawer-items {
		padding: 0.75rem 1rem;
	}

	.cart-drawer-item {
		grid-template-columns: 70px 1fr auto;
		gap: 0.75rem;
		padding: 1rem 0;
	}

	.cart-drawer-item-image {
		width: 70px;
		height: 70px;
	}

	.cart-drawer-item-name {
		font-size: 0.875rem;
	}

	.cart-drawer-item-price {
		font-size: 0.8rem;
	}

	.cart-drawer-item-subtotal {
		font-size: 0.9rem;
	}

	.cart-drawer-footer {
		padding: 1rem;
	}

	.cart-drawer-subtotal {
		padding: 0.75rem;
	}

	.cart-drawer-subtotal-amount {
		font-size: 1.25rem;
	}

	.cart-drawer-btn {
		padding: 0.875rem;
		font-size: 0.95rem;
	}
}

@media (max-width: 360px) {
	.cart-drawer-item {
		grid-template-columns: 60px 1fr;
		gap: 0.5rem;
	}

	.cart-drawer-item-image {
		width: 60px;
		height: 60px;
	}

	.cart-drawer-item-remove {
		position: static;
		margin-top: 0.5rem;
		width: 100%;
		border-radius: 8px;
		grid-column: 1 / -1;
	}

	.quantity-btn {
		width: 28px;
		height: 28px;
	}

	.quantity-input {
		width: 35px;
		height: 28px;
	}
}

/* ========================================
   DARK MODE SUPPORT (OPTIONAL)
   ======================================== */

@media (prefers-color-scheme: dark) {
	.cart-drawer {
		background: #1a1a1a;
		color: #fff;
	}

	.cart-drawer-header {
		background: #222;
		border-bottom-color: #333;
	}

	.cart-drawer-title {
		color: #fff;
	}

	.cart-drawer-close {
		background: #333;
		color: #fff;
	}

	.cart-drawer-close:hover {
		background: #444;
	}

	.cart-drawer-item {
		border-bottom-color: #333;
	}

	.cart-drawer-item-name,
	.cart-drawer-item-subtotal {
		color: #fff;
	}

	.cart-drawer-item-quantity {
		background: #333;
	}

	.quantity-btn {
		background: #444;
		color: #fff;
	}

	.quantity-btn:hover {
		background: #555;
	}

	.quantity-input {
		color: #fff;
	}

	.cart-drawer-item-remove {
		background: #333;
		color: #999;
	}

	.cart-drawer-footer {
		background: #222;
		border-top-color: #333;
	}

	.cart-drawer-subtotal {
		background: #333;
	}

	.cart-drawer-subtotal-label {
		color: #999;
	}

	.cart-drawer-subtotal-amount {
		color: #fff;
	}

	.cart-drawer-btn-view {
		background: #333;
		color: #fff;
		border-color: #444;
	}

	.cart-drawer-btn-view:hover {
		background: #444;
		border-color: #555;
	}
}
