/**
 * Recipe Event Details Drawer
 * Shown when user clicks on a recipe event in the planner calendar.
 * Matches planner-new-ui/recipe-details.html design.
 * Separate from add-item drawer - does not affect existing drawers.
 */

/* Overlay - matches .add-item-drawer-overlay (excludes sidebar and header from dimming) */
/* Overlay top is set dynamically via JS to align with the bottom of .bannerEval */
/* Overlay left matches sidebar width (excludes sidebar from dimming); uses same var as #sideBar */
.recipe-event-details-overlay {
    --add-item-drawer-overlay-left: var(--layout2-sidebar-width, 265px);
    position: fixed;
    top: var(--add-item-drawer-overlay-top, 0px);
    left: var(--add-item-drawer-overlay-left);
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: stretch;
    z-index: 10001;
    overflow: hidden;
}

@media (max-width: 991px) {
    .recipe-event-details-overlay {
        --add-item-drawer-overlay-left: 0;
        padding: 0 20px;
    }
}

/* Drawer container - matches .recipe-planner-drawer */
.recipe-event-details-drawer {
    border-radius: 8px 0 0 8px;
    background-color: #fff;
    display: flex;
    flex: 1;
    min-width: 359px;
    min-height: 0;
    width: 800px;
    height: 100%;
    max-width: 100%;
    max-height: 100vh;
    flex-direction: column;
    overflow: hidden;
    align-items: stretch;
    justify-content: flex-start;
    padding-top: 16px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
}

/* Header - matches .drawer-header from recipe-planner-drawer */
.recipe-event-details-drawer .drawer-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    display: flex;
    width: 100%;
    align-items: flex-start;
    gap: 40px 100px;
    color: #000;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 0 20px 16px;
}

.recipe-event-details-drawer .drawer-header .header-content {
    display: flex;
    min-width: 240px;
    flex-direction: column;
    align-items: stretch;
    width: 252px;
    margin: auto 0;
}

.recipe-event-details-drawer .drawer-header .modal-title {
    font-family:
        Montserrat,
        -apple-system,
        Roboto,
        Helvetica,
        sans-serif;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

.recipe-event-details-drawer .drawer-header .date-time-info {
    display: flex;
    margin-top: 4px;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 400;
}

.recipe-event-details-drawer .drawer-header .date-time-text {
    margin: auto 0;
}

.recipe-event-details-drawer .drawer-header .calendar-icon {
    aspect-ratio: 1;
    object-fit: contain;
    width: 16px;
    flex-shrink: 0;
}

.recipe-event-details-drawer .drawer-header .edit-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: auto 0;
}

.recipe-event-details-drawer .drawer-header .edit-icon {
    aspect-ratio: 1;
    object-fit: contain;
    width: 16px;
    flex-shrink: 0;
}

.recipe-event-details-drawer .drawer-header .close-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: auto 0;
}

.recipe-event-details-drawer .drawer-header .close-icon {
    aspect-ratio: 1;
    object-fit: contain;
    width: 24px;
    flex-shrink: 0;
}

/* Content area - matches .recipe-info-drawer-content */
.recipe-event-details-drawer .recipe-content {
    z-index: 0;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 0 24px;
}

/* Recipe details card - matches recipe-planner-drawer .recipe-details-card */
.recipe-event-details-drawer .recipe-details-card {
    display: flex;
    width: 100%;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    padding: 0 20px;
    margin-top: 20px;
}

.recipe-event-details-drawer .recipe-detail-image-container {
    position: relative;
    flex-shrink: 0;
}

.recipe-event-details-drawer .recipe-detail-image {
    aspect-ratio: 1;
    object-fit: cover;
    width: 250px;
    min-width: 240px;
    border-radius: 8px;
}

/* Rating badge - matches recipe-info-drawer */
.recipe-event-details-drawer .recipe-detail-image-container .rating-badge {
    border-radius: 64px;
    background-color: #fff;
    position: absolute;
    display: flex;
    align-items: center;
    gap: 5px;
    left: 10px;
    top: 10px;
    padding: 4px 20px;
    font-size: 12px;
    font-weight: 600;
    color: #10152c;
    width: 50px;
}

.recipe-event-details-drawer .recipe-detail-image-container .star-icon {
    width: 12px;
    height: 12px;
    background-color: #ffd700;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.recipe-event-details-drawer .recipe-detail-content {
    display: flex;
    min-width: 240px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    flex: 1;
    padding: 0 16px;
}

.recipe-event-details-drawer .recipe-header-info {
    width: 100%;
}

