.detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    padding: 20px;
}

.detail-overlay.hidden {
    display: none;
}

.detail-card {
    background: #fff;
    border-radius: 24px;
    width: min(440px, 100%);
    max-height: 92vh;
    overflow: hidden;
    padding: 0;
    position: relative;
    text-align: right;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.detail-card .detail-close {
    position: absolute;
    top: 24px;
    left: 24px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: #000;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.detail-card .detail-image {
    width: 100%;
    height: min(180px, 25vh);
    object-fit: cover;
    border-radius: 24px 24px 0 0;
    display: block;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.detail-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.detail-scroll-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 24px 12px;
    -webkit-overflow-scrolling: touch;
}

.detail-actions-footer {
    flex-shrink: 0;
    padding: 12px 24px 20px;
    border-top: 1px solid #efe3d4;
    background: #fff;
}

.detail-actions-footer.hidden {
    display: none;
}

.detail-name {
    color: #000;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 6px;
}

.detail-price {
    color: #000;
    font-weight: 700;
    font-size: 1.2rem;
    margin: 0 0 4px;
}

.detail-weight {
    color: #000;
    font-size: 0.95rem;
    font-weight: 500;
    margin: 0 0 12px;
}

.detail-section-title {
    color: #000;
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 6px;
}

.detail-description {
    color: #000;
    font-size: 1rem;
    line-height: 1.7;
    white-space: pre-wrap;
    margin: 0;
}

.detail-description.empty {
    color: #000;
    font-style: italic;
}

.coffee-details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    margin: 0 0 12px;
}

.coffee-details-grid:empty {
    display: none;
}

.coffee-details-grid.hidden {
    display: none;
}

.coffee-detail-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #ECE6E1;
    border: 1px solid #efe3d4;
    border-radius: 12px;
    padding: 10px 12px;
    min-width: 0;
}

.coffee-detail-icon {
    font-size: 1rem;
    line-height: 1.2;
    flex-shrink: 0;
}

.coffee-detail-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.coffee-detail-label {
    color: #000;
    opacity: 0.7;
    font-size: 0.78rem;
    font-weight: 700;
}

.coffee-detail-value {
    color: #000;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.4;
    word-break: break-word;
}

.detail-description-section.hidden {
    display: none;
}

.detail-description-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: #ECE6E1;
    border: 1px solid #efe3d4;
    border-radius: 12px;
    color: #000;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 12px 14px;
    margin: 4px 0 0;
    text-align: right;
    transition: all 0.2s ease;
}

.detail-description-toggle:hover {
    background: #e5ddd5;
}

.detail-toggle-arrow {
    font-size: 0.8rem;
    color: #000;
    margin-inline-start: 8px;
}

.detail-description-panel {
    color: #000;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
    margin: 8px 0 0;
    padding: 12px 16px;
    background: #ECE6E1;
    border-radius: 12px;
    border: 1px solid #efe3d4;
    font-weight: 500;
}

.detail-description-panel.hidden {
    display: none;
}

.coffee-details-fieldset,
.coffee-details-disclosure {
    border: 1px solid #F2EDE8;
    border-radius: 14px;
    margin: 0 0 14px;
    padding: 0;
}

.coffee-details-disclosure summary {
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
    color: #000;
    font-size: 0.95rem;
    font-weight: 700;
}

.coffee-details-disclosure summary::-webkit-details-marker {
    display: none;
}

.coffee-details-disclosure summary::after {
    content: " ▼";
    font-size: 0.75rem;
    color: #000;
}

.coffee-details-disclosure[open] summary::after {
    content: " ▲";
}

.coffee-details-disclosure .coffee-details-form-grid {
    padding: 0 14px 12px;
}

.coffee-details-fieldset {
    padding: 12px 14px 10px;
}

.coffee-details-legend {
    color: #000;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0 6px;
}

.coffee-details-optional {
    font-weight: 400;
    font-size: 0.85rem;
    color: #000;
}

.coffee-details-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    margin-top: 8px;
}

.coffee-details-form-item label {
    display: block;
    font-size: 0.85rem;
    color: #000;
    margin-bottom: 4px;
}

.coffee-details-form-item input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid #F2EDE8;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    background: #fff;
    direction: rtl;
}

@media (max-width: 520px) {
    .coffee-details-grid,
    .coffee-details-form-grid {
        grid-template-columns: 1fr;
    }

    .detail-scroll-content {
        padding: 16px 18px 10px;
    }

    .detail-actions-footer {
        padding: 10px 18px 16px;
    }
}

/* Admin product add/edit modal */
.modal-overlay .modal-card {
    background: #fff;
    border-radius: 24px;
    position: relative;
    text-align: right;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-overlay .product-admin-modal {
    width: min(740px, 96vw);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.modal-overlay .product-admin-modal h2 {
    flex-shrink: 0;
    margin: 0;
    padding: 24px 28px 12px;
    padding-inline-start: 48px;
    color: #000;
    font-size: 1.4rem;
}

.modal-overlay .product-admin-modal #product-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.modal-overlay .product-admin-modal .modal-scroll-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 28px 16px;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay .product-admin-modal .modal-footer {
    flex-shrink: 0;
    padding: 12px 28px 24px;
    border-top: 1px solid #efe3d4;
    background: #fff;
}

.modal-overlay .product-admin-modal .modal-scroll-body label {
    margin-top: 10px;
}

.modal-overlay .product-admin-modal .modal-scroll-body label:first-child {
    margin-top: 0;
}

#detail-actions.hidden {
    display: none;
}
