/* ==========================================================================
   mpuslugi.com - katalog kosmetykow
   Jeden arkusz stylow dla calej strony publicznej i panelu.
   Uklad "mobile first": najpierw telefon, szersze ekrany dostaja wiecej kolumn.
   ========================================================================== */

:root {
    --bg:            #fbf9f7;
    --bg-raised:     #ffffff;
    --bg-sunken:     #f3efeb;
    --text:          #221c18;
    --text-muted:    #6d635c;
    --text-faint:    #9a908a;
    --line:          #e5ddd6;
    --accent:        #a2624b;
    --accent-hover:  #8a5140;
    --accent-soft:   #f6ece7;
    --danger:        #a33a3a;
    --success:       #3d7a52;

    --radius:     14px;
    --radius-sm:  9px;
    --shadow:     0 1px 2px rgba(34, 28, 24, .05), 0 8px 24px rgba(34, 28, 24, .06);
    --shadow-lift: 0 2px 4px rgba(34, 28, 24, .07), 0 16px 40px rgba(34, 28, 24, .10);

    --wrap: 1080px;
    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:           #171311;
        --bg-raised:    #211b18;
        --bg-sunken:    #100d0b;
        --text:         #f0eae5;
        --text-muted:   #b3a89f;
        --text-faint:   #857a72;
        --line:         #322a25;
        --accent:       #d79b81;
        --accent-hover: #e8b096;
        --accent-soft:  #2a201b;
        --danger:       #e08b8b;
        --success:      #86c79c;
        --shadow:       0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
        --shadow-lift:  0 2px 4px rgba(0, 0, 0, .35), 0 16px 40px rgba(0, 0, 0, .45);
    }
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 20px;
}

/* --- naglowek i stopka -------------------------------------------------- */

.site-header {
    border-bottom: 1px solid var(--line);
    background: var(--bg-raised);
    position: sticky;
    top: 0;
    z-index: 10;
}

.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
}

.brand {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--text);
}
.brand:hover { color: var(--accent); text-decoration: none; }

.site-footer {
    margin-top: 72px;
    padding: 28px 0;
    border-top: 1px solid var(--line);
    color: var(--text-muted);
    font-size: .875rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.site-footer p { margin: 0; }

main.wrap { padding-top: 32px; padding-bottom: 8px; }

/* --- naglowki ----------------------------------------------------------- */

.page-title {
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -.01em;
    margin: 0 0 24px;
}

.intro { margin: 0 0 28px; color: var(--text-muted); max-width: 62ch; }
.intro p { margin: 0; }

/* --- siatka produktow --------------------------------------------------- */

.grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.card {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }

.card-link { display: block; color: inherit; }
.card-link:hover { text-decoration: none; color: inherit; }

.card-image {
    aspect-ratio: 1 / 1;
    background: var(--bg-sunken);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.card-image img { width: 100%; height: 100%; object-fit: cover; }

.card-image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-sunken), var(--accent-soft));
}

.card-body { padding: 16px 16px 18px; }

.card-brand {
    margin: 0 0 4px;
    font-size: .75rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.card-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
}

.card-volume { margin: 4px 0 0; font-size: .875rem; color: var(--text-muted); }
.card-price  { margin: 10px 0 0; font-size: 1rem; font-weight: 600; color: var(--accent); }

.empty { text-align: center; padding: 64px 0; color: var(--text-muted); }
.empty h1 { font-size: 1.4rem; margin: 0 0 8px; color: var(--text); }
.empty p { margin: 0; }

/* --- strona produktu ---------------------------------------------------- */

.breadcrumb { margin: 0 0 24px; font-size: .9rem; }

.product {
    display: grid;
    gap: 28px;
    grid-template-columns: 1fr;
    align-items: start;
}

@media (min-width: 760px) {
    .product { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 40px; }
    .product-media { position: sticky; top: 96px; }
}

.product-media {
    background: var(--bg-sunken);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 1 / 1;
}
.product-media img { width: 100%; height: 100%; object-fit: cover; }