.recipe-event-details-drawer .recipe-detail-title {
    color: rgba(16, 21, 44, 1);
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.recipe-event-details-drawer .recipe-detail-meta {
    display: flex;
    margin-top: 12px;
    flex-direction: column;
    align-items: flex-start;
    font-size: 12px;
}

.recipe-event-details-drawer .recipe-detail-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.recipe-event-details-drawer .recipe-detail-meta-item:last-child {
    margin-bottom: 0;
}

.recipe-event-details-drawer .recipe-detail-meta-label {
    color: rgba(48, 48, 48, 1);
    font-weight: 400;
}

.recipe-event-details-drawer .recipe-detail-meta-value {
    color: rgba(0, 0, 0, 1);
    font-weight: 500;
}

.recipe-event-details-drawer .recipe-detail-actions {
    display: flex;
    margin-top: 24px;
    align-items: center;
    gap: 8px;
}

.recipe-event-details-drawer .recipe-detail-action-icon {
    box-sizing: border-box;
    width: 32px;
    height: 32px;
    padding: 9px;
    border-radius: 17px;
    object-fit: contain;
    object-position: center;
    cursor: pointer;
}

.recipe-event-details-drawer .recipe-event-delete-btn {
    box-sizing: border-box;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    margin-left: auto;
    flex: none;
    order: 2;
    flex-grow: 0;
    background: #ffffff;
    border: 1px solid #ff555d;
    border-radius: 40px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.recipe-event-details-drawer .recipe-event-delete-btn:hover {
    background-color: rgba(255, 85, 93, 0.08);
}

.recipe-event-details-drawer .recipe-event-delete-btn .delete-icon {
    position: absolute;
    width: 16px;
    height: 16px;
    left: calc(50% - 16px / 2);
    top: calc(50% - 16px / 2);
    object-fit: contain;
}

.recipe-event-details-drawer .recipe-detail-tags {
    margin-top: 24px;
    width: 100%;
}

.recipe-event-details-drawer .tags-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recipe-event-details-drawer .recipe-detail-tag {
    border-radius: 80px;
    background-color: rgba(245, 245, 245, 1);
    padding: 4px 8px;
    color: #10152c;
    font-size: 10px;
    font-weight: 400;
}

/* Recipe settings - matches recipe-confirm-options from Confirm Addition */
.recipe-event-details-drawer .recipe-settings {
    display: flex;
    margin-top: 24px;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0 20px;
}

.recipe-event-details-drawer .recipe-confirm-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 10px;
}

.recipe-event-details-drawer .recipe-confirm-option-card {
    min-width: 0;
    border-radius: 4px;
    background-color: rgba(240, 245, 255, 1);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
}

.recipe-event-details-drawer .recipe-confirm-option-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    font-family: inherit;
    width: 100%;
}

.recipe-event-details-drawer .recipe-confirm-option-label {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(0, 0, 0, 1);
}

.recipe-event-details-drawer .recipe-confirm-repeat-panel {
    margin-top: 20px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.recipe-event-details-drawer .frequency-options {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.recipe-event-details-drawer .frequency-btn {
    padding: 8px 12px;
    border-radius: 80px;
    border: 1px solid rgba(0, 0, 0, 0.3);
    background-color: #fff;
    color: #111827;
    font-size: 12px;
    font-weight: 400;
    cursor: default;
}

.recipe-event-details-drawer .frequency-btn:hover {
    border-color: #9ca3af;
}

.recipe-event-details-drawer .frequency-btn--selected {
    border: 2px solid rgba(91, 176, 189, 1);
    background-color: #fff;
    color: rgba(32, 137, 153, 1);
    font-weight: 600;
}

/* Repeat custom options (editable, matches recipe-confirm-drawer-content) */
.recipe-event-details-drawer .repeat-custom-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.recipe-event-details-drawer .repeat-custom-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.recipe-event-details-drawer .repeat-custom-label {
    width: 35px;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 400;
    color: #000;
}

.recipe-event-details-drawer .repeat-custom-inputs {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.recipe-event-details-drawer .repeat-unit-dropdown-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
}

.recipe-event-details-drawer .repeat-custom-inputs .repeat-unit-dropdown-wrapper:first-child {
    width: 90px;
    flex: none;
}

.recipe-event-details-drawer .repeat-unit-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    background-color: #fff;
    font-size: 12px;
    font-weight: 500;
    color: #000;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.recipe-event-details-drawer .repeat-unit-trigger:hover {
    background-color: #f8f9fa;
}

.recipe-event-details-drawer .repeat-unit-arrow {
    flex-shrink: 0;
    margin-left: 8px;
}

.recipe-event-details-drawer .repeat-unit-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 120px;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
    flex-direction: column;
    padding: 12px;
    z-index: 100;
}

