/*
 * Universal eCommerce Platform - Custom Styles
 * Supplements Tailwind CSS with custom components
 */

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── Header Transition ──────────────────────────────────────────────────── */
#main-header {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* ─── Product Card ───────────────────────────────────────────────────────── */
.product-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.product-card:hover {
    transform: translateY(-2px);
}

/* ─── Cart Sidebar ───────────────────────────────────────────────────────── */
#cart-sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Mobile Menu ────────────────────────────────────────────────────────── */
#mobile-menu {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Back to Top ────────────────────────────────────────────────────────── */
#back-to-top {
    transition: opacity 0.3s, transform 0.3s;
    transform: translateY(0);
}
#back-to-top.opacity-0 {
    transform: translateY(8px);
}

/* ─── Search Dropdown ────────────────────────────────────────────────────── */
#search-dropdown {
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Line Clamp ─────────────────────────────────────────────────────────── */
.line-clamp-1 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.line-clamp-2 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.line-clamp-3 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

/* ─── Prose Content ──────────────────────────────────────────────────────── */
.prose h2 { font-size: 1.25rem; font-weight: 700; margin: 1.5rem 0 0.75rem; color: #111827; }
.prose h3 { font-size: 1.1rem; font-weight: 600; margin: 1.25rem 0 0.5rem; color: #1f2937; }
.prose p  { margin: 0.75rem 0; color: #374151; line-height: 1.7; }
.prose ul { list-style: disc; padding-left: 1.5rem; margin: 0.75rem 0; }
.prose ol { list-style: decimal; padding-left: 1.5rem; margin: 0.75rem 0; }
.prose li { margin: 0.25rem 0; color: #374151; }
.prose a  { color: #4f46e5; text-decoration: underline; }
.prose img { max-width: 100%; border-radius: 0.5rem; margin: 1rem 0; }
.prose blockquote { border-left: 4px solid #e5e7eb; padding-left: 1rem; font-style: italic; color: #6b7280; }
.prose code { background: #f3f4f6; padding: 0.125rem 0.375rem; border-radius: 0.25rem; font-size: 0.875em; }
.prose pre { background: #1f2937; color: #f9fafb; padding: 1rem; border-radius: 0.5rem; overflow-x: auto; }

/* ─── Form Focus Ring ────────────────────────────────────────────────────── */
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ─── Loading Spinner ────────────────────────────────────────────────────── */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.animate-spin { animation: spin 1s linear infinite; }

/* ─── Announcement Bar ───────────────────────────────────────────────────── */
.announcement-bar {
    font-size: 0.8125rem;
}

/* ─── Sticky Sidebar ─────────────────────────────────────────────────────── */
@media (min-width: 1024px) {
    .sticky-sidebar {
        position: sticky;
        top: 5rem;
        max-height: calc(100vh - 6rem);
        overflow-y: auto;
    }
}

/* ─── Product Image Zoom ─────────────────────────────────────────────────── */
#main-image-wrap {
    cursor: zoom-in;
}

/* ─── Skeleton Loading ───────────────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: skeleton-wave 1.5s infinite;
}
@keyframes skeleton-wave {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ─── Rating Stars ───────────────────────────────────────────────────────── */
.star-rating { display: inline-flex; gap: 2px; }

/* ─── Breadcrumb Overflow ────────────────────────────────────────────────── */
nav[aria-label="Breadcrumb"] ol {
    overflow: hidden;
}
nav[aria-label="Breadcrumb"] ol li {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* ─── Mobile Cart Badge ──────────────────────────────────────────────────── */
.cart-count-badge {
    min-width: 1.1rem;
    height: 1.1rem;
    line-height: 1.1rem;
}

/* ─── Print Invoice ──────────────────────────────────────────────────────── */
@media print {
    #main-header, #main-footer, .no-print { display: none !important; }
    body { font-size: 12pt; }
    .print-full { width: 100% !important; }
}

/* ─── Aspect Ratios ──────────────────────────────────────────────────────── */
.aspect-square  { aspect-ratio: 1 / 1; }
.aspect-video   { aspect-ratio: 16 / 9; }
.aspect-product { aspect-ratio: 3 / 4; }

/* ─── Primary/Secondary Color Utilities (fallback if Tailwind CDN config lags) ── */
/* primary: indigo-based (#4F46E5 = indigo-600) */
.bg-primary-50  { background-color: #f0f4ff; }
.bg-primary-100 { background-color: #dbe4ff; }
.bg-primary-200 { background-color: #c7d2fe; }
.bg-primary-300 { background-color: #a5b4fc; }
.bg-primary-400 { background-color: #818cf8; }
.bg-primary-500 { background-color: #4F46E5; }
.bg-primary-600 { background-color: #4338ca; }
.bg-primary-700 { background-color: #3730a3; }
.bg-primary-800 { background-color: #312e81; }

.text-primary-400 { color: #818cf8; }
.text-primary-500 { color: #4F46E5; }
.text-primary-600 { color: #4338ca; }
.text-primary-700 { color: #3730a3; }

.border-primary-200 { border-color: #c7d2fe; }
.border-primary-300 { border-color: #a5b4fc; }
.border-primary-400 { border-color: #818cf8; }
.border-primary-500 { border-color: #4F46E5; }
.border-primary-600 { border-color: #4338ca; }

.ring-primary-500 { --tw-ring-color: #4F46E5; }

.hover\:bg-primary-50:hover  { background-color: #f0f4ff; }
.hover\:bg-primary-100:hover { background-color: #dbe4ff; }
.hover\:bg-primary-600:hover { background-color: #4338ca; }
.hover\:bg-primary-700:hover { background-color: #3730a3; }

.hover\:text-primary-600:hover { color: #4338ca; }
.hover\:text-primary-700:hover { color: #3730a3; }

.hover\:border-primary-300:hover { border-color: #a5b4fc; }
.hover\:border-primary-400:hover { border-color: #818cf8; }
.hover\:border-primary-500:hover { border-color: #4F46E5; }

.focus\:border-primary-500:focus { border-color: #4F46E5; }
.focus\:ring-primary-500:focus   { --tw-ring-color: #4F46E5; }

/* secondary: violet-based */
.bg-secondary-500 { background-color: #7c3aed; }
.bg-secondary-600 { background-color: #6d28d9; }
.text-secondary-500 { color: #7c3aed; }
.text-secondary-600 { color: #6d28d9; }
.hover\:bg-secondary-600:hover { background-color: #6d28d9; }