.product-brand {
    margin: 0 0 6px;
    font-size: .8rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.product-name {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -.015em;
}

.product-meta {
    margin: 10px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: .875rem;
    color: var(--text-muted);
}
.product-meta span {
    background: var(--bg-sunken);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 12px;
}

.product-price { margin: 18px 0 0; font-size: 1.5rem; font-weight: 600; color: var(--accent); }

.product-lead { margin: 18px 0 0; color: var(--text-muted); max-width: 56ch; }

.product-actions { margin: 26px 0 0; display: flex; flex-wrap: wrap; gap: 12px; }

.product-contact { margin: 14px 0 0; font-size: .9rem; color: var(--text-muted); }

.product-section { margin-top: 56px; }
.product-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.prose { max-width: 68ch; color: var(--text); }

.ingredients {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ingredients li {
    font-size: .8125rem;
    background: var(--bg-sunken);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    color: var(--text-muted);
}

.disclaimer {
    margin: 16px 0 0;
    font-size: .8125rem;
    color: var(--text-faint);
    max-width: 66ch;
}

.product-barcode { margin-top: 40px; font-size: .8125rem; color: var(--text-faint); }

/* --- przyciski ---------------------------------------------------------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--bg-raised);
    color: var(--text);
    font: inherit;
    font-size: .9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.button:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }

.button-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.button-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

@media (prefers-color-scheme: dark) {
    .button-primary { color: #1a1512; }
    .button-primary:hover { color: #1a1512; }
}

.button-share svg { flex: none; }

.button-danger { border-color: var(--danger); color: var(--danger); }
.button-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.button-small { padding: 7px 14px; font-size: .875rem; }

/* --- komunikaty --------------------------------------------------------- */

.flash {
    margin: 0 0 22px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--bg-raised);
    font-size: .9375rem;
}
.flash-success { border-color: var(--success); color: var(--success); }
.flash-error   { border-color: var(--danger);  color: var(--danger); }

/* ==========================================================================
   Panel administracyjny
   ========================================================================== */

.panel-shell { max-width: 960px; margin: 0 auto; padding: 0 20px; }

.panel-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
    margin-bottom: 28px;
}
.panel-header h1 { font-size: 1.25rem; margin: 0; font-weight: 600; }
.panel-header nav { display: flex; gap: 8px; flex-wrap: wrap; }

.login-box {
    max-width: 380px;
    margin: 12vh auto 0;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}
.login-box h1 { margin: 0 0 6px; font-size: 1.25rem; font-weight: 600; }
.login-box p.hint { margin: 0 0 22px; color: var(--text-muted); font-size: .875rem; }

.field { margin-bottom: 18px; }
.field label {
    display: block;
    margin-bottom: 6px;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-muted);
}
.field input[type=text],
.field input[type=password],
.field input[type=number],
.field input[type=file],
.field select,
.field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: .9375rem;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
}
.field .help { margin: 6px 0 0; font-size: .8125rem; color: var(--text-faint); }

.field-row { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .field-row { grid-template-columns: 1fr 1fr; } }

.admin-table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.admin-table th, .admin-table td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.admin-table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 600; }
.admin-table tbody tr:hover { background: var(--bg-sunken); }
.admin-table .thumb { width: 52px; height: 52px; border-radius: var(--radius-sm); object-fit: cover; background: var(--bg-sunken); }
.admin-table .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.badge {
    display: inline-block;
    font-size: .75rem;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--text-muted);
}
.badge-published { border-color: var(--success); color: var(--success); }
.badge-draft     { border-color: var(--text-faint); color: var(--text-faint); }

.stats { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.stat {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    min-width: 130px;
}
.stat .value { font-size: 1.5rem; font-weight: 600; line-height: 1.2; }
.stat .label { font-size: .8125rem; color: var(--text-muted); }

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 22px;
    margin-top: 26px;
    border-top: 1px solid var(--line);
}

.preview-pair { display: grid; gap: 20px; grid-template-columns: 1fr; margin-bottom: 24px; }
@media (min-width: 700px) { .preview-pair { grid-template-columns: 1fr 1fr; } }
.preview-pair figure { margin: 0; }
.preview-pair figcaption { font-size: .8125rem; color: var(--text-muted); margin-top: 6px; }
.preview-pair img { border: 1px solid var(--line); border-radius: var(--radius-sm); width: 100%; }

.spinner-note { display: none; align-items: center; gap: 10px; color: var(--text-muted); font-size: .9375rem; margin-top: 14px; }
.spinner-note.visible { display: flex; }
.spinner {
    width: 16px; height: 16px;
    border: 2px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
    .card:hover { transform: none; }
}