.recipe-event-details-drawer .repeat-unit-dropdown--open {
    display: flex;
}

.recipe-event-details-drawer .repeat-period-option {
    display: flex;
    width: 100%;
    align-items: center;
}

.recipe-event-details-drawer .repeat-period-option:not(:first-child) {
    margin-top: 6px;
}

.recipe-event-details-drawer .repeat-period-btn {
    color: #000;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
    text-align: left;
    width: 100%;
}

.recipe-event-details-drawer .repeat-period-btn:hover {
    opacity: 0.8;
}

.recipe-event-details-drawer .repeat-custom-suffix {
    font-size: 12px;
    font-weight: 400;
    color: #000;
}

.recipe-event-details-drawer .repeat-months-inputs,
.recipe-event-details-drawer .repeat-years-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.recipe-event-details-drawer .repeat-days-of-week {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.recipe-event-details-drawer .repeat-day-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid #595959;
    background-color: #fff;
    color: #6b7280;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.recipe-event-details-drawer .repeat-day-btn:hover {
    border-color: rgba(91, 176, 189, 1);
    color: rgba(91, 176, 189, 1);
}

.recipe-event-details-drawer .repeat-day-btn--selected {
    background-color: rgba(91, 176, 189, 1);
    color: #fff;
    border-color: rgba(91, 176, 189, 1);
}

.recipe-event-details-drawer .repeat-ends-date-row .repeat-custom-label,
.recipe-event-details-drawer .repeat-ends-occurrences-row .repeat-custom-label {
    width: auto;
    min-width: 70px;
}

