/* ===== 系統選單樣式 (System Menu) - Bubble Style ===== */
.sys-menu-btn {
    /* Fixed position as per reference, or relative to container? 
       Reference uses position: fixed; top: 14px; right: 14px; 
       But here we are inside a relative container. 
       If we want it to look exactly like the reference, maybe we should float it?
       For now, I will keep the positioning logic from previous implementation (absolute right in container)
       but apply the bubble style.
    */
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    
    /* Bubble Style from JS_價格計算.html */
    background: #7952b3; 
    color: white; 
    border: none; 
    padding: 8px 16px; 
    border-radius: 24px; /* 全圓角 */ 
    font-size: 14px; 
    font-weight: 500; 
    cursor: pointer; 
    box-shadow: 0 3px 8px rgba(121, 82, 179, 0.4); 
    transition: transform 0.2s, box-shadow 0.2s; 
    z-index: 1002;
}

.sys-menu-btn:hover {
    transform: translateY(calc(-50% - 2px)); /* Adjust for translateY(-50%) */
    box-shadow: 0 5px 12px rgba(121, 82, 179, 0.5); 
    background: #7952b3; /* Keep color */
}

/* Override for specific backgrounds if needed */
.top-nav.bg-light .sys-menu-btn {
    /* If the background is light, the purple button pops nicely. No change needed. */
}

.sys-menu-dropdown {
    display: none;
    position: absolute;
    right: 0; /* Align to right of container or button */
    top: 100%; /* Below the container */
    margin-top: 10px;
    
    /* Bubble Dropdown Style */
    background: white; 
    min-width: 170px; 
    border-radius: 16px; /* 氣泡感 */ 
    box-shadow: 0 6px 18px rgba(0,0,0,0.18); 
    z-index: 1100; 
    overflow: hidden; 
    text-align: left;
    border: none; /* Remove border from previous style */
}

.sys-menu-dropdown.show {
    display: block;
}

.sys-menu-dropdown a {
    display: block;
    padding: 12px 18px;
    color: #333 !important;
    text-decoration: none;
    font-size: 14px;
    font-weight: normal !important;
    transition: background 0.1s;
    background: transparent !important;
}

.sys-menu-dropdown a:hover {
    background-color: #f5f0ff !important;
    color: #333 !important;
}

.sys-menu-dropdown hr {
    border: 0;
    border-top: 1px solid #eee;
    margin: 4px 0;
}

.sys-menu-edit-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 18px; /* Match link padding */
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 14px;
}
.sys-menu-edit-btn:hover {
    color: #7952b3;
    background-color: #f5f0ff;
}

/* Modal Styles - Keep existing but ensure z-index is high enough */
.sys-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}
.sys-modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 24px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.sys-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 15px;
}
.sys-modal-header h3 { margin: 0; font-size: 18px; color: #333; }
.sys-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}
.sys-close:hover { color: #000; }

.sys-item-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    align-items: center;
}
.sys-item-row input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 0;
}
.sys-input-label { width: 35%; }
.sys-input-url { flex: 1; }
.sys-btn-up,
.sys-btn-down {
    background: #f5f0ff;
    border: none;
    cursor: pointer;
    color: #7952b3;
    font-size: 14px;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sys-btn-up:hover,
.sys-btn-down:hover { background: #ede5ff; }
.sys-btn-del {
    background: #ffeaea;
    border: none;
    cursor: pointer;
    color: #e74c3c;
    font-size: 16px;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sys-btn-del:hover { background: #ffdcdc; }

.sys-modal-footer {
    margin-top: 25px;
    text-align: right;
    border-top: 1px solid #eee;
    padding-top: 20px;
}
.sys-btn-add {
    background-color: #f0f7ff;
    color: #1a73e8;
    border: 1px dashed #1a73e8;
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
    font-weight: 500;
}
.sys-btn-add:hover { background-color: #e8f0fe; }

.sys-btn-save {
    background-color: #1a73e8;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
}
.sys-btn-save:hover { background-color: #1557b0; }

.sys-btn-cancel {
    background-color: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 10px;
    font-size: 15px;
}
.sys-btn-cancel:hover { background-color: #e9ecef; }
