/* style.css – Terkin Candy Office look */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;600;700&family=Nunito:wght@300;400;600&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #ffe3f3 0, #fff8e3 45%, #ffeef7 100%);
    color: #3b2b3c;
    min-height: 100vh;
}

/* ── Layout ──────────────────────────────────────────────────── */

.app-shell {
    max-width: 1000px;
    margin: 24px auto 40px;
    padding: 0 16px;
}

.app-card {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 20px;
    box-shadow: 0 18px 45px rgba(255, 170, 214, 0.45);
    padding: 24px 24px 28px;
    border: 1px solid rgba(255, 200, 230, 0.7);
}

/* ── Header ──────────────────────────────────────────────────── */

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
}

.app-title-block h1 {
    font-family: 'Baloo 2', cursive;
    font-size: 2rem;
    color: #e05297;
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-subtitle {
    font-size: 0.9rem;
    color: #8b5b7b;
    margin-top: 4px;
}

.app-badge {
    background: linear-gradient(135deg, #fdfbfb, #ebedee);
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 0.8rem;
    color: #6a4a63;
    border: 1px dashed rgba(224, 82, 151, 0.35);
}

/* ── Admin header ─────────────────────────────────────────────── */

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.admin-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Links & buttons ─────────────────────────────────────────── */

a {
    color: #e05297;
    text-decoration: none;
    font-weight: 600;
}

a:hover {
    text-decoration: underline;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 999px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
    text-decoration: none;
}

.btn:focus-visible {
    outline: 2px solid #e05297;
    outline-offset: 3px;
}

.btn-primary {
    background: linear-gradient(135deg, #ff9a9e, #fecfef);
    color: #5a2342;
    box-shadow: 0 10px 20px rgba(224, 82, 151, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(224, 82, 151, 0.4);
    text-decoration: none;
}

.btn-secondary {
    background: #fff;
    color: #7a4c6b;
    border: 1px solid rgba(224, 82, 151, 0.25);
}

.btn-secondary:hover {
    background: #fff6fb;
    text-decoration: none;
}

.btn-danger {
    background: #fff;
    color: #c0392b;
    border: 1px solid rgba(214, 40, 57, 0.3);
}

.btn-danger:hover {
    background: #fff5f5;
    text-decoration: none;
}

/* ── Sweet grid ──────────────────────────────────────────────── */

.sweets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 10px;
}

.sweet-card {
    background: linear-gradient(135deg, #ffffff, #fff4fb);
    border-radius: 18px;
    padding: 16px 16px 18px;
    border: 1px solid rgba(255, 193, 218, 0.9);
    box-shadow: 0 10px 22px rgba(253, 186, 222, 0.4);
    position: relative;
    overflow: hidden;
}

.sweet-card-inner {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.sweet-card-body {
    position: relative;
    z-index: 1;
}

.sweet-header {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 6px;
}

.sweet-name {
    font-family: 'Baloo 2', cursive;
    font-size: 1.1rem;
    color: #d23b86;
}

.sweet-rating-chip {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 0.75rem;
    border: 1px solid rgba(230, 132, 175, 0.7);
    white-space: nowrap;
}

.sweet-desc {
    font-size: 0.85rem;
    color: #7a4c6b;
    margin: 6px 0 8px;
    min-height: 34px;
}

.sweet-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #aa678b;
}

/* ── Thumbnail ───────────────────────────────────────────────── */

.sweet-thumb {
    width: 110px;
    height: 110px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255, 193, 218, 0.8);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sweet-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-image-placeholder {
    font-size: 2rem;
    opacity: 0.5;
}

.edit-thumb {
    width: 120px;
    height: 120px;
    margin-bottom: 6px;
}

/* ── Candy decoration dots ───────────────────────────────────── */

.candy-dot {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    opacity: 0.25;
    filter: blur(1px);
    pointer-events: none;
}

.candy-dot.dot-1 {
    background: #ffb6c1;
    top: -18px;
    right: -12px;
}

.candy-dot.dot-2 {
    background: #ffe066;
    bottom: -20px;
    left: -10px;
}

/* ── Tags / chips ────────────────────────────────────────────── */

.chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    border: 1px solid rgba(224, 82, 151, 0.35);
    background: rgba(255, 255, 255, 0.9);
}

.stock-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    margin-left: 6px;
    color: #2d7d3a;
    border: 1px solid rgba(130, 189, 90, 0.4);
}

.stock-chip--out {
    color: #d62839;
    border-color: rgba(214, 40, 57, 0.4);
}

/* ── Detail page ─────────────────────────────────────────────── */

.back-link {
    font-size: 0.85rem;
    margin-bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr);
    gap: 24px;
}

.detail-header {
    margin-bottom: 14px;
}

.detail-header h1 {
    font-family: 'Baloo 2', cursive;
    font-size: 1.6rem;
    color: #e05297;
}

.detail-meta {
    font-size: 0.85rem;
    color: #8b5b7b;
    margin-top: 4px;
}

.detail-desc {
    font-size: 0.9rem;
    color: #6a3d5f;
    margin: 8px 0 12px;
}

.detail-main img {
    max-width: 220px;
    max-height: 220px;
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 16px;
    display: block;
    margin-bottom: 10px;
}

/* ── Ratings list ────────────────────────────────────────────── */

.ratings-section {
    margin-top: 16px;
}

.rating-form-section {
    margin-top: 18px;
}

.rating-item {
    border-radius: 14px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 193, 218, 0.7);
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.rating-head {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 4px;
    color: #c23c80;
}

.rating-date {
    font-size: 0.75rem;
    color: #9b5f83;
}

.muted-text {
    color: #9b5f83;
}

/* ── Star rating ─────────────────────────────────────────────── */

.star-rating {
    display: inline-flex;
    flex-direction: row;
    gap: 6px;
    font-size: 2.2rem;
    cursor: pointer;
    user-select: none;
    margin: 6px 0 10px;
}

.star-rating span {
    color: #e0bcd4;
    transition: color 0.15s ease;
    line-height: 1;
}

.star-rating span.active {
    color: #ff759d;
}

.star-rating span:focus-visible {
    outline: 2px solid #e05297;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Forms ───────────────────────────────────────────────────── */

form label,
label.checkbox-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #7a4c6b;
    margin-bottom: 4px;
}

label.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    margin-bottom: 10px;
    cursor: pointer;
}