.recipe-event-details-drawer .repeat-ends-date-input-wrapper {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recipe-event-details-drawer .repeat-ends-occurrences-input-wrapper {
    width: 90px;
    flex: none;
}

.recipe-event-details-drawer .repeat-ends-date-input,
.recipe-event-details-drawer .repeat-ends-occurrences-input {
    height: 32px;
    border: none;
    padding: 10px;
    font-size: 12px;
    font-weight: 500;
    width: 100%;
}

/* Date input when calendar is open (inline mode: calendar visible) */
.recipe-event-details-drawer .repeat-ends-date-input-wrapper:has(.flatpickr-calendar.open) .repeat-ends-date-input,
.recipe-event-details-drawer .repeat-ends-date-input-wrapper:has(.flatpickr-calendar.open) .repeat-ends-date-input.flatpickr-input,
.recipe-event-details-drawer .repeat-ends-date-input-wrapper:has(.flatpickr-calendar) .repeat-ends-date-input,
.recipe-event-details-drawer .repeat-ends-date-input-wrapper:has(.flatpickr-calendar) .repeat-ends-date-input.flatpickr-input {
    height: 32px;
    border: none;
    padding: 20px;
    padding-left: 35px;
    font-size: 12px;
    font-weight: 500;
    width: 100%;
}

.recipe-event-details-drawer .repeat-ends-occurrences-input::-webkit-outer-spin-button,
.recipe-event-details-drawer .repeat-ends-occurrences-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* End date: inline calendar (matches recipe-confirm-drawer-content) */
.recipe-event-details-drawer .repeat-ends-date-input-wrapper[data-recipe-confirm-date-picker="true"] .flatpickr-calendar {
    position: static !important;
    box-shadow: none !important;
    border: none !important;
}

.recipe-event-details-drawer .repeat-ends-date-input-wrapper[data-recipe-confirm-date-picker="true"] .flatpickr-months .flatpickr-month {
    height: 12px;
}

.recipe-event-details-drawer .repeat-ends-date-input-wrapper[data-recipe-confirm-date-picker="true"] .flatpickr-day.selected,
.recipe-event-details-drawer .repeat-ends-date-input-wrapper[data-recipe-confirm-date-picker="true"] .flatpickr-day.selected:hover {
    background: rgba(91, 176, 189, 1) !important;
    color: white !important;
    border-color: rgba(91, 176, 189, 1) !important;
}

.recipe-event-details-drawer .notify-options-panel {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.recipe-event-details-drawer .notify-options-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 4px;
    flex-wrap: wrap;
}

.recipe-event-details-drawer .notify-option-btn {
    padding: 8px 12px;
    border-radius: 80px;
    border: 1px solid rgba(0, 0, 0, 0.3);
    background-color: #fff;
    color: #10152c;
    font-size: 12px;
    font-weight: 400;
    cursor: default;
}

.recipe-event-details-drawer .notify-option-btn:hover {
    background-color: #f8f9fa;
}

.recipe-event-details-drawer .notify-option-btn--selected {
    border: 2px solid #5bb0bd;
    color: #208999;
    font-weight: 600;
}

.recipe-event-details-drawer .recipe-confirm-option-header .toggle-switch {
    width: 27px;
    height: 16px;
    flex-shrink: 0;
    background-color: #d1d5db;
    border-radius: 9999px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
}

.recipe-event-details-drawer .recipe-confirm-option-header .toggle-switch[aria-checked='true'] {
    background-color: #4caf50;
}

.recipe-event-details-drawer .toggle-indicator {
    position: absolute;
    left: 1.5px;
    top: 1.5px;
    width: 13px;
    height: 13px;
    background-color: #fff;
    border-radius: 9999px;
    transition: transform 0.2s;
}

.recipe-event-details-drawer .recipe-confirm-option-header .toggle-switch[aria-checked='true'] .toggle-indicator {
    transform: translateX(11px);
    background-color: #e8f5e9;
}

/* Nutritional section - matches recipe-info-drawer, aligned with recipe-settings */
.recipe-event-details-drawer .nutritional-container {
    border-radius: 4px;
    background-color: rgba(240, 245, 255, 1);
    max-width: 768px;
    padding: 11px 12px;
    margin-top: 12px;
    margin-left: 20px;
    margin-right: 20px;
}

.recipe-event-details-drawer .nutrition-header.nutritional-toggle-btn {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    color: rgba(0, 0, 0, 1);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    justify-content: space-between;
    flex-wrap: wrap;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

.recipe-event-details-drawer .nutrition-title {
    margin: 0;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(0, 0, 0, 1);
}

.recipe-event-details-drawer .nutritional-expand-arrow {
    width: 16px;
    height: 16px;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.recipe-event-details-drawer .nutritional-expandable.expanded .nutritional-expand-arrow {
    transform: rotate(180deg);
}

.recipe-event-details-drawer .nutritional-expandable.expanded .nutrition-list {
    display: flex;
}

.recipe-event-details-drawer .nutrition-list {
    display: none;
    margin-top: 16px;
    width: 100%;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin-bottom: 0;
}

.recipe-event-details-drawer .nutrition-item {
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 1);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    flex: 1;
    min-width: 80px;
    padding: 8px;
}

.recipe-event-details-drawer .nutrition-label {
    color: rgba(137, 137, 137, 1);
    font-size: 10px;
    font-weight: 400;
}

.recipe-event-details-drawer .nutrition-value {
    color: #10152c;
    font-size: 12px;
    font-weight: 500;
}

/* Content sections - matches recipe-info-drawer */
.recipe-event-details-drawer .content-sections {
    display: flex;
    margin-top: 12px;
    width: 100%;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    padding: 0 20px;
}

.recipe-event-details-drawer .ingredients-section,
.recipe-event-details-drawer .directions-section {
    border-radius: 4px;
    background-color: rgba(240, 245, 255, 1);
    min-width: 240px;
    flex: 1;
    padding: 16px 12px;
}

.recipe-event-details-drawer .content-sections .section-title {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0;
}

.recipe-event-details-drawer .ingredients-list {
    font-size: 12px;
    font-weight: 400;
    margin-top: 12px;
    line-height: 1.5;
}

.recipe-event-details-drawer .ingredients-list .ingredient-item {
    margin-bottom: 8px;
}

.recipe-event-details-drawer .ingredients-list .ingredient-item:last-child {
    margin-bottom: 0;
}

.recipe-event-details-drawer .directions-content {
    font-size: 12px;
    font-weight: 400;
    margin-top: 12px;
    line-height: 1.5;
}

.recipe-event-details-drawer .directions-content .step-number {
    font-weight: 700;
    color: rgba(16, 21, 44, 1);
    display: block;
    margin-bottom: 4px;
}

.recipe-event-details-drawer .directions-content .step-text {
    display: block;
    margin-bottom: 12px;
}

.recipe-event-details-drawer .directions-content .step-text:last-child {
    margin-bottom: 0;
}

.recipe-event-details-drawer .recipe-details-loading,
.recipe-event-details-drawer .recipe-details-error {
    padding: 24px;
    text-align: center;
    color: rgba(0, 0, 0, 0.7);
}

.recipe-event-details-drawer .recipe-details-error {
    color: #c0392b;
}

@media (max-width: 600px) {
    .recipe-event-details-drawer .recipe-confirm-options {
        grid-template-columns: 1fr;
    }
}
