/* ThemeMaster — Custom Styles */

/* ===== Theme variables ===== */
:root,
[data-theme="dark"] {
    --c-primary: #E8553A;
    --c-primary-hover: #D14328;
    --c-secondary: #D4A853;
    --c-secondary-hover: #BF9540;
    --c-bg-main: #1A1A1A;
    --c-bg-card: #262626;
    --c-bg-elevated: #333333;
    --c-bg-light: #F5F0EB;
    --c-text-primary: #E8E2DC;
    --c-text-secondary: #9B9388;
    --c-text-dark: #2D2926;
    --c-text-accent: #E8553A;
    --c-border-default: #3D3D3D;
    --c-border-light: #4A4A4A;
    --c-success: #5B9A6F;
    --c-error: #C44D4D;
    color-scheme: dark;
}

[data-theme="light"] {
    --c-primary: #D94420;
    --c-primary-hover: #C33A18;
    --c-secondary: #B8912D;
    --c-secondary-hover: #A07E22;
    --c-bg-main: #F5F0EB;
    --c-bg-card: #FFFFFF;
    --c-bg-elevated: #EDE8E3;
    --c-bg-light: #1A1A1A;
    --c-text-primary: #2D2926;
    --c-text-secondary: #6B6560;
    --c-text-dark: #E8E2DC;
    --c-text-accent: #D94420;
    --c-border-default: #D5CFC9;
    --c-border-light: #C5BFB8;
    --c-success: #3D8254;
    --c-error: #B33A3A;
    color-scheme: light;
}

/* ===== Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(232, 85, 58, 0.3);
    color: var(--c-text-primary);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--c-bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--c-border-default);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--c-border-light);
}

/* ===== Typography — Prose for static pages ===== */
.prose-tm {
    color: var(--c-text-primary);
    line-height: 1.8;
    font-size: 1.05rem;
}

.prose-tm h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--c-text-primary);
}

.prose-tm h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--c-text-primary);
}

.prose-tm p {
    margin-bottom: 1.25rem;
}

.prose-tm a {
    color: var(--c-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}

.prose-tm a:hover {
    color: var(--c-primary-hover);
}

.prose-tm ul, .prose-tm ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.prose-tm ul {
    list-style-type: disc;
}

.prose-tm ol {
    list-style-type: decimal;
}

.prose-tm li {
    margin-bottom: 0.4rem;
}

.prose-tm blockquote {
    border-left: 3px solid var(--c-primary);
    padding: 0.75rem 1.25rem;
    margin: 1.5rem 0;
    background: var(--c-bg-card);
    border-radius: 0 6px 6px 0;
    color: var(--c-text-secondary);
    font-style: italic;
}

.prose-tm code {
    background: var(--c-bg-elevated);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
    color: var(--c-secondary);
}

.prose-tm pre {
    background: var(--c-bg-card);
    padding: 1.25rem;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.prose-tm pre code {
    background: none;
    padding: 0;
}

.prose-tm img {
    border-radius: 8px;
    margin: 1.5rem 0;
    max-width: 100%;
}

.prose-tm table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.prose-tm table th,
.prose-tm table td {
    padding: 0.6rem 1rem;
    border: 1px solid var(--c-border-default);
    text-align: left;
}

.prose-tm table th {
    background: var(--c-bg-elevated);
    font-weight: 600;
}

.prose-tm table tr:nth-child(even) {
    background: var(--c-bg-card);
}

/* ===== Hero pattern ===== */
.hero-pattern {
    background-image:
        radial-gradient(circle at 20% 50%, rgba(232, 85, 58, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(212, 168, 83, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 50% 80%, rgba(232, 85, 58, 0.03) 0%, transparent 40%);
}

/* ===== Product card hover ===== */
.product-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    border-color: var(--c-border-light);
}

.product-card .card-image img {
    transition: transform 0.4s ease;
}

.product-card:hover .card-image img {
    transform: scale(1.05);
}

/* ===== Tabs ===== */
.tab-btn {
    position: relative;
    padding: 0.75rem 1.5rem;
    color: var(--c-text-secondary);
    font-weight: 500;
    transition: color 0.2s;
    cursor: pointer;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--c-text-primary);
}

.tab-btn.active {
    color: var(--c-primary);
    border-bottom-color: var(--c-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== Gallery ===== */
.gallery-thumb {
    opacity: 0.5;
    transition: opacity 0.2s, border-color 0.2s;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
}

.gallery-thumb:hover,
.gallery-thumb.active {
    opacity: 1;
    border-color: #E8553A;
}

/* ===== Buttons ===== */
.btn-primary {
    background: var(--c-primary);
    color: #fff;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    transition: background 0.2s, transform 0.15s;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: var(--c-primary-hover);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--c-bg-elevated);
    color: var(--c-text-primary);
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.2s;
    border: 1px solid var(--c-border-default);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: var(--c-border-default);
}

/* ===== Form inputs ===== */
.form-input {
    background: var(--c-bg-elevated);
    border: 1px solid var(--c-border-default);
    color: var(--c-text-primary);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 2px rgba(232, 85, 58, 0.15);
}

.form-input::placeholder {
    color: var(--c-text-secondary);
}

/* ===== Badge ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-primary {
    background: color-mix(in srgb, var(--c-primary) 15%, transparent);
    color: var(--c-primary);
}

.badge-secondary {
    background: color-mix(in srgb, var(--c-secondary) 15%, transparent);
    color: var(--c-secondary);
}

.badge-success {
    background: color-mix(in srgb, var(--c-success) 15%, transparent);
    color: var(--c-success);
}

.badge-error {
    background: color-mix(in srgb, var(--c-error) 15%, transparent);
    color: var(--c-error);
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.animate-fade-in {
    animation: fadeIn 0.4s ease forwards;
}

.animate-slide-down {
    animation: slideDown 0.3s ease forwards;
}

/* ===== Mobile drawer ===== */
.mobile-drawer {
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.mobile-drawer.open {
    transform: translateX(0);
}

/* ===== Stat counter ===== */
.stat-number {
    font-variant-numeric: tabular-nums;
}

/* ===== Gradient accent line ===== */
.accent-line {
    height: 2px;
    background: linear-gradient(90deg, var(--c-primary), var(--c-secondary), transparent);
    border: none;
    margin: 0;
}

/* ===== Admin sidebar ===== */
.admin-sidebar .nav-link {
    transition: background 0.2s, color 0.2s, padding-left 0.2s;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: color-mix(in srgb, var(--c-primary) 10%, transparent);
    color: var(--c-primary);
    padding-left: 1.25rem;
}

/* ===== Theme transition ===== */
html {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== Sticky bottom nav — mobile ===== */
.bottom-nav {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Account for bottom nav height on mobile */
@media (max-width: 1023px) {
    body { padding-bottom: 4rem; }
}

.gallery-thumb.active {
    border-color: var(--c-primary);
}

/* ===== Responsive helpers ===== */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }
}