input[type="text"],
input[type="number"],
input[type="password"],
textarea {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(224, 82, 151, 0.3);
    padding: 8px 10px;
    font-size: 0.9rem;
    font-family: inherit;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.95);
    transition: border-color 0.15s ease, outline-color 0.15s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
textarea:focus {
    outline: 2px solid #e05297;
    outline-offset: 1px;
    border-color: #e05297;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

.form-section {
    margin-bottom: 24px;
}

.form-submit {
    margin-top: 8px;
}

/* ── Section title ───────────────────────────────────────────── */

.section-title {
    font-family: 'Baloo 2', cursive;
    font-size: 1.2rem;
    color: #d23b86;
    margin-bottom: 8px;
}

/* ── Admin table ─────────────────────────────────────────────── */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid #f0c4dd;
    color: #7a4c6b;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.admin-table td {
    padding: 8px;
    border-bottom: 1px solid #f7d7ea;
    vertical-align: middle;
}

.admin-table-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.inline-form {
    display: inline;
    margin: 0;
    padding: 0;
}

/* ── Page footer ─────────────────────────────────────────────── */

.page-footer {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.login-back-link {
    margin-top: 14px;
    font-size: 0.85rem;
    display: block;
}

/* ── Stats ───────────────────────────────────────────────────── */

.stats-chart-wrapper {
    margin-top: 16px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    padding: 16px;
    border: 1px solid rgba(255, 193, 218, 0.7);
}

/* ── Misc ────────────────────────────────────────────────────── */

.empty-text {
    font-size: 0.9rem;
    color: #8b5b7b;
}

.error {
    color: #d62839;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.success {
    color: #2f9e44;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 600px) {
    .app-card {
        padding: 18px 16px 22px;
    }

    .app-header,
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-links {
        width: 100%;
    }

    .sweet-card-inner {
        grid-template-columns: 80px minmax(0, 1fr);
    }

    .sweet-thumb {
        width: 80px;
        height: 80px;
    }

    .page-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .page-footer .btn {
        text-align: center;
    }
}
