/* The photo-first composer is shared by desktop and mobile entry points. */
#memory-creation-mobile {
    padding: 24px;
    box-sizing: border-box;
    background: rgb(20 28 24 / 48%);
}

#memory-creation-mobile > .modal {
    position: relative;
    inset: auto;
    transform: none;
    width: min(960px, 100%);
    max-width: 100%;
    height: min(860px, calc(100dvh - 48px)) !important;
    max-height: calc(100dvh - 48px) !important;
    padding: 0;
    overflow: hidden;
    color: #242824;
    background: #fff;
    border: 1px solid #dedfd9;
    border-radius: 24px;
    box-shadow: 0 24px 80px rgb(20 28 24 / 24%);
    font-family: Inter, SFProText, system-ui, sans-serif;
    color-scheme: light;
}

#memory-creation-mobile > .memory-composer,
#memory-creation-mobile > .success-screen {
    display: flex;
    flex-direction: column;
}

.memory-composer *,
#memory-creation-mobile .memory-composer-footer { box-sizing: border-box; }

.memory-composer-utilities {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px 8px;
    flex-shrink: 0;
}
.memory-composer-utilities h2 { margin: 0; color: #242824; font-size: 22px; line-height: 1.3; }
.memory-composer .md-editor-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0; }
.memory-composer .md-editor-links :is(a, button) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid #dadfd5;
    border-radius: 10px;
    background: #fff;
    color: #a74722;
    font: 600 14px/1.4 Inter, SFProText, system-ui, sans-serif;
    text-decoration: none;
    cursor: pointer;
}
.memory-composer-header { display: flex; align-items: center; gap: 16px; padding: 8px 24px 16px; flex-shrink: 0; }
.memory-composer-header > button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #dadfd5;
    border-radius: 50%;
    background: #f7f8f3;
    color: #444e43 !important;
    cursor: pointer;
}
.memory-composer-progress { display: flex; flex: 1; min-width: 0; }
.memory-composer-progress .connecting-line { width: clamp(8px, 4vw, 36px); flex-shrink: 1; }
.memory-composer .memory-step-label {
    margin: 0;
    padding: 0 24px 16px;
    border-bottom: 1px solid #e2e5dd;
    color: #5b6559;
    font-size: 14px;
    line-height: 1.5;
    flex-shrink: 0;
}
.memory-composer .memory-mobile-stage {
    flex: 1;
    min-height: 0;
    height: auto !important;
    overflow: hidden;
}
.memory-composer .memory-mobile-stage:not(.force-hide) { display: flex; flex-direction: column; }
.memory-stage-form,
.memory-composer #memory-mobile-stage-5 > .stage-content {
    display: flex;
    flex-direction: column;
    position: static !important;
    width: 100%;
    height: 100%;
    min-height: 0;
    flex: 1;
    margin: 0;
}
.memory-stage-fields,
.memory-composer .photos-list-wrapper {
    flex: 1;
    min-height: 0;
    max-height: none !important;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
.memory-stage-fields { padding: 8px 8px 24px; }
.memory-composer .photos-list-wrapper { padding: 0 24px 16px; }
.memory-composer #memory-mobile-stage-5 > .loading-images { position: absolute !important; inset: 0; height: auto !important; z-index: 3; }
.memory-composer .memory-photo-first-hint { margin: 8px 0 16px; color: #5b6559; font-size: 15px; line-height: 1.6; }
.memory-composer .memory-photo-first-button,
.memory-composer .photo-upload-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 56px;
    padding: 14px 20px;
    border: 1px dashed #c25a30;
    border-radius: 14px;
    background: #fff7f0;
    color: #a74722;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
}
.memory-composer .memory-photo-first-button { min-height: 112px; }
.memory-composer :is(.memory-photo-first-button, .photo-upload-actions) input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}
.memory-composer :is(.memory-photo-first-button, .photo-upload-actions):focus-within { outline: 3px solid #8e3c1b; outline-offset: 3px; }
.memory-composer .photo-upload-actions { margin: 8px 24px; flex-shrink: 0; background: #fff; border-style: solid; }
.memory-composer .search-consent-control { min-width: 0; color: #242824; background: #f7f8f3; font-size: 14px; line-height: 1.6; }
.memory-composer .search-consent-control legend { color: #242824; font-weight: 600; }
.memory-composer .search-consent-control label { display: flex; align-items: flex-start; gap: 10px; color: #242824; }
.memory-composer .search-consent-control input[type="checkbox"] { flex-shrink: 0; width: 20px; height: 20px; margin: 2px 0 0; accent-color: #b14b22; }
.memory-composer .search-consent-control p { margin: 12px 0 0; color: #5b6559; }
.memory-composer .search-consent-control a { color: #a74722; text-underline-offset: 3px; }
.memory-composer .memory-preview-body { padding: 16px; }
#memory-creation-mobile .memory-composer-footer {
    position: relative;
    flex-shrink: 0;
    width: 100%;
    margin-top: auto;
    padding: 16px 24px max(16px, env(safe-area-inset-bottom));
    border-top: 1px solid #e2e5dd;
    background: #fff;
}
.memory-composer-footer form { margin: 0; }
#memory-creation-mobile .memory-composer-footer .big-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    height: auto;
    padding: 12px 20px;
    color: #fff;
    background: #a74722;
    border: 0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    text-align: center;
}
#memory-creation-mobile .memory-composer-footer .big-button.disabled { background: #e8ebe3; color: #5b6559; }
.memory-composer :is(button, a, input, textarea):focus-visible { outline: 3px solid #8e3c1b; outline-offset: 3px; }
.memory-composer :is(input, textarea) { max-width: 100%; color: #242824; }

@media screen and (max-width: 600px) {
    #memory-creation-mobile { padding: 0; }
    #memory-creation-mobile > .modal {
        width: 100%;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border: 0;
        border-radius: 0;
    }
    .memory-composer-utilities { padding: 16px 16px 8px; gap: 8px; }
    .memory-composer-utilities h2 { font-size: 20px; }
    .memory-composer .md-editor-links { gap: 4px; }
    .memory-composer .md-editor-links :is(a, button) { padding-inline: 8px; font-size: 12px; }
    .memory-composer-header { gap: 8px; padding: 8px 16px 12px; }
    .memory-composer-header > button { width: 40px; height: 40px; flex-basis: 40px; }
    .memory-composer .memory-step-label { padding: 0 16px 12px; }
    .memory-composer .photos-list-wrapper { padding-inline: 16px; }
    .memory-composer .photo-upload-actions { margin-inline: 16px; }
    #memory-creation-mobile .memory-composer-footer { padding-inline: 16px; }
}

/* Legacy date styles remain shared with older editor entry points. */
.dateTitle{
    font-family: 'SFProText';
    font-size: 14px;
    color: #757575;
    margin-bottom: 4px;
    margin-left: 10px;
}
.dateInput
{
    height: 56px;
    width: 25%;
    border-radius: 8px;
    border: none;
    font-family: SF Pro Text;
    font-size: 20px;
    font-weight: 400;
    line-height: 18px;
    letter-spacing: 0em;
    text-align: center;
    color: #757575;
    outline: none;
}
#startWarning
{
    color: #DF361F;
}
#endWarning
{
    color: #757575;
}
.desc
{
    font-family: SF Pro Text;
    font-size: 14px;
    font-weight: 400;
    line-height: 18px;
    letter-spacing: 0em;
    text-align: left;
}

/* ==========================================
   Mobile Date Picker - Polished Styles
   ========================================== */

.mobile-date-label {
    font-family: 'SFProText';
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mobile-date-optional {
    font-weight: 400;
    color: #9ca3af;
    font-size: 13px;
}

.mobile-date-container {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 8px 12px;
    transition: all 0.2s ease;
}

.mobile-date-container:focus-within {
    border-color: #ea794c;
    box-shadow: 0 0 0 3px rgba(234, 121, 76, 0.12);
    background: white;
}

.mobile-date-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.mobile-date-field-year {
    flex: 1.3;
}

.mobile-date-input {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 8px;
    font-family: 'SFProText';
    font-size: 20px;
    font-weight: 500;
    text-align: center;
    color: #333;
    background: transparent;
    outline: none;
    transition: background-color 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

.mobile-date-input:focus {
    background: rgba(234, 121, 76, 0.08);
    border-radius: 8px;
}

.mobile-date-input::placeholder {
    color: #c5c8cc;
    font-weight: 400;
}

/* Hide number input spinners */
.mobile-date-input::-webkit-outer-spin-button,
.mobile-date-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.mobile-date-field-label {
    font-family: 'SFProText';
    font-size: 10px;
    font-weight: 500;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.mobile-date-divider {
    font-family: 'SFProText';
    font-size: 20px;
    color: #d1d5db;
    padding: 0 4px;
    margin-bottom: 14px;
    user-select: none;
}

.mobile-date-error {
    font-family: 'SFProText';
    font-size: 13px;
    font-weight: 400;
    color: #df361f;
    margin-top: 8px;
    min-height: 20px;
    line-height: 1.4;
}

.mobile-date-hint {
    line-height: 1.5;
}

/* Error state for date container */
.mobile-date-container.error {
    border-color: #df361f;
    background: #fef2f2;
}

.mobile-date-container.error:focus-within {
    box-shadow: 0 0 0 3px rgba(223, 54, 31, 0.12);
}

/* Success state for date container */
.mobile-date-container.success {
    border-color: #6bba1c;
    background: #f0fdf4;
}

.mobile-date-container.success:focus-within {
    box-shadow: 0 0 0 3px rgba(107, 186, 28, 0.12);
}

/* Animation for focus transitions */
@keyframes dateFocusPulse {
    0% { box-shadow: 0 0 0 0 rgba(234, 121, 76, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(234, 121, 76, 0); }
    100% { box-shadow: 0 0 0 0 rgba(234, 121, 76, 0); }
}

.mobile-date-container:focus-within .mobile-date-input:focus {
    animation: dateFocusPulse 0.4s ease-out;
}

/* Quick date shortcuts (future enhancement) */
.mobile-date-shortcuts {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.mobile-date-shortcut {
    padding: 8px 14px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-family: 'SFProText';
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-date-shortcut:hover,
.mobile-date-shortcut:active {
    border-color: #ea794c;
    color: #ea794c;
    background: #fff7ed;
}

/* Responsive adjustments for very small screens */
@media screen and (max-width: 360px) {
    .mobile-date-input {
        font-size: 18px;
        height: 40px;
    }

    .mobile-date-divider {
        font-size: 18px;
        padding: 0 2px;
    }

    .mobile-date-container {
        padding: 6px 8px;
    }

    .mobile-date-field-label {
        font-size: 9px;
    }
}
