/* assets/css/main.css — Global styles & design system */

/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ── CSS Custom Properties ────────────────────────────────────────────────── */
:root {
    --color-bg:          #FAF8F5;
    --color-bg-alt:      #F2EEE8;
    --color-bg-dark:     #1C1C1C;
    --color-text:        #1C1C1C;
    --color-text-muted:  #6B6660;
    --color-text-light:  #9A948E;
    --color-accent:      #C9956A;
    --color-accent-dark: #A87650;
    --color-accent-pale: #F5EAE0;
    --color-border:      #E4DFDA;
    --color-white:       #FFFFFF;
    --color-success:     #4A7C59;
    --color-warning:     #C49A3C;
    --color-danger:      #B05050;

    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body:    'DM Sans', system-ui, sans-serif;

    --radius-sm:  4px;
    --radius:     8px;
    --radius-lg:  16px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 3px rgba(28, 28, 28, 0.08);
    --shadow:    0 4px 16px rgba(28, 28, 28, 0.10);
    --shadow-lg: 0 12px 40px rgba(28, 28, 28, 0.14);

    --header-h:  72px;
    --sidebar-w: 260px;

    --transition: 200ms ease;
    --transition-slow: 400ms ease;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.65;
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

img, video {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: none;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* ── Typography Scale ─────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 4vw, 3.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.75rem); }
h4 { font-size: 1.2rem; }
h5 { font-size: 1rem; }

p { margin-bottom: 0.75em; }
p:last-child { margin-bottom: 0; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
    cursor: pointer;
    border: 1.5px solid transparent;
    white-space: nowrap;
    text-decoration: none;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--color-accent);
    color: var(--color-white);
    border-color: var(--color-accent);
}
.btn-primary:hover {
    background: var(--color-accent-dark);
    border-color: var(--color-accent-dark);
    box-shadow: 0 4px 14px rgba(201, 149, 106, 0.35);
}

.btn-outline {
    background: transparent;
    color: var(--color-accent);
    border-color: var(--color-accent);
}
.btn-outline:hover {
    background: var(--color-accent);
    color: var(--color-white);
}

.btn-dark {
    background: var(--color-text);
    color: var(--color-white);
    border-color: var(--color-text);
}
.btn-dark:hover {
    background: #333;
    border-color: #333;
}

.btn-danger {
    background: var(--color-danger);
    color: var(--color-white);
    border-color: var(--color-danger);
}

.btn-sm {
    padding: 6px 16px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 36px;
    font-size: 14px;
}

.btn-full { width: 100%; justify-content: center; }

/* ── Form Elements ────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-white);
    color: var(--color-text);
    font-size: 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(201, 149, 106, 0.15);
}

.form-control::placeholder { color: var(--color-text-light); }

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B6660' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-error {
    display: block;
    font-size: 12px;
    color: var(--color-danger);
    margin-top: 4px;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--color-text-light);
    margin-top: 4px;
}

/* ── Alert / Flash Messages ───────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success { background: #EEF7F1; color: var(--color-success); border-color: var(--color-success); }
.alert-error   { background: #FBF0F0; color: var(--color-danger);  border-color: var(--color-danger);  }
.alert-warning { background: #FBF6EB; color: var(--color-warning); border-color: var(--color-warning); }
.alert-info    { background: #EEF3FB; color: #3A5FA0;              border-color: #3A5FA0;              }

/* ── Badge ────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.03em;
}

.badge-accent  { background: var(--color-accent-pale); color: var(--color-accent-dark); }
.badge-success { background: #EEF7F1; color: var(--color-success); }
.badge-warning { background: #FBF6EB; color: var(--color-warning); }
.badge-danger  { background: #FBF0F0; color: var(--color-danger);  }
.badge-muted   { background: var(--color-bg-alt); color: var(--color-text-muted); }

/* ── Container / Layout ───────────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1280px;
    margin-inline: auto;
    padding-inline: 20px;
}

.section { padding-block: 60px; }
.section-sm { padding-block: 36px; }

/* ── Page Hero ────────────────────────────────────────────────────────────── */
.page-hero {
    background: var(--color-bg-alt);
    padding: 48px 20px;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}

.page-hero h1 {
    font-size: clamp(1.8rem, 3.5vw, 3rem);
    margin-bottom: 8px;
}

.page-hero p {
    color: var(--color-text-muted);
    font-size: 15px;
}

/* ── Product Card ─────────────────────────────────────────────────────────── */
.product-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.product-card__img-wrap {
    aspect-ratio: 3/4;
    overflow: hidden;
    background: var(--color-bg-alt);
}

.product-card__img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.product-card:hover .product-card__img-wrap img {
    transform: scale(1.04);
}

.product-card__body {
    padding: 16px;
}

.product-card__name {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 4px;
    line-height: 1.3;
}

.product-card__sub {
    font-size: 12px;
    color: var(--color-text-light);
    margin-bottom: 8px;
}

.product-card__price {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-accent);
}

.product-card__stock-badge {
    float: right;
    font-size: 11px;
    color: var(--color-text-light);
}

/* ── Product Grid ─────────────────────────────────────────────────────────── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (min-width: 640px) { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .product-grid { grid-template-columns: repeat(4, 1fr); } }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding-top: 40px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    font-size: 13px;
    transition: background var(--transition), color var(--transition);
}

.pagination a {
    border: 1.5px solid var(--color-border);
    color: var(--color-text-muted);
}

.pagination a:hover { background: var(--color-bg-alt); }

.pagination span.active {
    background: var(--color-accent);
    color: var(--color-white);
    border: 1.5px solid var(--color-accent);
}

/* ── Utility Classes ──────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent); }
.text-sm     { font-size: 13px; }
.text-xs     { font-size: 11px; }

.mt-1 { margin-top: 4px;  }
.mt-2 { margin-top: 8px;  }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mt-5 { margin-top: 40px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }

.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-2        { gap: 8px; }
.gap-3        { gap: 16px; }

.divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin-block: 24px;
}

/* ── Breadcrumb ───────────────────────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-muted);
    padding-block: 16px;
}

.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-accent); }
.breadcrumb .sep { color: var(--color-border); }

/* ── Loading Spinner ──────────────────────────────────────────────────────── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--color-text-muted);
}

.empty-state svg {
    margin-inline: auto;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
    color: var(--color-text);
}

/* ── Responsive adjustments ───────────────────────────────────────────────── */
@media (max-width: 480px) {
    .container { padding-inline: 16px; }
    .section    { padding-block: 40px; }
    .btn-lg     { padding: 12px 24px; }
}

@media (min-width: 768px) {
    .container { padding-inline: 32px; }
}

@media (min-width: 1024px) {
    .container { padding-inline: 40px; }
}
