:root {
    --share-primary: var(--accent-color, #8B5CF6);
    --share-primary-hover: var(--accent-hover, #7c3aed);
    --share-bg-dark: var(--bg-secondary, #2a2a2a);
    --share-bg-light: var(--bg-tertiary, #333333);
    --share-bg-hover: var(--bg-hover, #505050);

    /* Text Hierarchy System */
    --share-text-emphasis: var(--text-emphasis, #ffffff);
    --share-text-main: var(--text-primary, #e0e0e0);
    --share-text-dim: var(--text-secondary, #a0a0a0);
    --share-text-muted: var(--text-muted, #707070);
    --share-border: var(--border-color, rgba(255, 255, 255, 0.12));
    --share-font: 'Pretendard', sans-serif;
}

/* --- Modal Overlay & Animation --- */
#memo_share_modal_overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10005;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

#memo_share_modal_overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.share_modal {
    width: 500px;
    background-color: var(--bg-secondary, #2a2a2a);
    border: 1px solid var(--share-border);
    border-radius: var(--radius-lg);
    box-shadow: none !important;
    padding: var(--spacing-xl);
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    font-family: var(--share-font);
    color: var(--share-text-main);
}

#memo_share_modal_overlay:not(.hidden) .share_modal {
    transform: scale(1);
    opacity: 1;
}

/* --- Shared / Common Modal Components --- */
.share_modal_header,
.share_modal .ws-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    background-color: var(--bg-secondary, #2a2a2a);
}

.share_modal_header h3,
.share_modal .ws-window-header h3 {
    margin: 0;
    font-size: var(--font-size-lg, 18px);
    font-weight: var(--font-weight-bold, 700);
    color: var(--share-text-emphasis, #ffffff);
}

.share_close_icon {
    width: 20px;
    height: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.share_close_icon:hover {
    opacity: 1;
}

.share_section_label {
    font-size: var(--font-size-base, 14px);
    font-weight: var(--font-weight-medium, 500);
    color: var(--share-text-main, #e0e0e0);
    margin-bottom: 12px;
}

/* --- Initial View Specific Styles --- */
#share_initial_view.hidden {
    display: none;
}

.share_access_list_section {
    margin-top: 24px;
}

.access_user_list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.access_user_item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    background-color: var(--bg-secondary, #2a2a2a);
    transition: background-color 0.2s ease;
}

.access_user_item:hover {
    background-color: var(--bg-hover, #404040);
}

.user_avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--share-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    overflow: hidden;
    flex-shrink: 0;
}

.user_avatar img,
.user_avatar_small img,
.search_result_avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.user_info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.share-user-name {
    font-size: var(--font-size-base, 14px);
    font-weight: var(--font-weight-medium, 500);
    color: var(--share-text-main, #e0e0e0);
}

.share-user-email {
    font-size: var(--font-size-xs, 12px);
    color: var(--share-text-muted, #707070);
}

.user_role {
    font-size: var(--font-size-base, 14px);
    color: var(--share-text-dim, #a0a0a0);
}

.share_option_section {
    margin-top: 24px;
}

.share_options_container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.share_option_item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--share-border);
    border-radius: var(--radius-md);
    background-color: var(--bg-secondary, #2a2a2a);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.share_option_item:hover {
    background-color: var(--bg-hover, #404040);
    border-color: var(--border-color-hover, rgba(255, 255, 255, 0.24));
}

.share_option_item.selected {
    background-color: rgba(139, 92, 246, 0.15);
    border-color: var(--share-primary);
}

.share_option_item.selected:hover {
    background-color: rgba(139, 92, 246, 0.25);
    border-color: var(--share-primary);
}

.option_radio {
    width: 18px;
    height: 18px;
    border: 2px solid var(--share-border);
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}

.share_option_item.selected .option_radio {
    border-color: var(--share-primary);
}

.share_option_item.selected .option_radio::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background-color: var(--share-primary);
    border-radius: 50%;
}

.option_info {
    display: flex;
    flex-direction: column;
}

.option_title {
    font-size: var(--font-size-base, 14px);
    font-weight: var(--font-weight-medium, 500);
    color: var(--share-text-main, #e0e0e0);
}

.option_desc {
    font-size: var(--font-size-xs, 12px);
    color: var(--share-text-dim, #a0a0a0);
}

.share_modal_footer,
.ws-window-footer.share_modal_footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 36px;
    margin-top: 32px;
    box-sizing: border-box;
}

.share_link_pill_btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 16px;
    background-color: transparent;
    border: 1px solid var(--share-border);
    border-radius: var(--radius-full, 9999px);
    color: var(--share-text-main, #e0e0e0);
    font-size: var(--font-size-base);
    font-weight: 500;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.2s;
}

.share_link_pill_btn:hover {
    background-color: rgba(139, 92, 246, 0.1);
    border-color: var(--share-primary);
    color: var(--share-text-emphasis, #ffffff);
}

#memo_share_save {
    background-color: var(--accent-color, #8B5CF6) !important;
    color: var(--share-text-main, #e0e0e0) !important;
    border: none;
    border-radius: var(--radius-full, 9999px);
    padding: 0 24px;
    height: 36px;
    font-size: var(--font-size-base, 14px);
    font-weight: 600;
    cursor: pointer;
    flex-grow: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    transition: background-color 0.2s ease, color 0.2s ease !important;
    transform: none !important;
}

#memo_share_save:hover,
#memo_share_save:active {
    background-color: #9d74f7 !important;
    color: var(--share-text-emphasis, #ffffff) !important;
    transform: none !important;
    box-shadow: none !important;
}

/* --- Share Send View Styles --- */
#share_send_view {
    display: flex;
    flex-direction: column;
}

#share_send_view.hidden {
    display: none;
}

.share_modal_header.send_header {
    justify-content: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

.share_back_icon {
    width: 18px;
    height: 18px;
    cursor: pointer;
    opacity: 1;
}

.share_back_icon:hover {
    opacity: 0.7;
}

#share_send_title {
    font-size: var(--font-size-md, 16px);
    font-weight: var(--font-weight-medium, 500);
    color: var(--share-text-emphasis, #ffffff);
}

.share_modal_body.send_body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.share_send_input_area {
    position: relative;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.share-input-group input {
    flex: 1;
    background: #1e1e20;
    border: 1px solid #3d3d42;
    border-radius: var(--radius-md, 10px);
    padding: 10px 14px;
    color: var(--share-text-main, #e0e0e0);
    font-size: var(--font-size-base, 14px);
    outline: none;
}

.share-input-group input::placeholder {
    color: var(--share-text-muted, #707070);
    font-size: var(--font-size-base, 14px);
}

.share-copy-btn {
    padding: 10px 16px;
    background: var(--accent-color, #8B5CF6);
    color: var(--share-text-main, #e0e0e0);
    border: none;
    border-radius: var(--radius-sm, 6px);
    font-size: var(--font-size-base, 14px);
}

.share_send_fieldset {
    flex-grow: 1;
    border: 1px solid var(--share-border);
    border-radius: var(--radius-md, 10px);
    background-color: var(--bg-secondary, #2a2a2a);
    padding: 8px 12px;
    margin: 0;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-height: 56px;
    box-sizing: border-box;
    transition: border-color var(--duration-fast, 150ms) ease,
                background-color var(--duration-fast, 150ms) ease;
}

.share_send_fieldset:hover {
    background-color: var(--bg-hover, #404040);
    border-color: var(--border-color-hover, rgba(255, 255, 255, 0.24));
}

.share_send_fieldset:focus-within {
    background-color: var(--bg-hover, #404040);
    border-color: var(--accent-color, #8B5CF6);
    padding: 8px 12px;
}

.share_send_fieldset legend {
    font-size: var(--font-size-xs, 12px);
    font-weight: var(--font-weight-medium, 500);
    color: var(--share-primary, #8B5CF6);
    padding: 0 4px;
    margin-left: -4px;
}

.share_send_pill_container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.share_send_inline_input {
    flex: 1 1 120px;
    min-width: 100px;
    height: 32px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--share-text-main, #e0e0e0);
    font-size: var(--font-size-base, 14px);
    font-family: var(--share-font, inherit);
    padding: 0 4px;
    margin: 0;
    box-sizing: border-box;
    line-height: 32px;
}

.share_send_inline_input::placeholder {
    color: var(--share-text-muted, #707070);
    font-size: var(--font-size-base, 14px);
}

.user_pill {
    display: flex;
    align-items: center;
    background-color: transparent;
    border: 1px solid var(--share-border);
    border-radius: var(--radius-full, 9999px);
    padding: 0 8px 0 2px;
    gap: 8px;
    height: 32px;
    box-sizing: border-box;
}

.user_avatar_small {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: #f06292;
    /* Dynamic or fixed colors */
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
}

.user_email_pill {
    font-size: var(--font-size-base, 14px);
    color: var(--share-text-main, #e0e0e0);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove_pill {
    cursor: pointer;
    color: var(--share-text-muted, #707070);
    font-size: 18px;
    margin-left: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.remove_pill:hover {
    color: var(--share-text-emphasis, #ffffff);
}

.search_input_container {
    position: relative;
    background-color: var(--bg-secondary, #2a2a2a);
    border-radius: var(--radius-md, 10px);
    height: 48px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    border: 1px solid var(--share-border);
    transition: border-color var(--duration-fast, 150ms) ease,
                background-color var(--duration-fast, 150ms) ease;
}

.search_input_container:hover {
    background-color: var(--bg-hover, #404040);
    border-color: var(--border-color-hover, rgba(255, 255, 255, 0.24));
}

.search_input_container:focus-within {
    background-color: var(--bg-hover, #404040);
    border-color: var(--accent-color, #8B5CF6);
}

.custom_role_dropdown {
    position: relative;
    height: 36px;
    margin-top: 10px;
    background-color: var(--bg-secondary, #2a2a2a);
    border: 1px solid var(--share-border);
    border-radius: var(--radius-sm, 6px);
    color: var(--share-text-main, #e0e0e0);
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
    min-width: 100px;
    display: inline-flex;
    align-items: center;
    transition: border-color var(--duration-fast, 150ms) ease,
        background-color var(--duration-fast, 150ms) ease;
}

.custom_role_dropdown:hover {
    background-color: var(--bg-hover, #404040);
    border-color: var(--border-color-hover, rgba(255, 255, 255, 0.24));
}

.custom_role_dropdown.open {
    background-color: var(--bg-hover, #404040);
    border-color: var(--accent-color, #8B5CF6);
}

.role_selected_display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px;
    width: 100%;
    height: 100%;
    font-size: var(--font-size-base, 14px);
    font-weight: var(--font-weight-medium, 500);
    color: var(--share-text-main, #e0e0e0);
    box-sizing: border-box;
}

.dropdown_arrow_img {
    width: 10px;
    height: 10px;
    margin-left: 8px;
    opacity: 0.7;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.custom_role_dropdown:hover .dropdown_arrow_img {
    opacity: 1;
}

.custom_role_dropdown.open .dropdown_arrow_img {
    transform: rotate(180deg);
    opacity: 1;
}

.role_options_list {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    width: 280px;
    background-color: var(--bg-secondary, #2a2a2a);
    border: 1px solid var(--share-border);
    border-radius: var(--radius-md, 10px);
    box-shadow: none !important;
    padding: var(--spacing-xs, 4px);
    z-index: 10001;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-sizing: border-box;
}

.role_option {
    padding: 8px 12px;
    border-radius: var(--radius-sm, 6px);
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    user-select: none;
    transition: background-color var(--duration-fast, 150ms) ease,
        color var(--duration-fast, 150ms) ease;
    box-sizing: border-box;
}

.role_option:hover {
    background-color: var(--bg-hover, #404040);
    color: var(--share-text-emphasis, #ffffff);
}

.role_option.selected {
    background-color: rgba(139, 92, 246, 0.15);
}

.role_name {
    font-size: var(--font-size-base, 14px);
    font-weight: var(--font-weight-medium, 500);
    color: var(--share-text-main, #e0e0e0);
}

.role_option:hover .role_name {
    color: var(--share-text-emphasis, #ffffff);
}

.role_desc {
    font-size: var(--font-size-xs, 12px);
    color: var(--share-text-dim, #a0a0a0);
    line-height: 1.4;
}

.share_send_message_section textarea {
    width: 100%;
    height: 100px;
    background-color: var(--bg-secondary, #2a2a2a);
    border: 1px solid var(--share-border);
    border-radius: var(--radius-md, 10px);
    padding: 12px;
    color: var(--share-text-main, #e0e0e0);
    font-size: var(--font-size-base, 14px);
    font-family: inherit;
    resize: none;
    outline: none;
    box-sizing: border-box;
    transition: border-color var(--duration-fast, 150ms) ease,
                background-color var(--duration-fast, 150ms) ease;
}

.share_send_message_section textarea::placeholder {
    color: var(--share-text-muted, #707070);
    font-size: var(--font-size-base, 14px);
}

.share_send_message_section textarea:hover {
    background-color: var(--bg-hover, #404040);
    border-color: var(--border-color-hover, rgba(255, 255, 255, 0.24));
}

.share_send_message_section textarea:focus {
    background-color: var(--bg-hover, #404040);
    border-color: var(--accent-color, #8B5CF6);
}

/* Custom Slim Scrollbar for Share Modal */
.share_send_message_section textarea::-webkit-scrollbar,
.search_results_dropdown::-webkit-scrollbar {
    width: 5px;
}

.share_send_message_section textarea::-webkit-scrollbar-track,
.search_results_dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.share_send_message_section textarea::-webkit-scrollbar-thumb,
.search_results_dropdown::-webkit-scrollbar-thumb {
    background-color: #4b4b4b;
    border-radius: var(--radius-xs, 4px);
}

.share_send_message_section textarea::-webkit-scrollbar-thumb:hover,
.search_results_dropdown::-webkit-scrollbar-thumb:hover {
    background-color: var(--share-text-muted, #707070);
}

.share_modal_footer.send_footer,
.ws-window-footer.share_modal_footer.send_footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 36px;
    margin-top: 24px;
    box-sizing: border-box;
}

/* --- Search Results Dropdown --- */
.search_results_dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background-color: var(--bg-secondary, #2a2a2a);
    border: 1px solid var(--share-border);
    border-radius: var(--radius-md, 10px);
    box-shadow: none !important;
    padding: var(--spacing-xs, 4px);
    z-index: 10000;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    gap: 2px;
    box-sizing: border-box;
}

.search_results_dropdown:not(.hidden) {
    display: flex;
}

.search_result_item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    user-select: none;
    transition: background-color var(--duration-fast, 150ms) ease;
    box-sizing: border-box;
}

.search_result_item:hover {
    background-color: var(--bg-hover, #404040);
}

.search_result_avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--share-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.search_result_info {
    display: flex;
    flex-direction: column;
}

.user_name {
    font-size: var(--font-size-base, 14px);
    font-weight: var(--font-weight-medium, 500);
    color: var(--share-text-main, #e0e0e0);
}

.search_result_item:hover .user_name {
    color: var(--share-text-emphasis, #ffffff);
}

.user_email {
    font-size: var(--font-size-xs, 12px);
    color: var(--share-text-muted, #707070);
}

.share_link_icon_only {
    width: 20px;
    height: 20px;
    cursor: pointer;
    opacity: 0.8;
}

.share_link_icon_only:hover {
    opacity: 1;
}

#share_send_link_icon.share_link_icon_only {
    width: 20px;
    height: 20px;
    padding: 0 6px;
    box-sizing: content-box;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}

.send_footer_buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

#share_send_cancel {
    background-color: transparent !important;
    color: var(--share-text-main, #e0e0e0) !important;
    border: none;
    border-radius: var(--radius-full, 9999px);
    padding: 0 20px;
    height: 36px;
    font-size: var(--font-size-base, 14px);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    transition: background-color 0.2s ease, color 0.2s ease !important;
    transform: none !important;
}

#share_send_cancel:hover {
    background-color: var(--bg-hover, #404040) !important;
    color: var(--share-text-emphasis, #ffffff) !important;
}

#share_send_confirm {
    background-color: var(--accent-color, #8B5CF6) !important;
    color: var(--share-text-main, #e0e0e0) !important;
    border: none;
    border-radius: var(--radius-full, 9999px);
    padding: 0 24px;
    height: 36px;
    font-size: var(--font-size-base, 14px);
    font-weight: 600;
    cursor: pointer;
    flex-grow: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    transition: background-color 0.2s ease, color 0.2s ease !important;
    transform: none !important;
}

#share_send_confirm:hover,
#share_send_confirm:active {
    background-color: #9d74f7 !important;
    color: var(--share-text-emphasis, #ffffff) !important;
    transform: none !important;
    box-shadow: none !important;
}